From c6565065916721d8709f4f5ff8cddca567b9eea7 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sun, 3 Nov 2024 19:07:38 +0100 Subject: [PATCH] fixed QC for deceased column --- src/pyphetools/__init__.py | 2 +- src/pyphetools/creation/case_template_encoder.py | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/pyphetools/__init__.py b/src/pyphetools/__init__.py index eea151f4..54846906 100644 --- a/src/pyphetools/__init__.py +++ b/src/pyphetools/__init__.py @@ -5,7 +5,7 @@ from . import validation -__version__ = "0.9.112" +__version__ = "0.9.113" __all__ = [ diff --git a/src/pyphetools/creation/case_template_encoder.py b/src/pyphetools/creation/case_template_encoder.py index 2c888ff2..2685b802 100644 --- a/src/pyphetools/creation/case_template_encoder.py +++ b/src/pyphetools/creation/case_template_encoder.py @@ -228,16 +228,13 @@ def __init__(self, df:pd.DataFrame, hpo_cr:HpoConceptRecognizer, created_by:str, # should never happen unless the template file is corrupted raise ValueError("headers are different lengths. Check template file for correctness.") # check headers are well formed - idx = 0 required_h1 = REQUIRED_H1_FIELDS required_h2 = REQUIRED_H2_FIELDS for i in range(len(required_h1)): - if idx == ALLELE_2_IDX and header_1[idx] != required_h1[idx]: - idx += 1 # skip optional index - if header_1[idx] != required_h1[idx]: - raise ValueError(f"Malformed header 1 field at index {idx}. Expected \"{required_h1[idx]}\" but got \"{header_1[idx]}\"") - if header_2[idx] != required_h2[idx]: - raise ValueError(f"Malformed header 2 field at index {idx}. Expected \"{required_h2[idx]}\" but got \"{header_2[idx]}\"") + if header_1[i] != required_h1[i]: + raise ValueError(f"Malformed header 1 field at index {i}. Expected \"{required_h1[i]}\" but got \"{header_1[i]}\"") + if header_2[i] != required_h2[i]: + raise ValueError(f"Malformed header 2 field at index {i}. Expected \"{required_h2[i]}\" but got \"{header_2[i]}\"") self._header_fields_1 = header_1 self._n_columns = len(header_1) self._index_to_decoder = self._process_header(header_1=header_1, header_2=header_2, hpo_cr=hpo_cr)