Skip to content

Commit

Permalink
Don't add NCIT term if there is no id
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Reese committed Dec 13, 2023
1 parent 43ff1c6 commit 52e2816
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/oncoexporter/cda/cda_disease_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ def _get_morphology_ncit_term_from_icdo(self, row) -> Optional[List[PPkt.Ontolog
ncit_record = self._icdo_to_ncit.get(row['morphology'])
ontology_term = PPkt.OntologyClass()
if 'NCIt Code (if present)' not in ncit_record:
warnings.warn(f"Couldn't find NCIt Code (if present) in record for ICD-O code {row['morphology']}")
warnings.warn(f"Couldn't find 'NCIt Code (if present)' entry in record for ICD-O code {row['morphology']}")
return None
elif ncit_record['NCIt Code (if present)'] == '':
warnings.warn(f"Found empty 'NCIt Code (if present)' entry in record for ICD-O code {row['morphology']}")
return None
else:
ontology_term.id = "NCIT:" + ncit_record['NCIt Code (if present)']
Expand Down

0 comments on commit 52e2816

Please sign in to comment.