checking in incremental work. Figured out how to get dates.

llm-extraction
will king 3 years ago
parent f5788051f7
commit 966171c840

@ -0,0 +1,27 @@
/*Get relationships between brands and branded drugs and packs*/
select * from rxnorm_migrated.rxnorm_relations rr
where tty1 = 'BN' and tty2 in ('SBD', 'BPCK')
limit 100;
/*get all the ndc codes associated with an rxcui
* Same as query
* http://will-office:4000/REST/rxcui/1668240/allhistoricalndcs.json
* note the different formats of the dates.
*
* Based on http://will-office:4000/RxNav/search?searchBy=RXCUI&searchTerm=1668240
* it appears that this rxcui is a sbd or bpck (branded drug or pack)
*
* If I grab every brand, then every branded drug or pack associated with that drug and then every
* */
select * from ALLNDC_HISTORY ah
where RXCUI ='1668240'
and SAB='RXNORM'
;
/**
* If I grab every brand, then every branded drug or pack associated with that drug and then attach that to the nsde data I would get the marketing dates required.
* trial -> mesh_term -> IN/MIN (rxcui) -> BN (rxcui) -> SBD/BPCK (rxcui) -> ndc11 -> nsde (marketing dates)
* */
/*
* I do need to figure out a way to change the date types when importing into postgres. In mariadb they ar mmYYYY wheras in the jsonapi they are YYYYmm but I want is YYYY-mm-01
*/*/

@ -85,7 +85,12 @@ if __name__ == "__main__":
MARIADB_PORT = os.getenv("MARIADB_PORT") MARIADB_PORT = os.getenv("MARIADB_PORT")
#get & convert datatypes for each table of interest #get & convert datatypes for each table of interest
tables_of_interest = ["rxnorm_props","rxnorm_relations"] tables_of_interest = [
"rxnorm_props"
,"rxnorm_relations"
,"ALLNDC_HISTORY"
,"ALLRXCUI_HISTORY"
]
mschema="rxnorm_current" mschema="rxnorm_current"
pschema="rxnorm_migrated" pschema="rxnorm_migrated"

@ -16,6 +16,9 @@ docker_container := `docker container ls -a | grep aact_db | cut -f 1 -d " " | t
#Various paths for docker stuff #Various paths for docker stuff
docker-compose_path := "./AACT_downloader/docker-compose.yaml" docker-compose_path := "./AACT_downloader/docker-compose.yaml"
#rxnorm_mappings
rxnorm_mappings_url := "https://dailymed-data.nlm.nih.gov/public-release-files/rxnorm_mappings.zip"
#Number of historical trials to download. #Number of historical trials to download.
count := "100" count := "100"
@ -101,3 +104,9 @@ get-histories: download-trial-histories parse-trial-histories
get-nsde: get-nsde:
cd market_data && bash download_nsde.sh cd market_data && bash download_nsde.sh
cd market_data && python extract_nsde.py cd market_data && python extract_nsde.py
get-rxnorm-mappings:
#this may not be needed, all it does is match spls to rxcuis and I think I already have that.
curl {{rxnorm_mappings_url}} > ./market_data/rxnorm_mappings.zip
cd ./market_data && unzip ./rxnorm_mappings.zip
rm ./market_data/rxnorm_mappings.zip

@ -0,0 +1 @@
downloads and extracts nsde data.
Loading…
Cancel
Save