Skip to content

Commit

Permalink
Merge pull request #261 from CanDIG/sonchau/model_3_1
Browse files Browse the repository at this point in the history
DIG-1782: Add <field>_not_available for all numeric fields
  • Loading branch information
mshadbolt authored Sep 15, 2024
2 parents 2bedb63 + 321ba56 commit 3349786
Show file tree
Hide file tree
Showing 9 changed files with 592 additions and 18 deletions.
210 changes: 210 additions & 0 deletions chord_metadata_service/mohpackets/docs/schema.json

Large diffs are not rendered by default.

184 changes: 176 additions & 8 deletions chord_metadata_service/mohpackets/docs/schema.md

Large diffs are not rendered by default.

168 changes: 168 additions & 0 deletions chord_metadata_service/mohpackets/docs/schema.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion chord_metadata_service/mohpackets/docs/schema_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4b47c8b9c4ddbb0ac6c97c3f11b2bba675d5abe7
0416ebdcca7b12b2ed2c9ef3107aad08db10e6aa
16 changes: 15 additions & 1 deletion chord_metadata_service/mohpackets/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.6 on 2024-09-06 17:05
# Generated by Django 5.0.6 on 2024-09-15 19:36

import chord_metadata_service.mohpackets.models
import django.contrib.postgres.fields
Expand Down Expand Up @@ -85,6 +85,7 @@ class Migration(migrations.Migration):
('tobacco_smoking_status', models.CharField(blank=True, max_length=255, null=True)),
('tobacco_type', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, max_length=128, null=True), blank=True, null=True, size=None)),
('pack_years_smoked', models.FloatField(blank=True, null=True)),
('pack_years_smoked_not_available', models.BooleanField(default=False)),
('donor_uuid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mohpackets.donor')),
('program_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mohpackets.program')),
],
Expand All @@ -105,6 +106,7 @@ class Migration(migrations.Migration):
('prior_malignancy', models.CharField(blank=True, max_length=32, null=True)),
('laterality_of_prior_malignancy', models.CharField(blank=True, max_length=64, null=True)),
('age_at_comorbidity_diagnosis', models.IntegerField(blank=True, null=True)),
('age_at_comorbidity_diagnosis_not_available', models.BooleanField(default=False)),
('comorbidity_type_code', models.CharField(blank=True, max_length=64, null=True)),
('comorbidity_treatment_status', models.CharField(blank=True, max_length=32, null=True)),
('comorbidity_treatment', models.CharField(blank=True, max_length=255, null=True)),
Expand All @@ -126,8 +128,11 @@ class Migration(migrations.Migration):
('submitter_follow_up_id', models.CharField(blank=True, max_length=64, null=True)),
('test_date', models.JSONField(blank=True, null=True)),
('psa_level', models.IntegerField(blank=True, null=True)),
('psa_level_not_available', models.BooleanField(default=False)),
('ca125', models.IntegerField(blank=True, null=True)),
('ca125_not_available', models.BooleanField(default=False)),
('cea', models.IntegerField(blank=True, null=True)),
('cea_not_available', models.BooleanField(default=False)),
('er_status', models.CharField(blank=True, max_length=64, null=True)),
('er_percent_positive', models.FloatField(blank=True, null=True)),
('pr_status', models.CharField(blank=True, max_length=64, null=True)),
Expand Down Expand Up @@ -205,15 +210,19 @@ class Migration(migrations.Migration):
('submitter_treatment_id', models.CharField(max_length=64)),
('systemic_therapy_type', models.CharField(blank=True, max_length=32, null=True)),
('days_per_cycle', models.IntegerField(blank=True, null=True)),
('days_per_cycle_not_available', models.BooleanField(default=False)),
('number_of_cycles', models.IntegerField(blank=True, null=True)),
('number_of_cycles_not_available', models.BooleanField(default=False)),
('start_date', models.JSONField(blank=True, null=True)),
('end_date', models.JSONField(blank=True, null=True)),
('drug_reference_database', models.CharField(blank=True, max_length=64, null=True)),
('drug_name', models.CharField(blank=True, max_length=255, null=True)),
('drug_reference_identifier', models.CharField(blank=True, max_length=64, null=True)),
('drug_dose_units', models.CharField(blank=True, max_length=64, null=True)),
('prescribed_cumulative_drug_dose', models.FloatField(blank=True, null=True)),
('prescribed_cumulative_drug_dose_not_available', models.BooleanField(default=False)),
('actual_cumulative_drug_dose', models.FloatField(blank=True, null=True)),
('actual_cumulative_drug_dose_not_available', models.BooleanField(default=False)),
('donor_uuid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mohpackets.donor')),
('program_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mohpackets.program')),
('treatment_uuid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mohpackets.treatment')),
Expand All @@ -232,8 +241,11 @@ class Migration(migrations.Migration):
('surgery_site', models.CharField(blank=True, max_length=255, null=True)),
('surgery_location', models.CharField(blank=True, max_length=128, null=True)),
('tumour_length', models.IntegerField(blank=True, null=True)),
('tumour_length_not_available', models.BooleanField(default=False)),
('tumour_width', models.IntegerField(blank=True, null=True)),
('tumour_width_not_available', models.BooleanField(default=False)),
('greatest_dimension_tumour', models.IntegerField(blank=True, null=True)),
('greatest_dimension_tumour_not_available', models.BooleanField(default=False)),
('tumour_focality', models.CharField(blank=True, max_length=64, null=True)),
('residual_tumour_classification', models.CharField(blank=True, max_length=64, null=True)),
('margin_types_involved', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, max_length=128, null=True), blank=True, null=True, size=None)),
Expand All @@ -260,7 +272,9 @@ class Migration(migrations.Migration):
('radiation_therapy_modality', models.CharField(blank=True, max_length=255, null=True)),
('radiation_therapy_type', models.CharField(blank=True, max_length=64, null=True)),
('radiation_therapy_fractions', models.IntegerField(blank=True, null=True)),
('radiation_therapy_fractions_not_available', models.BooleanField(default=False)),
('radiation_therapy_dosage', models.IntegerField(blank=True, null=True)),
('radiation_therapy_dosage_not_available', models.BooleanField(default=False)),
('anatomical_site_irradiated', models.CharField(blank=True, max_length=255, null=True)),
('radiation_boost', models.CharField(blank=True, max_length=32, null=True)),
('reference_radiation_treatment_id', models.CharField(blank=True, max_length=64, null=True)),
Expand Down
14 changes: 14 additions & 0 deletions chord_metadata_service/mohpackets/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,19 @@ class SystemicTherapy(models.Model):
submitter_treatment_id = models.CharField(max_length=64, null=False, blank=False)
systemic_therapy_type = models.CharField(max_length=32, null=True, blank=True)
days_per_cycle = models.IntegerField(null=True, blank=True)
days_per_cycle_not_available = models.BooleanField(default=False)
number_of_cycles = models.IntegerField(null=True, blank=True)
number_of_cycles_not_available = models.BooleanField(default=False)
start_date = models.JSONField(null=True, blank=True)
end_date = models.JSONField(null=True, blank=True)
drug_reference_database = models.CharField(max_length=64, null=True, blank=True)
drug_name = models.CharField(max_length=255, null=True, blank=True)
drug_reference_identifier = models.CharField(max_length=64, null=True, blank=True)
drug_dose_units = models.CharField(max_length=64, null=True, blank=True)
prescribed_cumulative_drug_dose = models.FloatField(blank=True, null=True)
prescribed_cumulative_drug_dose_not_available = models.BooleanField(default=False)
actual_cumulative_drug_dose = models.FloatField(blank=True, null=True)
actual_cumulative_drug_dose_not_available = models.BooleanField(default=False)

class Meta:
ordering = ["uuid"]
Expand All @@ -260,7 +264,9 @@ class Radiation(models.Model):
radiation_therapy_modality = models.CharField(max_length=255, null=True, blank=True)
radiation_therapy_type = models.CharField(max_length=64, null=True, blank=True)
radiation_therapy_fractions = models.IntegerField(null=True, blank=True)
radiation_therapy_fractions_not_available = models.BooleanField(default=False)
radiation_therapy_dosage = models.IntegerField(null=True, blank=True)
radiation_therapy_dosage_not_available = models.BooleanField(default=False)
anatomical_site_irradiated = models.CharField(max_length=255, null=True, blank=True)
radiation_boost = models.CharField(max_length=32, blank=True, null=True)
reference_radiation_treatment_id = models.CharField(
Expand Down Expand Up @@ -291,8 +297,11 @@ class Surgery(models.Model):
surgery_site = models.CharField(max_length=255, null=True, blank=True)
surgery_location = models.CharField(max_length=128, null=True, blank=True)
tumour_length = models.IntegerField(null=True, blank=True)
tumour_length_not_available = models.BooleanField(default=False)
tumour_width = models.IntegerField(null=True, blank=True)
tumour_width_not_available = models.BooleanField(default=False)
greatest_dimension_tumour = models.IntegerField(null=True, blank=True)
greatest_dimension_tumour_not_available = models.BooleanField(default=False)
tumour_focality = models.CharField(max_length=64, null=True, blank=True)
residual_tumour_classification = models.CharField(
max_length=64, null=True, blank=True
Expand Down Expand Up @@ -384,8 +393,11 @@ class Biomarker(models.Model):
) # ref field, not true id
test_date = models.JSONField(null=True, blank=True)
psa_level = models.IntegerField(null=True, blank=True)
psa_level_not_available = models.BooleanField(default=False)
ca125 = models.IntegerField(null=True, blank=True)
ca125_not_available = models.BooleanField(default=False)
cea = models.IntegerField(null=True, blank=True)
cea_not_available = models.BooleanField(default=False)
er_status = models.CharField(max_length=64, null=True, blank=True)
er_percent_positive = models.FloatField(null=True, blank=True)
pr_status = models.CharField(max_length=64, null=True, blank=True)
Expand Down Expand Up @@ -419,6 +431,7 @@ class Comorbidity(models.Model):
max_length=64, null=True, blank=True
)
age_at_comorbidity_diagnosis = models.IntegerField(null=True, blank=True)
age_at_comorbidity_diagnosis_not_available = models.BooleanField(default=False)
comorbidity_type_code = models.CharField(max_length=64, null=True, blank=True)
comorbidity_treatment_status = models.CharField(
max_length=32, null=True, blank=True
Expand Down Expand Up @@ -446,6 +459,7 @@ class Exposure(models.Model):
models.CharField(max_length=128, null=True, blank=True), null=True, blank=True
)
pack_years_smoked = models.FloatField(null=True, blank=True)
pack_years_smoked_not_available = models.BooleanField(default=False)

class Meta:
ordering = ["uuid"]
Expand Down
10 changes: 5 additions & 5 deletions config/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@
"user_1": {
"is_admin": False,
"write_datasets": [],
"read_datasets": ["PROGRAM_01", "PROGRAM_02"],
"read_datasets": ["SYNTH_01", "SYNTH_02"],
},
"user_2": {
"is_admin": False,
"write_datasets": ["PROGRAM_03", "PROGRAM_04"],
"read_datasets": ["PROGRAM_03", "PROGRAM_04"],
"write_datasets": ["SYNTH_01"],
"read_datasets": ["SYNTH_01", "SYNTH_02"],
},
"site_admin": {
"is_admin": True,
"write_datasets": ["PROGRAM_01", "PROGRAM_02", "PROGRAM_03", "PROGRAM_04"],
"read_datasets": ["PROGRAM_01", "PROGRAM_02", "PROGRAM_03", "PROGRAM_04"],
"write_datasets": ["SYNTH_01", "SYNTH_02"],
"read_datasets": ["SYNTH_01", "SYNTH_02"],
},
}

Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django==5.1 # Python web framework
Django==5.1.1 # Python web framework
psycopg[binary]==3.2.1 # PostgreSQL driver for Python
django-cors-headers==4.4.0 # handling the server headers required for CORS
django-ninja==1.3.0 # API & schema
Expand Down
4 changes: 2 additions & 2 deletions requirements/local.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-r base.txt # inherit from base.txt
coverage==7.6.1 # measures code coverage
flake8==7.1.1 # style guide enforcement
tox==4.18.0 # test command line tool
tox==4.18.1 # test command line tool
django-debug-toolbar==4.4.6 # display debug information
factory-boy==3.3.0 # setup test cases
factory-boy==3.3.1 # setup test cases
tqdm==4.66.5 # progress bar for data loader script

0 comments on commit 3349786

Please sign in to comment.