Skip to content

Commit 4d78314

Browse files
committed
🛠️ src/fixtures/demographic_scopes.json -> Added created and modified fields for each scope
🟢 src/signals/migrations/0007_demographicscope_geographicscope_and_more.py 🔴 src/signals/models.py
1 parent 9d8e47b commit 4d78314

File tree

3 files changed

+128
-35
lines changed

3 files changed

+128
-35
lines changed

src/fixtures/demographic_scopes.json

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,45 @@
33
"model": "signals.DemographicScope",
44
"pk": 1,
55
"fields": {
6-
"name": "nationwide Change Healthcare network"
6+
"name": "nationwide Change Healthcare network",
7+
"created": "2022-01-01T00:00:00Z",
8+
"modified": "2022-01-01T00:00:00Z"
79
}
810
},
911
{
1012
"model": "signals.DemographicScope",
1113
"pk": 2,
1214
"fields": {
13-
"name": "nationwide Optum network"
15+
"name": "nationwide Optum network",
16+
"created": "2022-01-01T00:00:00Z",
17+
"modified": "2022-01-01T00:00:00Z"
1418
}
1519
},
1620
{
1721
"model": "signals.DemographicScope",
1822
"pk": 3,
1923
"fields": {
20-
"name": "Adult Facebook users"
24+
"name": "Adult Facebook users",
25+
"created": "2022-01-01T00:00:00Z",
26+
"modified": "2022-01-01T00:00:00Z"
2127
}
2228
},
2329
{
2430
"model": "signals.DemographicScope",
2531
"pk": 4,
2632
"fields": {
27-
"name": "Google search users"
33+
"name": "Google search users",
34+
"created": "2022-01-01T00:00:00Z",
35+
"modified": "2022-01-01T00:00:00Z"
2836
}
2937
},
3038
{
3139
"model": "signals.DemographicScope",
3240
"pk": 5,
3341
"fields": {
34-
"name": "Smartphone users"
42+
"name": "Smartphone users",
43+
"created": "2022-01-01T00:00:00Z",
44+
"modified": "2022-01-01T00:00:00Z"
3545
}
3646
}
3747
]
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Generated by Django 5.0.3 on 2024-04-26 07:37
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('signals', '0006_merge_20240219_1508'),
10+
]
11+
12+
operations = [
13+
migrations.CreateModel(
14+
name='DemographicScope',
15+
fields=[
16+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
17+
('created', models.DateTimeField(auto_now_add=True)),
18+
('modified', models.DateTimeField(auto_now=True)),
19+
('name', models.CharField(help_text='Name', max_length=128, unique=True)),
20+
],
21+
options={
22+
'abstract': False,
23+
},
24+
),
25+
migrations.CreateModel(
26+
name='GeographicScope',
27+
fields=[
28+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
29+
('created', models.DateTimeField(auto_now_add=True)),
30+
('modified', models.DateTimeField(auto_now=True)),
31+
('name', models.CharField(help_text='Name', max_length=128, unique=True)),
32+
],
33+
options={
34+
'abstract': False,
35+
},
36+
),
37+
migrations.AlterModelOptions(
38+
name='signaltype',
39+
options={},
40+
),
41+
migrations.AddField(
42+
model_name='signal',
43+
name='age_breakdown',
44+
field=models.CharField(choices=[('0-17', '0-17'), ('18-64', '18-64'), ('65+', '65+')], help_text='Age Breakdown', max_length=128, null=True),
45+
),
46+
migrations.AddField(
47+
model_name='signal',
48+
name='data_censoring',
49+
field=models.TextField(blank=True, help_text='Data Censoring', null=True),
50+
),
51+
migrations.AddField(
52+
model_name='signal',
53+
name='gender_breakdown',
54+
field=models.BooleanField(default=False, help_text='Gender Breakdown'),
55+
),
56+
migrations.AddField(
57+
model_name='signal',
58+
name='missingness',
59+
field=models.TextField(blank=True, help_text='Missingness', null=True),
60+
),
61+
migrations.AddField(
62+
model_name='signal',
63+
name='race_breakdown',
64+
field=models.BooleanField(default=False, help_text='Race Breakdown'),
65+
),
66+
migrations.AddField(
67+
model_name='signal',
68+
name='reporting_cadence',
69+
field=models.CharField(choices=[('daily', 'Daily'), ('weekly', 'Weekly')], help_text='Reporting Cadence', max_length=128, null=True),
70+
),
71+
migrations.AddField(
72+
model_name='signal',
73+
name='severenity_pyramid_rungs',
74+
field=models.CharField(choices=[('population', 'Population'), ('infected', 'Infected'), ('symptomatic', 'Symptomatic'), ('outpatient_visit', 'Outpatient visit'), ('ascertained', 'Ascertained (case)'), ('hospitalized', 'Hospitalized'), ('icu', 'ICU'), ('dead', 'Dead')], help_text='Severity Pyramid Rungs', max_length=128, null=True),
75+
),
76+
migrations.AddField(
77+
model_name='signal',
78+
name='demographic_scope',
79+
field=models.ManyToManyField(help_text='Demographic Scope', related_name='signals', to='signals.demographicscope'),
80+
),
81+
]

src/signals/models.py

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -208,26 +208,26 @@ def __str__(self) -> str:
208208
return str(self.name)
209209

210210

211-
class OrganisationsWithAccess(TimeStampedModel): # TODO: Requirements for this model are not clear. Need to be discussed.
212-
"""
213-
A model representing an access list.
214-
"""
215-
organisation_name: models.CharField = models.CharField(
216-
help_text=_('Organisation Name'),
217-
max_length=128,
218-
unique=True
219-
)
220-
221-
222-
class SharingOrganisation(TimeStampedModel): # TODO: Requirements for this model are not clear. Need to be discussed.
223-
"""
224-
A model representing a sharing organisation.
225-
"""
226-
organisation_name: models.CharField = models.CharField(
227-
help_text=_('Organisation Name'),
228-
max_length=128,
229-
unique=True
230-
)
211+
# class OrganisationsWithAccess(TimeStampedModel): # TODO: Requirements for this model are not clear. Need to be discussed.
212+
# """
213+
# A model representing an access list.
214+
# """
215+
# organisation_name: models.CharField = models.CharField(
216+
# help_text=_('Organisation Name'),
217+
# max_length=128,
218+
# unique=True
219+
# )
220+
221+
222+
# class SharingOrganisation(TimeStampedModel): # TODO: Requirements for this model are not clear. Need to be discussed.
223+
# """
224+
# A model representing a sharing organisation.
225+
# """
226+
# organisation_name: models.CharField = models.CharField(
227+
# help_text=_('Organisation Name'),
228+
# max_length=128,
229+
# unique=True
230+
# )
231231

232232

233233
class Signal(TimeStampedModel):
@@ -294,7 +294,8 @@ class Signal(TimeStampedModel):
294294
reporting_cadence: models.CharField = models.CharField(
295295
help_text=_('Reporting Cadence'),
296296
max_length=128,
297-
choices=ReportingCadence.choices
297+
choices=ReportingCadence.choices,
298+
null=True
298299
)
299300
demographic_scope: models.ManyToManyField = models.ManyToManyField(
300301
'signals.DemographicScope',
@@ -304,7 +305,8 @@ class Signal(TimeStampedModel):
304305
severenity_pyramid_rungs: models.CharField = models.CharField(
305306
help_text=_('Severity Pyramid Rungs'),
306307
max_length=128,
307-
choices=SeverityPyramidRungsChoices.choices
308+
choices=SeverityPyramidRungsChoices.choices,
309+
null=True
308310
)
309311
category: models.ForeignKey = models.ForeignKey(
310312
'signals.SignalCategory',
@@ -377,15 +379,15 @@ class Signal(TimeStampedModel):
377379
null=True,
378380
blank=True
379381
)
380-
organisations_access_list: models.ManyToManyField = models.ManyToManyField( # TODO: Requirements for this field are not clear. Need to be discussed.
381-
'signals.OrganisationsAccess',
382-
help_text=_('Organisations Access List')
383-
)
382+
# organisations_access_list: models.ManyToManyField = models.ManyToManyField( # TODO: Requirements for this field are not clear. Need to be discussed.
383+
# 'signals.OrganisationsAccess',
384+
# help_text=_('Organisations Access List')
385+
# )
384386

385-
organisations_sharing_list: models.ManyToManyField = models.ManyToManyField( # TODO: Requirements for this field are not clear. Need to be discussed.
386-
'signals.SharingOrganisation',
387-
help_text=_('Organisations Sharing List')
388-
)
387+
# organisations_sharing_list: models.ManyToManyField = models.ManyToManyField( # TODO: Requirements for this field are not clear. Need to be discussed.
388+
# 'signals.SharingOrganisation',
389+
# help_text=_('Organisations Sharing List')
390+
# )
389391

390392
last_updated: models.DateField = models.DateField(
391393
help_text=_('Last Updated'),

0 commit comments

Comments
 (0)