aboutsummaryrefslogtreecommitdiff
path: root/uploader/phenotypes
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-07-01 14:47:39 -0500
committerFrederick Muriuki Muriithi2025-07-01 14:47:39 -0500
commitffdd133f96202647f9b0e61a8258e16a5445ebd5 (patch)
treeb59a305e3a6900fc725c16b9183da9394068378c /uploader/phenotypes
parent4dc851df38068b98b3e525217978557139578808 (diff)
downloadgn-uploader-ffdd133f96202647f9b0e61a8258e16a5445ebd5.tar.gz
Ignore any optional files that are not provided.
Diffstat (limited to 'uploader/phenotypes')
-rw-r--r--uploader/phenotypes/views.py13
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")