-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added parsing funcs for AggDescription in rcv_accession_classificatio…
…n table.
- Loading branch information
Showing
3 changed files
with
284 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
CREATE OR REPLACE FUNCTION `clinvar_ingest.parseAggDescription`(json STRING) | ||
RETURNS STRUCT< | ||
description ARRAY<STRUCT< | ||
clinical_impact_assertion_type STRING, | ||
clinical_impact_clinical_significance STRING, | ||
date_last_evaluated DATE, | ||
num_submissions INT64, | ||
interp_description STRING | ||
>> | ||
> | ||
LANGUAGE js | ||
OPTIONS ( | ||
library=['gs://clinvar-ingest/bq-tools/parse-utils.js']) | ||
AS r""" | ||
return parseAggDescription(json); | ||
"""; | ||
|
||
-- test | ||
WITH x as ( | ||
SELECT | ||
""" | ||
{ | ||
"Description": [ | ||
{ | ||
"@ClinicalImpactAssertionType": "diagnostic", | ||
"@ClinicalImpactClinicalSignificance": "supports diagnosis", | ||
"@DateLastEvaluated": "2024-01-24", | ||
"@SubmissionCount": "1", | ||
"$": "Tier I - Strong" | ||
}, | ||
{ | ||
"@ClinicalImpactAssertionType": "prognostic", | ||
"@ClinicalImpactClinicalSignificance": "better outcome", | ||
"@DateLastEvaluated": "2024-01-23", | ||
"@SubmissionCount": "1", | ||
"$": "Tier I - Strong" | ||
} | ||
]} | ||
""" as content | ||
), | ||
aggDescriptions as ( | ||
select `clinvar_ingest.parseAggDescription`(x.content)) as aggDescription from x | ||
) | ||
select ad.* from aggDescriptions as ad | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters