Skip to content

Commit efe2932

Browse files
authored
Remove the process of unused columns (#1113)
1 parent 90ca668 commit efe2932

5 files changed

Lines changed: 39 additions & 32 deletions

File tree

app/airflow/dags/libs/SR_processing/db_services.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,6 @@ def create_field_entries(
5050
field_name = str(row[1].value) if row[1].value is not None else ""
5151
description = str(row[2].value) if row[2].value is not None else ""
5252
type_column = str(row[3].value) if row[3].value is not None else ""
53-
max_length = row[4].value
54-
nrows = row[5].value
55-
nrows_checked = row[6].value
56-
57-
# Calculate fractions with default values
58-
fraction_empty = round(default_zero(row[7].value), 2)
59-
nunique_values = row[8].value
60-
fraction_unique = round(default_zero(row[9].value), 2)
6153

6254
pg_hook.run(
6355
create_fields_query,
@@ -67,12 +59,6 @@ def create_field_entries(
6759
"name": field_name, # NOTE: without BOM removal to keep the consistency with Azure functions
6860
"description_column": description,
6961
"type_column": type_column,
70-
"max_length": max_length,
71-
"nrows": nrows,
72-
"nrows_checked": nrows_checked,
73-
"fraction_empty": fraction_empty,
74-
"nunique_values": nunique_values,
75-
"fraction_unique": fraction_unique,
7662
},
7763
)
7864

app/airflow/dags/libs/queries.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -525,16 +525,12 @@
525525

526526
create_fields_query = """
527527
INSERT INTO mapping_scanreportfield (
528-
scan_report_table_id, name, description_column, type_column,
529-
max_length, nrows, nrows_checked, fraction_empty,
530-
nunique_values, fraction_unique, created_at, updated_at,
528+
scan_report_table_id, name, description_column, type_column, created_at, updated_at,
531529
is_patient_id, is_ignore, pass_from_source
532530
)
533531
VALUES (
534532
%(scan_report_table_id)s, %(name)s, %(description_column)s, %(type_column)s,
535-
%(max_length)s, %(nrows)s, %(nrows_checked)s, %(fraction_empty)s,
536-
%(nunique_values)s, %(fraction_unique)s, NOW(), NOW(), False, False,
537-
True
533+
NOW(), NOW(), False, False, True
538534
)
539535
"""
540536

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Generated by Django 5.2.1 on 2025-06-19 11:24
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("mapping", "0007_alter_dataset_hidden_alter_mappingstatus_value_and_more"),
10+
]
11+
12+
operations = [
13+
migrations.RemoveField(
14+
model_name="scanreportfield",
15+
name="fraction_empty",
16+
),
17+
migrations.RemoveField(
18+
model_name="scanreportfield",
19+
name="fraction_unique",
20+
),
21+
migrations.RemoveField(
22+
model_name="scanreportfield",
23+
name="max_length",
24+
),
25+
migrations.RemoveField(
26+
model_name="scanreportfield",
27+
name="nrows",
28+
),
29+
migrations.RemoveField(
30+
model_name="scanreportfield",
31+
name="nrows_checked",
32+
),
33+
migrations.RemoveField(
34+
model_name="scanreportfield",
35+
name="nunique_values",
36+
),
37+
]

app/shared/shared/mapping/models.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,12 +302,6 @@ class ScanReportField(BaseModel):
302302
name = models.CharField(max_length=512, db_index=True)
303303
description_column = models.CharField(max_length=512)
304304
type_column = models.CharField(max_length=32)
305-
max_length = models.IntegerField()
306-
nrows = models.IntegerField()
307-
nrows_checked = models.IntegerField()
308-
fraction_empty = models.DecimalField(decimal_places=2, max_digits=10)
309-
nunique_values = models.IntegerField()
310-
fraction_unique = models.DecimalField(decimal_places=2, max_digits=10)
311305
ignore_column = models.CharField(max_length=64, blank=True, null=True)
312306
is_patient_id = models.BooleanField(default=False)
313307
is_ignore = models.BooleanField(default=False)

app/workers/UploadQueue/__init__.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,6 @@ def _create_field_entry(row: Tuple[Cell], scan_report_table_id: str) -> ScanRepo
8282
name=str(row[1].value),
8383
description_column=str(row[2].value),
8484
type_column=str(row[3].value),
85-
max_length=row[4].value,
86-
nrows=row[5].value,
87-
nrows_checked=row[6].value,
88-
fraction_empty=round(helpers.default_zero(row[7].value), 2),
89-
nunique_values=row[8].value,
90-
fraction_unique=round(helpers.default_zero(row[9].value), 2),
9185
)
9286

9387

0 commit comments

Comments
 (0)