Skip to content

Commit 5e1ac15

Browse files
authored
Merge pull request #14 from cmu-delphi/staging
Staging
2 parents c27d860 + 1e95441 commit 5e1ac15

File tree

199 files changed

+58
-42464
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+58
-42464
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,7 @@ cython_debug/
172172

173173
# PyPI configuration file
174174
.pypirc
175+
176+
177+
# Django collected staticfiles
178+
src/staticfiles/

src/base/models.py

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
("indicatorsets", "Indicator Sets"),
66
)
77

8+
SOURCE_TYPES = [
9+
("covidcast", "Covidcast"),
10+
("other_endpoint", "Other Endpoint"),
11+
("non_delphi", "Non Delphi"),
12+
]
13+
814

915
class Pathogen(models.Model):
1016

src/indicators/models.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33

44
from django.db import models
55

6-
7-
SOURCE_TYPES = [
8-
("covidcast", "Covidcast"),
9-
("other_endpoint", "Other Endpoint"),
10-
("non_delphi", "Non Delphi"),
11-
]
6+
from base.models import SOURCE_TYPES
127

138

149
# Create your models here.

src/indicatorsets/admin.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ class NonDelphiIndicatorSetAdmin(ImportExportModelAdmin):
5050
"version_number",
5151
"original_data_provider",
5252
"origin_datasource",
53+
"source_type",
5354
)
5455
search_fields = ("name", "short_name", "description")
5556
ordering = ["name"]
56-
list_filter = ["original_data_provider"]
57+
list_filter = ["original_data_provider", "source_type"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 5.0.7 on 2025-05-07 17:18
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('indicatorsets', '0002_nondelphiindicatorset'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='indicatorset',
15+
name='source_type',
16+
field=models.CharField(blank=True, choices=[('covidcast', 'Covidcast'), ('other_endpoint', 'Other Endpoint'), ('non_delphi', 'Non Delphi')], default='covidcast', help_text='Type of source for the indicator', max_length=255, null=True, verbose_name='Source Type'),
17+
),
18+
]

src/indicatorsets/models.py

+11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from django.db import models
2+
from base.models import SOURCE_TYPES
23

34

45
DUA_REQUIRED_CHOICES = (
@@ -184,6 +185,16 @@ class IndicatorSet(models.Model):
184185
help_text="Link to the documentation for the Indicator Set",
185186
)
186187

188+
source_type: models.CharField = models.CharField(
189+
verbose_name="Source Type",
190+
max_length=255,
191+
choices=SOURCE_TYPES,
192+
default="covidcast",
193+
help_text="Type of source for the indicator",
194+
blank=True,
195+
null=True,
196+
)
197+
187198
class Meta:
188199
verbose_name = "Indicator Set"
189200
verbose_name_plural = "Indicator Sets"

src/indicatorsets/resources.py

+8
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ def before_import_row(self, row, **kwargs):
225225
process_pathogens(row)
226226
process_available_geographies(row)
227227

228+
def after_save_instance(self, instance, row, **kwargs):
229+
instance.source_type = "covidcast" if instance.epidata_endpoint == "covidcast" else "other_endpoint"
230+
instance.save()
231+
228232

229233
class NonDelphiIndicatorSetResource(resources.ModelResource):
230234
name = Field(attribute="name", column_name="Indicator Set name* ")
@@ -360,3 +364,7 @@ def before_import_row(self, row, **kwargs):
360364
process_severity_pyramid_rungs(row)
361365
process_pathogens(row)
362366
process_available_geographies(row)
367+
368+
def after_save_instance(self, instance, row, **kwargs):
369+
instance.source_type = "non_delphi"
370+
instance.save()

src/staticfiles/admin/css/autocomplete.css

-275
This file was deleted.

0 commit comments

Comments
 (0)