diff options
| author | Frederick Muriuki Muriithi | 2026-04-16 13:55:04 -0500 |
|---|---|---|
| committer | Frederick Muriuki Muriithi | 2026-04-16 13:55:04 -0500 |
| commit | 98d4e05dd776f90333f6430e7e42e28689e6b3bf (patch) | |
| tree | e7b9fc7f359c05cdfaee96d82a39f3a4caa93f58 /scripts | |
| parent | c11ac9acfbdc0dbcd3105cf7cfc7be8a017e0615 (diff) | |
| download | gn-uploader-98d4e05dd776f90333f6430e7e42e28689e6b3bf.tar.gz | |
Fix bug with cascade of name checks.
The `meta["data_name"]` statement was leading to an exception in any case where the "data_name" key is not provided. This defeats the purpose of allowing either "dataname" or "data_name". This commit fixes that, while handling the case where neither one of the two are provided.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/load_phenotypes_to_db.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/load_phenotypes_to_db.py b/scripts/load_phenotypes_to_db.py index 3868e19..31eb715 100644 --- a/scripts/load_phenotypes_to_db.py +++ b/scripts/load_phenotypes_to_db.py @@ -7,6 +7,7 @@ import logging import argparse from pathlib import Path from zipfile import ZipFile +from datetime import datetime from typing import Any, Iterable from urllib.parse import urljoin from functools import reduce, partial @@ -469,9 +470,10 @@ if __name__ == "__main__": "datadescription": "description" } return { - "resource_name": meta.get(# at least one of these MUST be set. + "resource_name": meta.get( "dataname", - meta["data_name"]), + meta.get("data_name", + "Unnamed phenotypes - " + datetime.now().isoformat())), "resource_metadata": { rkey: meta[mkey] for mkey, rkey in _key_mappings_.items() if mkey in meta |
