-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ENH] Merge the add-description changes (#35)
* Add "Description" for Neurobagel CLI * Add missing values for "nan" * Auto add missing values to age We don't have the real values yet, so we just add them as a temorary safeguard * Fix adding missing values * Also clean up after ourselves * Prevent duplicates in added missing values * Update portalURI and session path * remove empty json * remove venv activation from bagel CLI runner script --------- Co-authored-by: Alyssa Dai <alyssa.ydai@gmail.com>
- Loading branch information
Showing
4 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import json | ||
from pathlib import Path | ||
import logging | ||
|
||
import typer | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def main(in_json: Path): | ||
"""Add a description to a data dictionary.""" | ||
with open(in_json, "r") as f: | ||
data_dict = json.load(f) | ||
|
||
have_written = False | ||
for k, v in data_dict.items(): | ||
if "Description" not in v: | ||
data_dict[k]["Description"] = "added description for Neurobagel" | ||
have_written = True | ||
|
||
logger.warning(f"Have written: {have_written}") | ||
|
||
with open(in_json, "w") as f: | ||
json.dump(data_dict, f, indent=2) | ||
|
||
|
||
if __name__ == "__main__": | ||
typer.run(main) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters