Skip to content

Commit

Permalink
fixed QC for deceased column
Browse files Browse the repository at this point in the history
  • Loading branch information
pnrobinson committed Nov 3, 2024
1 parent 27565e3 commit c656506
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/pyphetools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from . import validation


__version__ = "0.9.112"
__version__ = "0.9.113"


__all__ = [
Expand Down
11 changes: 4 additions & 7 deletions src/pyphetools/creation/case_template_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c656506

Please sign in to comment.