diff --git a/care/facility/static_data/icd11.py b/care/facility/static_data/icd11.py index dd379671e5..d379d62450 100644 --- a/care/facility/static_data/icd11.py +++ b/care/facility/static_data/icd11.py @@ -36,8 +36,10 @@ def get_representation(self) -> ICD11Object: def load_icd11_diagnosis(): print("Loading ICD11 Diagnosis into the redis cache...", end="", flush=True) - icd_objs = ICD11Diagnosis.objects.order_by("id").values_list( - "id", "label", "meta_chapter_short" + icd_objs = ( + ICD11Diagnosis.objects.filter(meta_chapter_short__isnull=False) + .order_by("id") + .values_list("id", "label", "meta_chapter_short") ) paginator = Paginator(icd_objs, 5000) for page_number in paginator.page_range: @@ -45,7 +47,7 @@ def load_icd11_diagnosis(): ICD11( id=diagnosis[0], label=diagnosis[1], - chapter=diagnosis[2] or "", + chapter=diagnosis[2], has_code=1 if re.match(DISEASE_CODE_PATTERN, diagnosis[1]) else 0, vec=diagnosis[1].replace(".", "\\.", 1), ).save()