diff --git a/tracex_project/extraction/logic/modules/module_cohort_tagger.py b/tracex_project/extraction/logic/modules/module_cohort_tagger.py index 99dac8d3..d461782a 100644 --- a/tracex_project/extraction/logic/modules/module_cohort_tagger.py +++ b/tracex_project/extraction/logic/modules/module_cohort_tagger.py @@ -68,7 +68,7 @@ def __remove_placeholder(cohort_data) -> Optional[Dict[str, str]]: return cohort_dict @staticmethod - def normalize_coniditons_snomed(cohort_dict): + def normalize_coniditons_snomed(cohort_dict) -> Optional[Dict[str, str]]: """Normalizes conditions to a SNOMED code.""" condition = cohort_dict.get("condition") preexisting_condition = cohort_dict.get("preexisting_condition") diff --git a/tracex_project/extraction/logic/orchestrator.py b/tracex_project/extraction/logic/orchestrator.py index 14036d8b..fd59ed6a 100644 --- a/tracex_project/extraction/logic/orchestrator.py +++ b/tracex_project/extraction/logic/orchestrator.py @@ -266,17 +266,6 @@ def set_default_values(self) -> None: data["activity_relevance"] = None data["timestamp_correctness"] = None data["correctness_confidence"] = None - if "cohort_tagging" not in config_modules: - cohort_default_values = { - "age": None, - "gender": None, - "origin": None, - "condition": None, - "condition_snomed_code": None, - "preexisting_condition": None, - "preexisting_condition_snomed_code": None, - } - self.set_cohort(cohort_default_values) def update_progress(self, view, execution_step: int, module_name: str) -> None: """Update the progress of the extraction.""" diff --git a/tracex_project/extraction/migrations/0022_remove_cohort_gender_add_snomed_trace_cohort.py b/tracex_project/extraction/migrations/0022_remove_cohort_gender_add_snomed_trace_cohort.py new file mode 100644 index 00000000..50ed8aab --- /dev/null +++ b/tracex_project/extraction/migrations/0022_remove_cohort_gender_add_snomed_trace_cohort.py @@ -0,0 +1,53 @@ +# Generated by Django 4.2.13 on 2024-05-26 09:35 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('extraction', '0021_alter_event_event_type_alter_event_location_and_more'), + ] + + operations = [ + migrations.RemoveField( + model_name='trace', + name='cohort', + ), + migrations.AddField( + model_name='cohort', + name='condition_snomed_code', + field=models.IntegerField(blank=True, null=True), + ), + migrations.AddField( + model_name='cohort', + name='preexisting_condition_snomed_code', + field=models.IntegerField(blank=True, null=True), + ), + migrations.AddField( + model_name='cohort', + name='trace', + field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='cohort', to='extraction.trace'), + ), + migrations.AlterField( + model_name='cohort', + name='age', + field=models.IntegerField(blank=True, null=True), + ), + migrations.AlterField( + model_name='cohort', + name='condition', + field=models.CharField(blank=True, max_length=50, null=True), + ), + migrations.AlterField( + model_name='cohort', + name='origin', + field=models.CharField(blank=True, max_length=50, null=True), + ), + migrations.AlterField( + model_name='cohort', + name='preexisting_condition', + field=models.CharField(blank=True, max_length=100, null=True), + ), + ] diff --git a/tracex_project/extraction/migrations/0023_remove_cohort_gender_cohort_sex.py b/tracex_project/extraction/migrations/0023_remove_cohort_gender_cohort_sex.py new file mode 100644 index 00000000..77b10097 --- /dev/null +++ b/tracex_project/extraction/migrations/0023_remove_cohort_gender_cohort_sex.py @@ -0,0 +1,22 @@ +# Generated by Django 4.2.13 on 2024-05-26 09:41 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('extraction', '0022_remove_cohort_gender_add_snomed_trace_cohort'), + ] + + operations = [ + migrations.RemoveField( + model_name='cohort', + name='gender', + ), + migrations.AddField( + model_name='cohort', + name='sex', + field=models.CharField(blank=True, max_length=25, null=True), + ), + ] diff --git a/tracex_project/extraction/migrations/0024_cohort_condition_snomed_code_and_more.py b/tracex_project/extraction/migrations/0024_cohort_condition_snomed_code_and_more.py deleted file mode 100644 index 307c2473..00000000 --- a/tracex_project/extraction/migrations/0024_cohort_condition_snomed_code_and_more.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 4.2.11 on 2024-05-16 11:03 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ("extraction", "0023_alter_cohort_age_alter_cohort_condition_and_more"), - ] - - operations = [ - migrations.AddField( - model_name="cohort", - name="condition_snomed_code", - field=models.IntegerField(blank=True, null=True), - ), - migrations.AddField( - model_name="cohort", - name="preexisting_condition_snomed_code", - field=models.IntegerField(blank=True, null=True), - ), - ]