diff options
author | Frederick Muriuki Muriithi | 2025-07-01 14:47:39 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2025-07-01 14:47:39 -0500 |
commit | ffdd133f96202647f9b0e61a8258e16a5445ebd5 (patch) | |
tree | b59a305e3a6900fc725c16b9183da9394068378c /uploader/phenotypes | |
parent | 4dc851df38068b98b3e525217978557139578808 (diff) | |
download | gn-uploader-ffdd133f96202647f9b0e61a8258e16a5445ebd5.tar.gz |
Ignore any optional files that are not provided.
Diffstat (limited to 'uploader/phenotypes')
-rw-r--r-- | uploader/phenotypes/views.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/uploader/phenotypes/views.py b/uploader/phenotypes/views.py index 97bcafe..8e47242 100644 --- a/uploader/phenotypes/views.py +++ b/uploader/phenotypes/views.py @@ -374,10 +374,15 @@ def process_phenotypes_individual_files(error_uri): bundlepath = Path(app.config["UPLOAD_FOLDER"], f"{str(uuid.uuid4()).replace('-', '')}.zip") with ZipFile(bundlepath,mode="w") as zfile: - for rqtlkey, formkey in (("phenocovar", "phenotype-descriptions"), - ("pheno", "phenotype-data"), - ("phenose", "phenotype-se"), - ("phenonum", "phenotype-n")): + for rqtlkey, formkey, _type in ( + ("phenocovar", "phenotype-descriptions", "mandatory"), + ("pheno", "phenotype-data", "mandatory"), + ("phenose", "phenotype-se", "optional"), + ("phenonum", "phenotype-n", "optional")): + if _type == "optional" and not bool(form.get(formkey)): + # skip if an optional key does not exist. + continue + cdata[f"{rqtlkey}_transposed"] = ( (form.get(f"{formkey}-transposed") or "off") == "on") |