diff --git a/src/oncoexporter/cda/cda_disease_factory.py b/src/oncoexporter/cda/cda_disease_factory.py index ca56d29..c4d32ce 100644 --- a/src/oncoexporter/cda/cda_disease_factory.py +++ b/src/oncoexporter/cda/cda_disease_factory.py @@ -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)']