Skip to content
Snippets Groups Projects
Commit 305237d5 authored by mjbonifa's avatar mjbonifa
Browse files

standardised code_type import in phen

parent 19918ce3
Branches
No related tags found
No related merge requests found
......@@ -397,14 +397,14 @@ class Cprd(Proto):
]
code_types = {
"read2": Read2,
"read3": Read3,
"icd10": Icd10,
"snomed": Snomed,
"opcs4": Opcs4,
"atc": Atc,
"med": Med,
"cprd": Cprd,
"read2": Read2(),
"read3": Read3(),
"icd10": Icd10(),
"snomed": Snomed(),
"opcs4": Opcs4(),
"atc": Atc(),
"med": Med(),
"cprd": Cprd(),
}
vocab_types = {
......
......@@ -384,21 +384,21 @@ def preprocess(df, file, target_code_type=None, codes_file=None, translate=True,
out = preprocess_code(out=out,
codes=df[file[columns][target_code_type]].dropna(),
codes_file=codes_file,
checker=parse.code_types[target_code_type](),
checker=parse.code_types[target_code_type],
output_col=target_code_type,
metadata_df=df[meta_columns])
else:
logger.warning(f"No {target_code_type} Codes to process")
else:
# QA for every code type in df run preprocess_code()
for k, v in parse.code_types.items():
if k in file['columns']:
for code_type_name, code_type in parse.code_types.items():
if code_type_name in file['columns']:
logger.info(f"Processing {k} Codes...")
out = preprocess_code(out=out,
codes=df[file['columns'][k]].dropna(),
codes=df[file['columns'][code_type_name]].dropna(),
codes_file=codes_file,
checker=v(),
output_col=k,
checker=code_type,
output_col=code_type_name,
metadata_df=df[meta_columns])
return out, meta_columns
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment