From 99b9f02a2b1e5cea47511a90a585a3b1e6f68dde Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Mon, 25 Sep 2023 21:06:33 +0530 Subject: [PATCH] move fetch_data to commands --- .../management/commands/load_icd11_diagnoses_data.py | 9 ++++++++- care/facility/static_data/icd11.py | 6 ------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/care/facility/management/commands/load_icd11_diagnoses_data.py b/care/facility/management/commands/load_icd11_diagnoses_data.py index 92d90417bd..4ad383bba7 100644 --- a/care/facility/management/commands/load_icd11_diagnoses_data.py +++ b/care/facility/management/commands/load_icd11_diagnoses_data.py @@ -1,7 +1,14 @@ +import json + from django.core.management import BaseCommand, CommandError from care.facility.models.icd11_diagnosis import ICD11Diagnosis -from care.facility.static_data.icd11 import fetch_data + + +def fetch_data(): + with open("data/icd11.json", "r") as json_file: + return json.load(json_file) + ICD11_ID_SUFFIX_TO_INT = { "mms": 1, diff --git a/care/facility/static_data/icd11.py b/care/facility/static_data/icd11.py index 109dda5b04..0d4ed4368a 100644 --- a/care/facility/static_data/icd11.py +++ b/care/facility/static_data/icd11.py @@ -1,5 +1,4 @@ import contextlib -import json from django.db import connection from littletable import Table @@ -7,11 +6,6 @@ from care.facility.models.icd11_diagnosis import ICD11Diagnosis -def fetch_data(): - with open("data/icd11.json", "r") as json_file: - return json.load(json_file) - - def fetch_from_db(): # This is a hack to prevent the migration from failing when the table does not exist all_tables = connection.introspection.table_names()