Skip to content

Commit 2b21821

Browse files
authored
Merge pull request #130 from cmu-delphi/development
Development
2 parents 04193a3 + b5d1d72 commit 2b21821

File tree

4 files changed

+61
-64
lines changed

4 files changed

+61
-64
lines changed

src/fixtures/available_geography.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"pk": 1,
55
"fields": {
66
"name": "county",
7-
"display_name": "ADM2 (e.g. U.S. counties)",
7+
"display_name": "County/ADM 2",
88
"display_order_number": 3,
99
"used_in": "signals",
1010
"created": "2023-08-09T19:23:22.597131",
@@ -28,7 +28,7 @@
2828
"pk": 3,
2929
"fields": {
3030
"name": "hrr",
31-
"display_name": "Hospital Referral Regions (HRRs)",
31+
"display_name": "Hospital Referral Region (HRR)",
3232
"display_order_number": 6,
3333
"used_in": "signals",
3434
"created": "2023-08-09T19:23:22.597131",
@@ -40,7 +40,7 @@
4040
"pk": 4,
4141
"fields": {
4242
"name": "msa",
43-
"display_name": "Metropolitan Statistical Areas (MSAs)",
43+
"display_name": "Metropolitan Statistical Area (MSA)",
4444
"display_order_number": 5,
4545
"used_in": "signals",
4646
"created": "2023-08-09T19:23:22.597131",
@@ -64,7 +64,7 @@
6464
"pk": 6,
6565
"fields": {
6666
"name": "state",
67-
"display_name": "ADM1 (e.g. U.S. states)",
67+
"display_name": "State/ADM 1",
6868
"display_order_number": 2,
6969
"used_in": "signals",
7070
"created": "2023-08-09T19:23:22.597131",

src/signal_sets/resources.py

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ def process_geographic_scope(row) -> None:
2626
"""
2727
Processes geographic scope.
2828
"""
29-
if row["Geo Scope with index"]:
30-
geographic_scope = row["Geo Scope with index"]
29+
if row["Geographic Coverage"]:
30+
geographic_scope = row["Geographic Coverage"]
3131
geographic_scope_obj, _ = GeographicScope.objects.get_or_create(
3232
name=geographic_scope, used_in="signal_sets"
3333
)
34-
row["Geo Scope with index"] = geographic_scope_obj.id
34+
row["Geographic Coverage"] = geographic_scope_obj.id
3535

3636

3737
def process_severity_pyramid_rungs(row) -> None:
3838
"""
3939
Processes pathogen.
4040
"""
41-
if row["Severity Pyramid Rung(s)"]:
42-
severity_pyramid_rungs = row["Severity Pyramid Rung(s)"].split(",")
41+
if row["Surveillance Categories"]:
42+
severity_pyramid_rungs = row["Surveillance Categories"].split(",")
4343
for severity_pyramid_rung in severity_pyramid_rungs:
4444
severity_pyramid_rung = severity_pyramid_rung.strip()
4545
severity_pyramid_rung_obj, _ = SeverityPyramidRung.objects.get_or_create(
@@ -65,18 +65,18 @@ def process_datasources(row) -> None:
6565
"""
6666
Processes data source.
6767
"""
68-
if row["Data Source"]:
69-
data_source = row["Data Source"]
68+
if row["Original Data Provider"]:
69+
data_source = row["Original Data Provider"]
7070
data_source_obj, _ = DataSource.objects.get_or_create(name=data_source)
71-
row["Data Source"] = data_source_obj
71+
row["Original Data Provider"] = data_source_obj
7272

7373

7474
def fix_boolean_fields(row) -> Any:
7575
"""
7676
Fixes boolean fields.
7777
"""
7878
fields = [
79-
"Include in signal app",
79+
"Include in indicator app",
8080
]
8181
for k in fields:
8282
if row[k] == "TRUE":
@@ -88,9 +88,9 @@ def fix_boolean_fields(row) -> Any:
8888

8989
class SignalSetResource(resources.ModelResource):
9090

91-
name = Field(attribute="name", column_name="Signal Set name* ")
92-
short_name = Field(attribute="short_name", column_name="Signal Set Short Name")
93-
description = Field(attribute="description", column_name="Signal Set Description*")
91+
name = Field(attribute="name", column_name="Indicator Set name* ")
92+
short_name = Field(attribute="short_name", column_name="Indicator Set Short Name")
93+
description = Field(attribute="description", column_name="Indicator Set Description*")
9494
maintainer_name = Field(
9595
attribute="maintainer_name", column_name="Maintainer/\nKey Contact *"
9696
)
@@ -100,7 +100,7 @@ class SignalSetResource(resources.ModelResource):
100100
organization = Field(attribute="organization", column_name="Organization")
101101
data_source = Field(
102102
attribute="data_source",
103-
column_name="Data Source",
103+
column_name="Original Data Provider",
104104
widget=widgets.ForeignKeyWidget(DataSource, field="name"),
105105
)
106106
endpoint = Field(attribute="endpoint", column_name="Endpoint")
@@ -115,12 +115,12 @@ class SignalSetResource(resources.ModelResource):
115115
data_type = Field(attribute="data_type", column_name="Type(s) of Data*")
116116
geographic_scope = Field(
117117
attribute="geographic_scope",
118-
column_name="Geo Scope with index",
118+
column_name="Geographic Coverage",
119119
widget=widgets.ForeignKeyWidget(GeographicScope),
120120
)
121121
geographic_granularity = Field(
122122
attribute="geographic_granularity",
123-
column_name="Geographic Granularity*",
123+
column_name="Geographic Levels",
124124
)
125125
preprocessing_description = Field(
126126
attribute="preprocessing_description",
@@ -142,21 +142,18 @@ class SignalSetResource(resources.ModelResource):
142142
attribute="reporting_lag", column_name="Reporting Lag (nominal)"
143143
)
144144
demographic_scope = Field(
145-
attribute="demographic_scope", column_name="Demographic Scope"
145+
attribute="demographic_scope", column_name="Population"
146146
)
147147
revision_cadence = Field(
148148
attribute="revision_cadence", column_name="Revision Cadence"
149149
)
150-
demographic_scope = Field(
151-
attribute="demographic_scope", column_name="Demographic Scope*"
152-
)
153150
demographic_granularity = Field(
154-
attribute="demographic_granularity", column_name="Demographic Granularity*"
151+
attribute="demographic_granularity", column_name="Population Stratifiers"
155152
)
156153
censoring = Field(attribute="censoring", column_name="Censoring")
157154
missingness = Field(attribute="missingness", column_name="Missingness")
158155
dua_required = Field(attribute="dua_required", column_name="DUA required?")
159-
license = Field(attribute="license", column_name="License ")
156+
license = Field(attribute="license", column_name="Data Use Terms")
160157
dataset_location = Field(
161158
attribute="dataset_location", column_name="Dataset Location"
162159
)
@@ -218,7 +215,7 @@ def save_instance(self, instance, is_create, row, **kwargs):
218215
pass
219216

220217
def skip_row(self, instance, original, row, import_validation_errors=None):
221-
if not row["Include in signal app"]:
218+
if not row["Include in indicator app"]:
222219
return True
223220

224221
def after_import_row(self, row, row_result, **kwargs):
@@ -227,7 +224,7 @@ def after_import_row(self, row, row_result, **kwargs):
227224
for pathogen in row["Pathogen(s)/Syndrome(s)"].split(","):
228225
pathogen = Pathogen.objects.get(name=pathogen, used_in="signal_sets")
229226
signal_set_obj.pathogens.add(pathogen)
230-
for severity_pyramid_rung in row["Severity Pyramid Rung(s)"].split(","):
227+
for severity_pyramid_rung in row["Surveillance Categories"].split(","):
231228
severity_pyramid_rung = SeverityPyramidRung.objects.filter(
232229
name=severity_pyramid_rung,
233230
used_in="signal_sets"

src/signals/resources.py

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -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

6969
def 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

105105
def 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

127127
def 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

169169
def 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:

src/templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
data-mdb-placement="right"
8484
data-mdb-content="Discover, display and download real-time infectious disease indicators (time series) that track a variety of pathogens, diseases and syndromes in a variety of locations (primarily within the USA).
8585
Browse the list, or filter it first by locations and pathogens of interest, by surveillance categories, and more.
86-
Expand any row to expose and select from a set of related indicators, then hit ""Show Selected Indicators"" at bottom to plot or export your selected indicators, or to generate code snippets to retrieve them from the Delphi Epidata API.
86+
Expand any row to expose and select from a set of related indicators, then hit 'Show Selected Indicators' at bottom to plot or export your selected indicators, or to generate code snippets to retrieve them from the Delphi Epidata API.
8787
Most indicators are served from the Delphi Epidata real-time repository, but some may be available only from third parties or may require prior approval."
8888
>
8989
<i class="far fa-circle-question"></i>

0 commit comments

Comments
 (0)