@@ -33,7 +33,7 @@ def fix_boolean_fields(row) -> Any:
3333 "Is Cumulative" ,
3434 "Has StdErr" ,
3535 "Has Sample Size" ,
36- "Include in signal app" ,
36+ "Include in indicator app" ,
3737 ]
3838 for k in fields :
3939 if row [k ] == "TRUE" :
@@ -60,18 +60,18 @@ def process_signal_type(row) -> None:
6060 """
6161 Processes signal type.
6262 """
63- if row ["Signal Type" ]:
64- signal_type = row ["Signal Type" ]
63+ if row ["Indicator Type" ]:
64+ signal_type = row ["Indicator Type" ]
6565 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
6767
6868
6969def process_format_type (row ) -> None :
7070 """
7171 Processes format type.
7272 """
7373 if row ["Format" ]:
74- format_type = row ["Format" ]
74+ format_type = row ["Format" ]. strip ()
7575 format_type_obj , _ = FormatType .objects .get_or_create (name = format_type )
7676 row ["Format" ] = format_type_obj
7777 else :
@@ -82,24 +82,24 @@ def process_severity_pyramid_rungs(row) -> None:
8282 """
8383 Processes severity pyramid rungs.
8484 """
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 ()
8787 if severity_pyramid_rung .startswith ("None" ):
88- row ["Severity Pyramid Rungs " ] = None
88+ row ["Surveillance Categories " ] = None
8989 else :
9090 severity_pyramid_rung_obj , _ = SeverityPyramidRung .objects .get_or_create (
9191 name = severity_pyramid_rung ,
9292 used_in = "signals" ,
9393 defaults = {"used_in" : "signals" , "display_name" : severity_pyramid_rung },
9494 )
95- row ["Severity Pyramid Rungs " ] = severity_pyramid_rung_obj .id
95+ row ["Surveillance Categories " ] = severity_pyramid_rung_obj .id
9696 else :
9797 none_severity_pyramid_rung_obj , _ = SeverityPyramidRung .objects .get_or_create (
9898 name = "N/A" ,
9999 used_in = "signals" ,
100100 defaults = {"used_in" : "signals" , "display_name" : "N/A" },
101101 )
102- row ["Severity Pyramid Rungs " ] = none_severity_pyramid_rung_obj .id
102+ row ["Surveillance Categories " ] = none_severity_pyramid_rung_obj .id
103103
104104
105105def process_category (row ) -> None :
@@ -116,12 +116,12 @@ def process_geographic_scope(row) -> None:
116116 """
117117 Processes geographic scope.
118118 """
119- if row ["Geographic Scope " ]:
120- geographic_scope = row ["Geographic Scope " ]
119+ if row ["Geographic Coverage " ]:
120+ geographic_scope = row ["Geographic Coverage " ]
121121 geographic_scope_obj , _ = GeographicScope .objects .get_or_create (
122122 name = geographic_scope , used_in = "signals" , defaults = {"used_in" : "signals" }
123123 )
124- row ["Geographic Scope " ] = geographic_scope_obj .id
124+ row ["Geographic Coverage " ] = geographic_scope_obj .id
125125
126126
127127def process_source (row ) -> None :
@@ -138,8 +138,8 @@ def process_available_geographies(row) -> None:
138138 """
139139 Processes available geographies.
140140 """
141- if row ["Available Geography " ]:
142- geographies : str = row ["Available Geography " ].split ("," )
141+ if row ["Geographic Levels " ]:
142+ geographies : str = row ["Geographic Levels " ].split ("," )
143143 delphi_aggregated_geographies : str = row ["Delphi-Aggregated Geography" ].split (
144144 ","
145145 )
@@ -156,7 +156,7 @@ def process_available_geographies(row) -> None:
156156 },
157157 )
158158 signal = Signal .objects .get (
159- name = row ["Signal " ], source = row ["Source Subdivision" ]
159+ name = row ["Indicator " ], source = row ["Source Subdivision" ]
160160 )
161161 signal_geography , _ = SignalGeography .objects .get_or_create (
162162 geography = geography_instance , signal = signal
@@ -167,12 +167,12 @@ def process_available_geographies(row) -> None:
167167
168168
169169def process_base (row ) -> None :
170- if row ["Signal BaseName" ]:
170+ if row ["Indicator BaseName" ]:
171171 source : SourceSubdivision = SourceSubdivision .objects .get (
172172 name = row ["Source Subdivision" ]
173173 )
174174 base_signal : Signal = Signal .objects .get (
175- name = row ["Signal BaseName" ], source = source
175+ name = row ["Indicator BaseName" ], source = source
176176 )
177177 row ["base" ] = base_signal .id
178178
@@ -213,7 +213,7 @@ class SignalBaseResource(ModelResource):
213213 Resource class for importing Signals base.
214214 """
215215
216- name = Field (attribute = "name" , column_name = "Signal " )
216+ name = Field (attribute = "name" , column_name = "Indicator " )
217217 display_name = Field (attribute = "display_name" , column_name = "Name" )
218218 base = Field (
219219 attribute = "base" ,
@@ -241,9 +241,9 @@ class SignalResource(ModelResource):
241241 Resource class for importing and exporting Signal models
242242 """
243243
244- name = Field (attribute = "name" , column_name = "Signal " )
244+ name = Field (attribute = "name" , column_name = "Indicator " )
245245 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" )
247247 member_short_name = Field (
248248 attribute = "member_short_name" , column_name = "Member Short Name"
249249 )
@@ -257,7 +257,7 @@ class SignalResource(ModelResource):
257257 )
258258 signal_type = Field (
259259 attribute = "signal_type" ,
260- column_name = "Signal Type" ,
260+ column_name = "Indicator Type" ,
261261 widget = widgets .ForeignKeyWidget (SignalType , field = "name" ),
262262 )
263263 active = Field (attribute = "active" , column_name = "Active" )
@@ -282,11 +282,11 @@ class SignalResource(ModelResource):
282282 attribute = "typical_revision_cadence" , column_name = "Typical Revision Cadence"
283283 )
284284 demographic_scope = Field (
285- attribute = "demographic_scope" , column_name = "Demographic Scope "
285+ attribute = "demographic_scope" , column_name = "Population "
286286 )
287287 severity_pyramid_rung = Field (
288288 attribute = "severity_pyramid_rung" ,
289- column_name = "Severity Pyramid Rungs " ,
289+ column_name = "Surveillance Categories " ,
290290 widget = widgets .ForeignKeyWidget (SeverityPyramidRung ),
291291 )
292292 category = Field (
@@ -296,12 +296,12 @@ class SignalResource(ModelResource):
296296 )
297297 geographic_scope = Field (
298298 attribute = "geographic_scope" ,
299- column_name = "Geographic Scope " ,
299+ column_name = "Geographic Coverage " ,
300300 widget = widgets .ForeignKeyWidget (GeographicScope ),
301301 )
302302 available_geographies = Field (
303- attribute = "available_geographies " ,
304- column_name = "Available Geographies " ,
303+ attribute = "available_geography " ,
304+ column_name = "Geographic Levels " ,
305305 widget = widgets .ManyToManyWidget (Geography , field = "name" , separator = "," ),
306306 )
307307 temporal_scope_start = Field (
@@ -330,17 +330,17 @@ class SignalResource(ModelResource):
330330 data_censoring = Field (attribute = "data_censoring" , column_name = "Data Censoring" )
331331 missingness = Field (attribute = "missingness" , column_name = "Missingness" )
332332 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 ?"
334334 )
335335 organization_sharing_list = Field (
336336 attribute = "organization_sharing_list" ,
337- column_name = "Who may be told about this signal ?" ,
337+ column_name = "Who may be told about this indicator ?" ,
338338 )
339- license = Field (attribute = "license" , column_name = "License " )
339+ license = Field (attribute = "license" , column_name = "Data Use Terms " )
340340 restrictions = Field (attribute = "restrictions" , column_name = "Use Restrictions" )
341341 signal_set = Field (
342342 attribute = "signal_set" ,
343- column_name = "Signal Set" ,
343+ column_name = "Indicator Set" ,
344344 widget = widgets .ForeignKeyWidget (SignalSet , field = "name" ),
345345 )
346346
@@ -401,16 +401,16 @@ def before_import_row(self, row, **kwargs) -> None:
401401 process_geographic_scope (row )
402402 process_source (row )
403403 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
406406 if not row .get ("Source Subdivision" ):
407407 row ["Source Subdivision" ] = None
408408
409409 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" ]:
411411 try :
412412 signal = Signal .objects .get (
413- name = row ["Signal " ], source = row ["Source Subdivision" ]
413+ name = row ["Indicator " ], source = row ["Source Subdivision" ]
414414 )
415415 signal .delete ()
416416 except Signal .DoesNotExist :
@@ -423,7 +423,7 @@ def after_import_row(self, row, row_result, **kwargs):
423423 for link in row ["Links" ]:
424424 signal_obj .related_links .add (link )
425425 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 " ])
427427 signal_obj .format_type = row ["Format" ]
428428 signal_obj .save ()
429429 except Signal .DoesNotExist as e :
0 commit comments