Skip to content

Commit

Permalink
move fetch_data to commands
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad committed Sep 25, 2023
1 parent 6c3330a commit 99b9f02
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
6 changes: 0 additions & 6 deletions care/facility/static_data/icd11.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import contextlib
import json

from django.db import connection
from littletable import Table

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()
Expand Down

0 comments on commit 99b9f02

Please sign in to comment.