### Configure populate_mysql_rxn.sh parameters Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Example configuration block for the load script parameters. ```bash MYSQL_HOME= /usr user=myuser password=p4ssw0rd db_name=RxNormPrescribe dbserver=ServerName ``` -------------------------------- ### Configure Populate_mysql_rxn.bat Parameters Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Example configuration for the batch script parameters required to connect to the MySQL database. ```batch Set MYSQL_HOME= “C:\Program Files\MySQL\MySQL Server 5.0" Set user=myuser Set password=p4ssword Set host_name=localhost Set db_name =RxNorm ``` -------------------------------- ### Configure MySQL Batch Parameters Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Example configuration for the Populate_mysql_rxn.bat script parameters. ```batch Set MYSQL_HOME= “C:\Program Files\MySQL\MySQL Server 5.0" Set user=myuser Set password=p4ssword Set host_name=localhost Set db_name =RxNormPrescribe ``` -------------------------------- ### Get drug name and schedule for a specific RxCUI Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Joins rxnconso and rxnsat to retrieve the SBD drug name and MTHSPL drug schedule. ```SQL SELECT distinct a.rxcui, b.atv as schedule, a.str FROM rxnconso a, rxnsat b WHERE a.rxcui = '1049565' AND a.tty = 'SBD' AND a.rxcui = b.rxcui AND b.sab = 'MTHSPL' AND b.atn = 'DCSA'; ``` -------------------------------- ### Create MySQL indexes Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Commands to set permissions and execute the index creation script. ```bash chmod +x Indexes_mysql_rxn.sql mysql -umyuser –pmypass -hmyhost RxNorm < Indexes_mysql_rxn.sql ``` -------------------------------- ### Create a New MySQL Database Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Command to initialize a new database with UTF-8 character encoding. ```sql CREATE DATABASE IF NOT EXISTS [database name] CHARACTER SET utf8; ``` -------------------------------- ### Execute Indexing Script Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Commands to select the database and run the index creation script. ```sql USE \. C:\RXNORM\MySQL\Indexes_mysql_rxn.sql ``` -------------------------------- ### Execute Indexing Script Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Commands to select the database and run the index creation script. ```sql USE \. C:\RXNORM\MySQL\Indexes_mysql_rxn.sql ``` -------------------------------- ### Configure MySQL population script parameters Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Set these variables at the top of populate_mysql_rxn.sh to match your local database environment. ```bash MYSQL_HOME= /usr user=myuser password=p4ssw0rd db_name=RxNorm dbserver=ServerName ``` -------------------------------- ### Execute MySQL population script Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Commands to set file permissions and run the population script. ```bash chmod 775 populate_mysql_rxn.sh ``` ```bash populate_mysql_rxn.sh ``` -------------------------------- ### Configure MySQL Indexing for RXNSAT Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Workaround for MySQL index limitation issues by enabling large prefixes and defining specific index and key sizes. ```sql Set innodb_large_prefix to ON Create index rxnsat_idx on RXNSAT (RXAUI, RXCUI, SAB, ATN(250),ATV(700)) Alter table RXNSAT add primary key (RXAUI, RXCUI, SAB, ATN(250),ATV(700)) ``` -------------------------------- ### Monitor MySQL Load Process Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Command to check the status of the database load process within the MySQL shell. ```sql mysql>show processlist; ``` -------------------------------- ### Modify MySQL Load Command for Password-less Connections Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Adjust the execution line in the batch script when the database does not require a password. ```batch %MYSQL_HOME%\bin\mysql –u %user% -p%password% -h%hostname% --local-infile=1 %db_name% >mysql.log 2 >&1 ``` ```batch %MYSQL_HOME%\bin\mysql –u %user% -h%hostname% --local-infile=1 %db_name% >mysql.log 2 >&1 ``` -------------------------------- ### Find quantified form drug data for a given RxCUI Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Retrieves quantified form drug data by querying rxnconso and filtering via rxnrel relationships. ```SQL SELECT rxcui, sab, tty, suppress, str FROM rxnconso WHERE tty in ('SCD', 'SBD') AND rxcui in (SELECT rxcui1 FROM rxnrel WHERE rxcui2='1359714' AND rela='has_quantified_form'); ``` -------------------------------- ### Find CODE for a given RxCUI Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Retrieves the CODE associated with a specific RxCUI from the rxnconso table. ```SQL SELECT code FROM rxnconso WHERE rxcui='243670'; ``` -------------------------------- ### Find current RxCUI for a retired RxCUI Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Retrieves the current RxCUI mapping for a retired RxCUI from the rxncui table. ```SQL SELECT cui2 FROM rxncui WHERE cui1='102889'; ``` -------------------------------- ### Find normalized NDCs for a given RxCUI Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Retrieves only the RxNorm normalized NDC codes for a specific RxCUI. ```SQL SELECT atv FROM rxnsat WHERE atn = 'NDC' AND rxcui = '313820' AND sab = 'RXNORM'; ``` -------------------------------- ### Find RxCUI for a given NDDF GCN_SEQ_NO Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Retrieves the RxCUI for a drug using the NDDF GCN_SEQ_NO code. ```SQL SELECT rxcui FROM rxnconso WHERE code='023855' AND sab='NDDF'; ``` -------------------------------- ### Find all NDCs for a given RxCUI Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Retrieves all NDC codes associated with a specific RxCUI from the rxnsat table. ```SQL SELECT atv FROM rxnsat WHERE atn = 'NDC' AND rxcui = '313820'; ``` -------------------------------- ### Find RxCUI for a given NDC Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Retrieves the RxCUI associated with a specific NDC code from the rxnsat table. ```SQL SELECT rxcui FROM rxnsat WHERE atv = '00093075301'; ``` -------------------------------- ### Modify MySQL command for passwordless access Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Adjust the mysql execution line when no password is required for the database connection. ```bash $MYSQL_HOME/bin/mysql –u $user –p$password $db_name >mysql.log 2>&1 ``` ```bash $MYSQL_HOME/bin/mysql –u$user $db_name >mysql.log 2>&1 ``` -------------------------------- ### Map NDCs to RxCUIs and drug names Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Retrieves a mapping of NDCs and RxCUIs from rxnsat and drug names from rxnconso. ```SQL SELECT a.atv as ndc, a.rxcui, b.str FROM rxnsat a, rxnconso b WHERE a.atn = 'NDC' AND a.rxaui = b.rxaui AND b.tty in ('SCD','SBD','GPCK','BPCK') ORDER BY b.str; ``` -------------------------------- ### Find drug details for a given NDC Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Retrieves RxCUI, SAB, TTY, CODE, and STR for a specific NDC by joining rxnconso and rxnsat tables. ```SQL SELECT rxcui, sab, tty, code, str FROM rxnconso WHERE rxcui in (select rxcui FROM rxnsat WHERE atv = '50458025303'); ``` -------------------------------- ### Find RxNorm drugs associated with HCPCS J codes Source: https://www.nlm.nih.gov/research/umls/rxnorm/docs/techdoc.html Identifies RxNorm drugs linked to HCPCS J codes by querying rxnsat and rxnconso. ```SQL SELECT distinct b.rxcui, a.atv as hcpcs, b.tty, b.str FROM rxnsat a, rxnconso b WHERE a.atn = 'DHJC' AND a.atv like 'J%' AND a.rxcui = b.rxcui AND b.tty in ('GPCK', 'BPCK', 'SCD', 'SBD') ORDER BY a.atv; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.