@@ -33,7 +33,7 @@ def fix_boolean_fields(row) -> Any:
33
33
"Is Cumulative" ,
34
34
"Has StdErr" ,
35
35
"Has Sample Size" ,
36
- "Include in signal app" ,
36
+ "Include in indicator app" ,
37
37
]
38
38
for k in fields :
39
39
if row [k ] == "TRUE" :
@@ -60,18 +60,18 @@ def process_signal_type(row) -> None:
60
60
"""
61
61
Processes signal type.
62
62
"""
63
- if row ["Signal Type" ]:
64
- signal_type = row ["Signal Type" ]
63
+ if row ["Indicator Type" ]:
64
+ signal_type = row ["Indicator Type" ]
65
65
signal_type_obj , _ = SignalType .objects .get_or_create (name = signal_type )
66
- row ["Signal Type" ] = signal_type_obj
66
+ row ["Indicator Type" ] = signal_type_obj
67
67
68
68
69
69
def process_format_type (row ) -> None :
70
70
"""
71
71
Processes format type.
72
72
"""
73
73
if row ["Format" ]:
74
- format_type = row ["Format" ]
74
+ format_type = row ["Format" ]. strip ()
75
75
format_type_obj , _ = FormatType .objects .get_or_create (name = format_type )
76
76
row ["Format" ] = format_type_obj
77
77
else :
@@ -82,24 +82,24 @@ def process_severity_pyramid_rungs(row) -> None:
82
82
"""
83
83
Processes severity pyramid rungs.
84
84
"""
85
- if row ["Severity Pyramid Rungs " ]:
86
- severity_pyramid_rung = row ["Severity Pyramid Rungs " ].strip ()
85
+ if row ["Surveillance Categories " ]:
86
+ severity_pyramid_rung = row ["Surveillance Categories " ].strip ()
87
87
if severity_pyramid_rung .startswith ("None" ):
88
- row ["Severity Pyramid Rungs " ] = None
88
+ row ["Surveillance Categories " ] = None
89
89
else :
90
90
severity_pyramid_rung_obj , _ = SeverityPyramidRung .objects .get_or_create (
91
91
name = severity_pyramid_rung ,
92
92
used_in = "signals" ,
93
93
defaults = {"used_in" : "signals" , "display_name" : severity_pyramid_rung },
94
94
)
95
- row ["Severity Pyramid Rungs " ] = severity_pyramid_rung_obj .id
95
+ row ["Surveillance Categories " ] = severity_pyramid_rung_obj .id
96
96
else :
97
97
none_severity_pyramid_rung_obj , _ = SeverityPyramidRung .objects .get_or_create (
98
98
name = "N/A" ,
99
99
used_in = "signals" ,
100
100
defaults = {"used_in" : "signals" , "display_name" : "N/A" },
101
101
)
102
- row ["Severity Pyramid Rungs " ] = none_severity_pyramid_rung_obj .id
102
+ row ["Surveillance Categories " ] = none_severity_pyramid_rung_obj .id
103
103
104
104
105
105
def process_category (row ) -> None :
@@ -116,12 +116,12 @@ def process_geographic_scope(row) -> None:
116
116
"""
117
117
Processes geographic scope.
118
118
"""
119
- if row ["Geographic Scope " ]:
120
- geographic_scope = row ["Geographic Scope " ]
119
+ if row ["Geographic Coverage " ]:
120
+ geographic_scope = row ["Geographic Coverage " ]
121
121
geographic_scope_obj , _ = GeographicScope .objects .get_or_create (
122
122
name = geographic_scope , used_in = "signals" , defaults = {"used_in" : "signals" }
123
123
)
124
- row ["Geographic Scope " ] = geographic_scope_obj .id
124
+ row ["Geographic Coverage " ] = geographic_scope_obj .id
125
125
126
126
127
127
def process_source (row ) -> None :
@@ -138,8 +138,8 @@ def process_available_geographies(row) -> None:
138
138
"""
139
139
Processes available geographies.
140
140
"""
141
- if row ["Available Geography " ]:
142
- geographies : str = row ["Available Geography " ].split ("," )
141
+ if row ["Geographic Levels " ]:
142
+ geographies : str = row ["Geographic Levels " ].split ("," )
143
143
delphi_aggregated_geographies : str = row ["Delphi-Aggregated Geography" ].split (
144
144
","
145
145
)
@@ -156,7 +156,7 @@ def process_available_geographies(row) -> None:
156
156
},
157
157
)
158
158
signal = Signal .objects .get (
159
- name = row ["Signal " ], source = row ["Source Subdivision" ]
159
+ name = row ["Indicator " ], source = row ["Source Subdivision" ]
160
160
)
161
161
signal_geography , _ = SignalGeography .objects .get_or_create (
162
162
geography = geography_instance , signal = signal
@@ -167,12 +167,12 @@ def process_available_geographies(row) -> None:
167
167
168
168
169
169
def process_base (row ) -> None :
170
- if row ["Signal BaseName" ]:
170
+ if row ["Indicator BaseName" ]:
171
171
source : SourceSubdivision = SourceSubdivision .objects .get (
172
172
name = row ["Source Subdivision" ]
173
173
)
174
174
base_signal : Signal = Signal .objects .get (
175
- name = row ["Signal BaseName" ], source = source
175
+ name = row ["Indicator BaseName" ], source = source
176
176
)
177
177
row ["base" ] = base_signal .id
178
178
@@ -213,7 +213,7 @@ class SignalBaseResource(ModelResource):
213
213
Resource class for importing Signals base.
214
214
"""
215
215
216
- name = Field (attribute = "name" , column_name = "Signal " )
216
+ name = Field (attribute = "name" , column_name = "Indicator " )
217
217
display_name = Field (attribute = "display_name" , column_name = "Name" )
218
218
base = Field (
219
219
attribute = "base" ,
@@ -241,9 +241,9 @@ class SignalResource(ModelResource):
241
241
Resource class for importing and exporting Signal models
242
242
"""
243
243
244
- name = Field (attribute = "name" , column_name = "Signal " )
244
+ name = Field (attribute = "name" , column_name = "Indicator " )
245
245
display_name = Field (attribute = "display_name" , column_name = "Name" )
246
- member_name = Field (attribute = "member_name" , column_name = "Member Name" )
246
+ member_name = Field (attribute = "member_name" , column_name = "Member API Name" )
247
247
member_short_name = Field (
248
248
attribute = "member_short_name" , column_name = "Member Short Name"
249
249
)
@@ -257,7 +257,7 @@ class SignalResource(ModelResource):
257
257
)
258
258
signal_type = Field (
259
259
attribute = "signal_type" ,
260
- column_name = "Signal Type" ,
260
+ column_name = "Indicator Type" ,
261
261
widget = widgets .ForeignKeyWidget (SignalType , field = "name" ),
262
262
)
263
263
active = Field (attribute = "active" , column_name = "Active" )
@@ -282,11 +282,11 @@ class SignalResource(ModelResource):
282
282
attribute = "typical_revision_cadence" , column_name = "Typical Revision Cadence"
283
283
)
284
284
demographic_scope = Field (
285
- attribute = "demographic_scope" , column_name = "Demographic Scope "
285
+ attribute = "demographic_scope" , column_name = "Population "
286
286
)
287
287
severity_pyramid_rung = Field (
288
288
attribute = "severity_pyramid_rung" ,
289
- column_name = "Severity Pyramid Rungs " ,
289
+ column_name = "Surveillance Categories " ,
290
290
widget = widgets .ForeignKeyWidget (SeverityPyramidRung ),
291
291
)
292
292
category = Field (
@@ -296,12 +296,12 @@ class SignalResource(ModelResource):
296
296
)
297
297
geographic_scope = Field (
298
298
attribute = "geographic_scope" ,
299
- column_name = "Geographic Scope " ,
299
+ column_name = "Geographic Coverage " ,
300
300
widget = widgets .ForeignKeyWidget (GeographicScope ),
301
301
)
302
302
available_geographies = Field (
303
- attribute = "available_geographies " ,
304
- column_name = "Available Geographies " ,
303
+ attribute = "available_geography " ,
304
+ column_name = "Geographic Levels " ,
305
305
widget = widgets .ManyToManyWidget (Geography , field = "name" , separator = "," ),
306
306
)
307
307
temporal_scope_start = Field (
@@ -330,17 +330,17 @@ class SignalResource(ModelResource):
330
330
data_censoring = Field (attribute = "data_censoring" , column_name = "Data Censoring" )
331
331
missingness = Field (attribute = "missingness" , column_name = "Missingness" )
332
332
organization_access_list = Field (
333
- attribute = "organization_access_list" , column_name = "Who may access this signal ?"
333
+ attribute = "organization_access_list" , column_name = "Who may access this indicator ?"
334
334
)
335
335
organization_sharing_list = Field (
336
336
attribute = "organization_sharing_list" ,
337
- column_name = "Who may be told about this signal ?" ,
337
+ column_name = "Who may be told about this indicator ?" ,
338
338
)
339
- license = Field (attribute = "license" , column_name = "License " )
339
+ license = Field (attribute = "license" , column_name = "Data Use Terms " )
340
340
restrictions = Field (attribute = "restrictions" , column_name = "Use Restrictions" )
341
341
signal_set = Field (
342
342
attribute = "signal_set" ,
343
- column_name = "Signal Set" ,
343
+ column_name = "Indicator Set" ,
344
344
widget = widgets .ForeignKeyWidget (SignalSet , field = "name" ),
345
345
)
346
346
@@ -401,16 +401,16 @@ def before_import_row(self, row, **kwargs) -> None:
401
401
process_geographic_scope (row )
402
402
process_source (row )
403
403
process_links (row , dua_column_name = "Link to DUA" , link_column_name = "Link" )
404
- if not row .get ("Signal Set" ):
405
- row ["Signal Set" ] = None
404
+ if not row .get ("Indicator Set" ):
405
+ row ["Indicator Set" ] = None
406
406
if not row .get ("Source Subdivision" ):
407
407
row ["Source Subdivision" ] = None
408
408
409
409
def skip_row (self , instance , original , row , import_validation_errors = None ):
410
- if not row ["Include in signal app" ]:
410
+ if not row ["Include in indicator app" ]:
411
411
try :
412
412
signal = Signal .objects .get (
413
- name = row ["Signal " ], source = row ["Source Subdivision" ]
413
+ name = row ["Indicator " ], source = row ["Source Subdivision" ]
414
414
)
415
415
signal .delete ()
416
416
except Signal .DoesNotExist :
@@ -423,7 +423,7 @@ def after_import_row(self, row, row_result, **kwargs):
423
423
for link in row ["Links" ]:
424
424
signal_obj .related_links .add (link )
425
425
process_available_geographies (row )
426
- signal_obj .severity_pyramid_rung = SeverityPyramidRung .objects .get (id = row ["Severity Pyramid Rungs " ])
426
+ signal_obj .severity_pyramid_rung = SeverityPyramidRung .objects .get (id = row ["Surveillance Categories " ])
427
427
signal_obj .format_type = row ["Format" ]
428
428
signal_obj .save ()
429
429
except Signal .DoesNotExist as e :
0 commit comments