incf-nidash / PyNIDM

Other
21 stars 31 forks source link

deleting BIDS like participants.json without warning #319

Open Remi-Gau opened 2 years ago

Remi-Gau commented 2 years ago

That must be me not understanding how bidsmri2nidm but I was trying to annotate a BIDS dataset

bidsmri2nidm -d . -bidsignore

that already contained a participants.json file formatted à la BIDS

{
    "participant_id": {
        "LongName": "participant ID"
    },
    "Age": {
        "LongName": "age",
        "Units": "years from birth"
    },
    "Sex": {
        "LongName": "gender",
        "Levels": {
            "1": "male",
            "0": "female"
        }
    },
    "Educational level": {
        "LongName": "educational level",
        "Units": "number of years completed at school"
    },
    "Smoker": {
        "LongName": "smoker",
        "Levels": {
            "1": "smoker",
            "0": "non-smoker"
        }
    },
    "Medication": {
        "LongName": "medication",
        "Description": "subject was taking some sort of prescribed medication during the time of the study",
        "Levels": {
            "1": "on medication",
            "0": "no medication"
        }
    },

...

I did not want to run the whole annotation so I ctrl+C after a few terms but now I found myself with a participants.json that only has the terms that I have annotated.

I may be useful to allow for a way to quit more gracefully and without losing all the rest of the content of the participants.json file.

dbkeator commented 2 years ago

Hi, It typically would load the existing json file but it only loads keys that are defined in either the BIDS json format or the reproschema formats. I see "LongName" is now a valid key in the BIDS JSON format but that's probably and update I missed along the way. Here are the examples we worked with: https://github.com/NIDM-Terms/terms/tree/master/terms/OpenNeuro_Datasets_Terms/OpenNeuro_BIDS_json_sidecar

Anyway, I agree, a more graceful way of exiting would be good. I'll use your example for testing and submit an update...

Remi-Gau commented 2 years ago

awesome thanks