|
|
|
|
@ -81,3 +81,45 @@ where k.nct_id = %s
|
|
|
|
|
|
|
|
|
|
return {"summary":summary, "keywords":keywords, "conditions":conditions}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_trials_unmatched_to_formularies(db_conn):
|
|
|
|
|
"""
|
|
|
|
|
Get the NCT_IDs of trials not yet matchec to formularies
|
|
|
|
|
|
|
|
|
|
For each formulary
|
|
|
|
|
get list
|
|
|
|
|
add to dsp
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
#setup sql for each formulary
|
|
|
|
|
uspdc_sql = '''\
|
|
|
|
|
/*
|
|
|
|
|
Get the trials that have not been proceesed.
|
|
|
|
|
First: get most recent matched status
|
|
|
|
|
Second: only include those who have non-null status
|
|
|
|
|
Third: check list of trials against this and remove any of them.
|
|
|
|
|
This leaves unmatched trials.
|
|
|
|
|
*/
|
|
|
|
|
select distinct(nct_id)
|
|
|
|
|
from "DiseaseBurden".trial_to_icd10 tti
|
|
|
|
|
where nct_id not in (
|
|
|
|
|
select nct_id from "Formularies".uspdc_most_recent_matched_status umrms
|
|
|
|
|
where status is not null
|
|
|
|
|
)
|
|
|
|
|
; '''
|
|
|
|
|
uspmmg_sql = ''' Null; '''
|
|
|
|
|
vaform_sql = ''' Null; '''
|
|
|
|
|
|
|
|
|
|
#query each formulary, adding data to dict
|
|
|
|
|
formulary_list = dict()
|
|
|
|
|
|
|
|
|
|
with db_conn.cursor as curse:
|
|
|
|
|
|
|
|
|
|
# uspdc
|
|
|
|
|
curse.execute(uspdc_sql)
|
|
|
|
|
formulary_list["uspdc"] = curse.fetchall()
|
|
|
|
|
|
|
|
|
|
# uspmm
|
|
|
|
|
# vaform
|
|
|
|
|
|
|
|
|
|
return formulary_list
|
|
|
|
|
|