Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
39992d8
Introduce a filtering step to select columns from specified tables, t…
gloria-trivitt Apr 16, 2026
c25365a
Rename filter_config.json to subset_config.json and update config str…
gloria-trivitt Apr 24, 2026
989fe3c
Refactor subset step to be config-driven with dynamic SQL generation
gloria-trivitt Apr 24, 2026
257127d
Add duplicate column check when creating the subset table
gloria-trivitt May 21, 2026
8a285df
Precompute SQL join/select strings to avoid f-string syntax error
gloria-trivitt May 22, 2026
d25de66
Add participant status parquet reader and initial classification logic
gloria-trivitt May 22, 2026
d4b0d53
Implement participant classification, exclusion, anomaly, and cutoff …
gloria-trivitt Jun 18, 2026
3327edb
Cast timestamps to datetime64[us, UTC] and add BQ write function for …
gloria-trivitt Jun 24, 2026
b939787
Add support for optional classification_filter in subset query genera…
gloria-trivitt Jul 1, 2026
15e2364
Filter to verified participants while reading the parquet file instea…
gloria-trivitt Jul 1, 2026
0b8c021
Remove unnecessary print() and copy() statements
gloria-trivitt Jul 1, 2026
070f13a
Add subset column censoring based on participant classification and m…
gloria-trivitt Jul 2, 2026
2299782
Comment out code related to bioSurvey, clinicalBioSurvey, and Mouthwa…
gloria-trivitt Jul 7, 2026
b7f5dcc
Change case 'EXCLUSION' to 'DATA_QUALITY_EXCLUSION'
gloria-trivitt Jul 9, 2026
9a67a49
Add the classification table as an optional argument for create_subse…
gloria-trivitt Jul 9, 2026
c8287f0
Add synthetic table generator for censorship testing
gloria-trivitt Jul 9, 2026
c2b6aff
Add synthetic participant_status.parquet generator for classify_parti…
gloria-trivitt Jul 9, 2026
b7aab8b
Fix data_quality_mask: require revoke=Yes in withdraw-missing-ts clause
gloria-trivitt Jul 9, 2026
be78f07
Precompute module eligibility flags once per gate instead of per column
gloria-trivitt Jul 10, 2026
bb697a5
Cast NULL placeholder columns to STRING instead of letting BigQuery i…
gloria-trivitt Jul 10, 2026
7d25853
Add synthetic test case where revoke_ts == withdraw_ts (currently cla…
gloria-trivitt Jul 10, 2026
5b2c6da
Track columns with unrecognized CIDs in the missing-columns report
gloria-trivitt Jul 10, 2026
b51057c
Use sorted() instead of list() when expanding wildcard column selecti…
gloria-trivitt Jul 10, 2026
67e6336
Add a separate 3A anomaly for revoke_ts == withdraw_ts (previously UN…
gloria-trivitt Jul 13, 2026
a738b8b
Update TEST_REVOKE_EQUALS_WITHDRAW to reflect resolved 3A anomaly beh…
gloria-trivitt Jul 13, 2026
eb28541
Clarify comments for cases 1 and 4
gloria-trivitt Jul 13, 2026
8e5cb4f
Update logs to include the applicable table name at the beginning of …
gloria-trivitt Jul 13, 2026
b38037c
Fix censorship summary: dedup rules sharing a status_col
gloria-trivitt Jul 15, 2026
50ed5af
Share eligibility condition between subset table and censorship summary
gloria-trivitt Jul 15, 2026
bc26142
Fix indentation in eligibility SQL builders
gloria-trivitt Jul 15, 2026
e6a4255
Generate censorship summary rollup JSON
gloria-trivitt Jul 15, 2026
cfdd37b
Rename subset-named functions to match destination/censorship termino…
gloria-trivitt Jul 15, 2026
d3f457d
Rename create_subset_table to create_destination_table
gloria-trivitt Jul 15, 2026
3927361
Finish renaming subset-named functions and references to destination/…
gloria-trivitt Jul 16, 2026
1cfe265
Add create_classification_table orchestration function
gloria-trivitt Jul 17, 2026
29ca579
Use short table names in create_destination_table/create_censorship_s…
gloria-trivitt Jul 17, 2026
3bcc5cd
Clarify build_row_filter_sql: no filter_profile conditions != no row …
gloria-trivitt Jul 17, 2026
214ad50
Remove redundant logging statement for the classification table
gloria-trivitt Jul 17, 2026
a4b0d0f
Refactor utils.py by moving participant classification into its own m…
gloria-trivitt Jul 17, 2026
368751d
Add docstrings to classification module
gloria-trivitt Jul 17, 2026
8f2c499
Route classification calls through classification module
gloria-trivitt Jul 17, 2026
97d4fbe
Move destination table building from utils.py to destination_table_bu…
gloria-trivitt Jul 17, 2026
a59ecfa
Move functions into respective modules (destination_table_builder.py,…
gloria-trivitt Jul 17, 2026
c706f48
Move censorship functions into its own module and route applicable ca…
gloria-trivitt Jul 17, 2026
95bb336
Add comment to SQL query output file
gloria-trivitt Jul 21, 2026
0332864
Move censorship summary CREATE TABLE wrapping into censorship.py
gloria-trivitt Jul 21, 2026
7d830ef
Remove columns from bioSurvey and add education variable
gloria-trivitt Jul 22, 2026
17db89f
Update test data in destination_config.json
gloria-trivitt Jul 22, 2026
8ab433d
Create endpoints for classification, destination table creation, and …
gloria-trivitt Jul 22, 2026
d4ecf39
Use a constant for the missing report directory path
gloria-trivitt Jul 22, 2026
8b073ff
Add test data to destination_config.json
gloria-trivitt Jul 23, 2026
ef1e417
Keep only the allowable cases in the censorship summary table
gloria-trivitt Jul 31, 2026
85fbd44
Look up the allowed_cases in the censorship summary endpoint
gloria-trivitt Jul 31, 2026
e535aa1
Add a check to see if a destination table uses the classification_fil…
gloria-trivitt Aug 5, 2026
98e0a93
Update destionation_config.json to include two test tables that do no…
gloria-trivitt Aug 5, 2026
fc43b9d
Update test destination tables in destination_config.json
gloria-trivitt Aug 5, 2026
a27dcbb
Skip eligibility gating on module-censored columns for destination ta…
gloria-trivitt Aug 6, 2026
89620ee
Add logging to Cloud Run service when a table does not have the class…
gloria-trivitt Aug 7, 2026
b6c20d2
Shift if statement into the try block
gloria-trivitt Aug 7, 2026
dba8ab3
Remove 'token' as a column to include
gloria-trivitt Aug 7, 2026
d6560f9
Add test table that is using the filter_profile and classification_fi…
gloria-trivitt Aug 10, 2026
fd805ff
Add test table where no classification and row filtering are present …
gloria-trivitt Aug 13, 2026
b1c8cc0
Remove bio_cutoff code since it is currently not in use
gloria-trivitt Aug 14, 2026
4ce692a
Fix comment typographical error
gloria-trivitt Aug 14, 2026
5639519
Add a comment in constants.py and classification.py explaining why BU…
gloria-trivitt Aug 14, 2026
b2603ef
Remove references to biospecimen cutoff in docstrings and comments
gloria-trivitt Aug 14, 2026
fd92d4d
Rename the 'case' column/variable/parameter name to 'consent_group' a…
gloria-trivitt Aug 18, 2026
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
391 changes: 391 additions & 0 deletions core/censorship.py

Large diffs are not rendered by default.

418 changes: 418 additions & 0 deletions core/classification.py

Large diffs are not rendered by default.

96 changes: 96 additions & 0 deletions core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,99 @@
}
]
}

