Skip to content

Development #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,7 @@ cython_debug/

# PyPI configuration file
.pypirc


# Django collected staticfiles
src/staticfiles/
6 changes: 6 additions & 0 deletions src/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
("indicatorsets", "Indicator Sets"),
)

SOURCE_TYPES = [
("covidcast", "Covidcast"),
("other_endpoint", "Other Endpoint"),
("non_delphi", "Non Delphi"),
]


class Pathogen(models.Model):

Expand Down
7 changes: 1 addition & 6 deletions src/indicators/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@

from django.db import models


SOURCE_TYPES = [
("covidcast", "Covidcast"),
("other_endpoint", "Other Endpoint"),
("non_delphi", "Non Delphi"),
]
from base.models import SOURCE_TYPES


# Create your models here.
Expand Down
3 changes: 2 additions & 1 deletion src/indicatorsets/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class NonDelphiIndicatorSetAdmin(ImportExportModelAdmin):
"version_number",
"original_data_provider",
"origin_datasource",
"source_type",
)
search_fields = ("name", "short_name", "description")
ordering = ["name"]
list_filter = ["original_data_provider"]
list_filter = ["original_data_provider", "source_type"]
18 changes: 18 additions & 0 deletions src/indicatorsets/migrations/0003_indicatorset_source_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0.7 on 2025-05-07 17:18

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('indicatorsets', '0002_nondelphiindicatorset'),
]

operations = [
migrations.AddField(
model_name='indicatorset',
name='source_type',
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'),
),
]
11 changes: 11 additions & 0 deletions src/indicatorsets/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.db import models
from base.models import SOURCE_TYPES


DUA_REQUIRED_CHOICES = (
Expand Down Expand Up @@ -184,6 +185,16 @@ class IndicatorSet(models.Model):
help_text="Link to the documentation for the Indicator Set",
)

source_type: models.CharField = models.CharField(
verbose_name="Source Type",
max_length=255,
choices=SOURCE_TYPES,
default="covidcast",
help_text="Type of source for the indicator",
blank=True,
null=True,
)

class Meta:
verbose_name = "Indicator Set"
verbose_name_plural = "Indicator Sets"
Expand Down
8 changes: 8 additions & 0 deletions src/indicatorsets/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ def before_import_row(self, row, **kwargs):
process_pathogens(row)
process_available_geographies(row)

def after_save_instance(self, instance, row, **kwargs):
instance.source_type = "covidcast" if instance.epidata_endpoint == "covidcast" else "other_endpoint"
instance.save()


class NonDelphiIndicatorSetResource(resources.ModelResource):
name = Field(attribute="name", column_name="Indicator Set name* ")
Expand Down Expand Up @@ -360,3 +364,7 @@ def before_import_row(self, row, **kwargs):
process_severity_pyramid_rungs(row)
process_pathogens(row)
process_available_geographies(row)

def after_save_instance(self, instance, row, **kwargs):
instance.source_type = "non_delphi"
instance.save()
275 changes: 0 additions & 275 deletions src/staticfiles/admin/css/autocomplete.css

This file was deleted.

Loading
Loading