Skip to content

Commit a72818d

Browse files
committed
Fix local unit health data reader
1 parent 0b28ce5 commit a72818d

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

local_units/management/commands/import_health_data.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ def handle(self, *args, **options):
2121
def wash(string):
2222
return string.lower().replace("/", "").replace("_", "").replace(",", "").replace(" ", "")
2323

24-
def wash_leave_space(string):
25-
return string.lower().replace("/", "").replace("_", "").replace(",", "")
24+
# Previously used with m2m rows, but in the latest CSV we changed to "wash_comma_to_space" instead of this:
25+
# def wash_leave_space(string):
26+
# return string.lower().replace("/", "").replace("_", "").replace(",", "")
27+
28+
def wash_comma_to_space(string):
29+
return string.lower().replace("/", "").replace("_", "").replace(" ", "").replace(",", " ")
2630

2731
def numerize(value):
2832
return value if value.isdigit() else 0
@@ -95,10 +99,10 @@ def numerize(value):
9599
f_nir = row["Number of isolation rooms"]
96100
f_wrh = row["Warehousing"]
97101
f_cch = row["Cold chain"]
98-
f_gms = wash_leave_space(row["General medical services"]) # m2m
99-
f_spm = wash_leave_space(row["Specialized medical beyond primary level"]) # m2m
102+
f_gms = wash_comma_to_space(row["General medical services"]) # m2m
103+
f_spm = wash_comma_to_space(row["Specialized medical beyond primary level"]) # m2m
100104
f_ots = row["Other Services"]
101-
f_bls = wash_leave_space(row["Blood Services"]) # m2m
105+
f_bls = wash_comma_to_space(row["Blood Services"]) # m2m
102106
f_tnh = numerize(row["Total number of Human Resource"])
103107
f_gpr = numerize(row["General Practitioner"])
104108
f_spt = numerize(row["Specialist"])
@@ -111,7 +115,7 @@ def numerize(value):
111115
f_opr = row["Other Profiles"]
112116
f_fbk = row["Feedback"]
113117
f_oaf = row["Other Affiliation"]
114-
f_ptf = wash_leave_space(row["Professional Training Facilities"]) # m2m
118+
f_ptf = wash_comma_to_space(row["Professional Training Facilities"]) # m2m
115119
f_ata = row["Ambulance Type A"]
116120
f_atb = row["Ambulance Type B"]
117121
f_atc = row["Ambulance Type C"]

local_units/management/commands/import_local_units_health.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ def parse_date(date):
6464
health_id = existing_health_data.pk
6565
except ValueError:
6666
pass
67-
validated = True
6867
level_id = int(row["COVERAGECODE"]) # + 1
6968
local_branch_name = row["NAME_LOC"]
7069
english_branch_name = row["NAME_EN"]
@@ -87,8 +86,6 @@ def parse_date(date):
8786
level_id=level_id,
8887
country_id=country,
8988
type_id=type,
90-
# is_public=is_public,
91-
validated=validated,
9289
local_branch_name=local_branch_name[:255],
9390
english_branch_name=english_branch_name[:255],
9491
focal_person_loc=focal_person_loc[:255],

0 commit comments

Comments
 (0)