# Secondary source concept IDs for each module/survey
MODULE_CENSOR_RULES = {
# Module 1: Background and Overall Health
"726699695": {
"source_table": "module1",
"status_col": "module1_status",
"completion_ts": "module1_complete_ts",
"cutoff": "survey_cutoff",
},
# Module 2: Medications, Reproductive Health, Exercise, and Sleep
"745268907": {
"source_table": "module2",
"status_col": "module2_status",
"completion_ts": "module2_complete_ts",
"cutoff": "survey_cutoff",
},
# Module 3: Smoking, Alcohol, and Sun Exposure
"965707586": {
"source_table": "module3",
"status_col": "module3_status",
"completion_ts": "module3_complete_ts",
"cutoff": "survey_cutoff",
},
# Module 4: Where You Live and Work
"716117817": {
"source_table": "module4",
"status_col": "module4_status",
"completion_ts": "module4_complete_ts",
"cutoff": "survey_cutoff",
},
# Blood/Urine/Mouthwash, Blood/Urine, and Mouthwash are commented out
# because it is unclear how the follow-up specimens will be handled.
# For now, these modules and their timestamps are excluded.
#
# Blood/Urine/Mouthwash
#"299215535": {
# "source_table": "bioSurvey",
# "status_col": "bio_status",
# "completion_ts": "bio_complete_ts",
# "cutoff": "survey_cutoff",
#},
# Blood/Urine
#"826163434": {
# "source_table": "clinicalBioSurvey",
# "status_col": "clinicalbio_status",
# "completion_ts": "clinicalbio_complete_ts",
# "cutoff": "survey_cutoff",
#},
# Mouthwash
#"390351864": {
# "source_table": "mouthwash",
# "status_col": "mouthwash_status",
# "completion_ts": "mouthwash_complete_ts",
# "cutoff": "survey_cutoff",
#},
# Menstrual Cycle (contains two secondary source concept IDs)
"912367929": {
"source_table": "menstrualSurvey",
"status_col": "menstrual_status",
"completion_ts": "menstrual_complete_ts",
"cutoff": "survey_cutoff",
},
# Menstrual Cycle (contains two secondary source concept IDs)
"232438133": {
"source_table": "menstrualSurvey",
"status_col": "menstrual_status",
"completion_ts": "menstrual_complete_ts",
"cutoff": "survey_cutoff",
},
# COVID-19
"793330426": {
"source_table": "covid19Survey",
"status_col": "covid19_status",
"completion_ts": "covid19_complete_ts",
"cutoff": "survey_cutoff",
},
# 2024 Connect Experience Survey
"506648060": {
"source_table": "experience2024",
"status_col": "experience2024_status",
"completion_ts": "experience2024_complete_ts",
"cutoff": "survey_cutoff",
},
}

NON_CENSORED_SECONDARY_SOURCE_CIDS = {
"214456996": {"source_table": "participants"}, # Eligibility Screener
"332759827": {"source_table": "participants"}, # User Profile
"218595434": {"source_table": "participants"}, # Verification
"883203566": {"source_table": "participants"}, # Sign in
"273437590": {"source_table": "participants"}, # Consent
"104913069": {"source_table": "participants"}, # Research- Finalization and shipping
}

ALWAYS_INCLUDE_NON_CID_COLUMNS = {}
Loading