Browse Source

fdb-notes

= 3 years ago
parent
commit
5071d9d87a
1 changed files with 347 additions and 0 deletions
  1. 347 0
      fdb_notes.txt

+ 347 - 0
fdb_notes.txt

@@ -0,0 +1,347 @@
+medSuggest
+https://docs.fdbhealth.com/display/MKDOCUS/Navigating+to+a+Routed+Medication+Route+Dosage+Form+and+Medication
+Retrieve the MED Medication Name ID (MED_NAME_ID) from the MED Medication Name Table (RMINMID1_MED_NAME) where the MED Medication Name (MED_NAME) equals the given drug.
+"SELECT med_name_id, med_name FROM rminmid1_med_name WHERE med_status_cd = '0' AND med_name ILIKE :term ORDER BY med_name",
+['term' => '%' . $term . '%']
+
+SELECT * FROM rminmid1_med_name LIMIT 5;
+ med_name_id |           med_name            | med_name_type_cd | med_status_cd 
+-------------+-------------------------------+------------------+---------------
+           1 | sertraline                    | 2                | 0
+           2 | Acetaminophen-Hydrocodone     | 1                | 1
+           3 | hydrocodone-carbinox-pseudoep | 2                | 3
+           4 | Phenylhistine DH              | 1                | 3
+           5 | denture care products         | 2                | 3
+
+
+
+routedMeds
+https://docs.fdbhealth.com/display/MKDOCUS/Navigating+to+a+Routed+Medication+Route+Dosage+Form+and+Medication
+Retrieve the Routed Medication ID (ROUTED_MED_ID) and MED Routed Medication Description (MED_ROUTED_MED_ID_DESC) values from the MED Routed Medication Table (RMIRMID1_ROUTED_MED) where the MED Medication Name (MED_NAME_ID) equals the value retrieved in the previous step and the MED Medication Status Code (MED_STATUS_CD) value equals 0 (active). 
+"SELECT routed_med_id, med_routed_med_id_desc FROM rmirmid1_routed_med WHERE med_status_cd = '0' AND med_name_id = :medNameID ORDER BY med_routed_med_id_desc",
+['medNameID' => $medNameID]
+ SELECT * FROM rmirmid1_routed_med  WHERE med_name_id = 1; 
+ routed_med_id | med_name_id | med_route_id | med_routed_med_id_desc | med_status_cd 
+---------------+-------------+--------------+------------------------+---------------
+             1 |           1 |           24 | sertraline oral        | 0
+
+
+routedDosages
+https://docs.fdbhealth.com/display/MKDOCUS/Navigating+to+a+Routed+Medication+Route+Dosage+Form+and+Medication
+Retrieve the MED Routed Dosage Form Med ID (ROUTED_DOSAGE_FORM_MED_ID) and from the MED Routed Dosage Form Medication Table (RMIDFID1_ROUTED_DOSE_FORM_MED) where the MED Routed Medication ID (ROUTED_MED_ID) equals the value retrieved in step 2 and th
+"SELECT routed_dosage_form_med_id, med_routed_df_med_id_desc FROM rmidfid1_routed_dose_form_med WHERE med_status_cd = '0' AND routed_med_id = :routedMedID ORDER BY med_routed_df_med_id_desc",
+['routedMedID' => $routedMedID]
+SELECT * FROM rmidfid1_routed_dose_form_med WHERE routed_med_id = 1;
+ routed_dosage_form_med_id | routed_med_id | med_dosage_form_id |  med_routed_df_med_id_desc  | med_status_cd 
+---------------------------+---------------+--------------------+-----------------------------+---------------
+                         1 |             1 |                 81 | sertraline tablet           | 0
+                     20735 |             1 |                 10 | sertraline oral concentrate | 0
+
+
+meds
+https://docs.fdbhealth.com/display/MKDOCUS/Navigating+to+a+Routed+Medication+Route+Dosage+Form+and+Medication
+Retrieve the Medication Identifier (MEDID) and MED Medication Description (MED_MEDID_DESC) values from the MED Medication Table (RMIID1_MED) where the MED Routed Dosage Form Med ID (ROUTED_DOSAGE_FORM_MED_ID) equals the value retrieved in the previous step and the MED Medication Status Code (MED_STATUS_CD) value equals 0 (active).
+"SELECT medid, med_medid_desc, gcn_seqno FROM rmiid1_med WHERE med_status_cd = '0' AND routed_dosage_form_med_id = :dosageFormMedId ORDER BY med_medid_desc",
+['dosageFormMedId' => $dosageFormMedId]
+\d rmiid1_med
+Table "public.rmiid1_med"
+          Column           |         Type          | Collation | Nullable | Default 
+---------------------------+-----------------------+-----------+----------+---------
+ medid                     | numeric(8,0)          |           | not null | 
+ routed_dosage_form_med_id | numeric(8,0)          |           | not null | 
+ med_strength              | character varying(15) |           |          | 
+ med_strength_uom          | character varying(15) |           |          | 
+ med_medid_desc            | character varying(70) |           | not null | 
+ gcn_seqno                 | numeric(6,0)          |           | not null | 
+ med_gcnseqno_assign_cd    | character varying(1)  |           | not null | 
+ med_name_source_cd        | character varying(1)  |           | not null | 
+ med_ref_fed_legend_ind    | character varying(1)  |           | not null | 
+ med_ref_dea_cd            | character varying(1)  |           | not null | 
+ med_ref_multi_source_cd   | character varying(1)  |           | not null | 
+ med_ref_gen_drug_name_cd  | character varying(1)  |           | not null | 
+ med_ref_gen_comp_price_cd | character varying(1)  |           | not null | 
+ med_ref_gen_spread_cd     | character varying(1)  |           | not null | 
+ med_ref_innov_ind         | character varying(1)  |           | not null | 
+ med_ref_gen_thera_equ_cd  | character varying(1)  |           | not null | 
+ med_ref_desi_ind          | character varying(1)  |           | not null | 
+ med_ref_desi2_ind         | character varying(1)  |           | not null | 
+ med_status_cd             | character varying(1)  |           | not null | 
+ generic_medid             | numeric(8,0)          |           |          |
+
+sideEffects
+https://docs.fdbhealth.com/display/MKDOCUS/Retrieving+a+List+of+Side+Effects
+-- Query the GCN_SEQNO column of the SIDE GCN_SEQNO/Drug Side Effect Code Relation Table (RSIDEGC0_GCNSEQNO_LINK) using the drug’s Clinical Formulation ID (GCN_SEQNO) value to retrieve all of its related SIDE Side Effects Code (SIDE) values.
+-- Query the SIDE column of the SIDE Master Table (RSIDEMA3_MSTR) using each SIDE value from the previous step to retrieve the following columns:
+	-- SIDE Frequency of Occurrence Code (SIDE_FREQ)
+	-- SIDE Severity Code (SIDE_SEV)
+	-- FML Disease Identifier (DXID)
+-- Follow the process described in the FML module’s Finding DXID Descriptions and Synonyms application to find each DXID value’s Primary Layman Name.
+SELECT r1.side, sm.side_freq, sm.side_sev, sm.dxid, dx.dxid_desc56 
+FROM rsidegc0_gcnseqno_link r1 
+    JOIN rsidema3_mstr sm ON r1.side = sm.side
+    JOIN rfmldx0_dxid dx ON sm.dxid = dx.dxid
+WHERE r1.gcn_seqno = :gcnSeqNo
+ORDER BY sm.side_sev DESC, sm.side_freq ASC
+['gcnSeqNo' => $gcnSeqNo]
+-- get a drug(routed dosage med) gcn_seqno 
+SELECT gcn_seqno FROM rmiid1_med WHERE routed_dosage_form_med_id  = 20735;
+ gcn_seqno 
+-----------
+     46230
+
+-- get side effects for the genseq
+SELECT * FROM rsidegc0_gcnseqno_link WHERE gcn_seqno = 46230;
+ gcn_seqno | side 
+-----------+------
+     46230 |  560
+     46230 | 2451
+
+
+-- get side effect details 
+SELECT * FROM RSIDEMA3_MSTR WHERE side = 560;
+ side | side_sn |   fdbdx   | side_freq | side_sev | side_viscd | side_labcd | side_phys | side_hyper | dxid  
+------+---------+-----------+-----------+----------+------------+------------+-----------+------------+-------
+  560 |       0 | 03.276100 | 2         | 1        | 2          | 1          | 1         |            |   736
+  560 |       1 | 05.296000 | 2         | 1        | 1          | 0          | 1         |            |   950
+  560 |       2 | 05.296010 | 2         | 1        | 1          | 0          | 1         |            |   951
+  560 |       3 | 05.300007 | 2         | 0        | 1          | 0          | 0         |            | 14664
+  560 |       4 | 05.300906 | 2         | 1        | 1          | 0          | 1         |            |   985
+  560 |       5 | 05.302700 | 0         | 1        | 1          | 0          | 1         |            |   992
+  560 |       6 | 05.302701 | 0         | 1        | 1          | 0          | 1         |            |   993
+  560 |       7 | 05.307900 | 1         | 0        | 1          | 0          | 0         |            |  1018
+
+-- side_feq dictionary 
+1 = Incidence less frequent
+0 = Incidence more frequent
+2 = Incidence rare or very rare
+
+-- side_sev dictionary
+0 = “less severe” if it is non-threatening (such as constipation)
+1 = “severe” if it may be life-threatening (such as agranulocytosis)
+
+-- get the description for a side effect using  dxid 
+SELECT * FROM rfmldx0_dxid WHERE dxid = 736;
+ dxid | dxid_desc56  | dxid_desc100 | dxid_status |   fdbdx   | dxid_disease_duration_cd 
+------+--------------+--------------+-------------+-----------+--------------------------
+  736 | hyponatremia | hyponatremia | 0           | 03.276100 | 3
+
+
+geriatricPrecautions
+https://docs.fdbhealth.com/display/MKDOCUS/Application%3A+Screening+a+Drug+for+Geriatric+Precautions
+-- Select Geriatric Precaution Code (GERI_CODE) from the GERI GCN_SEQNO Link Table (RGERIGC0_GERI_GCNSEQNO_LINK) where the Clinical Formulation ID (GCN_SEQNO) column equals the Clinical Formulation ID (GCN_SEQNO) of the drug to screen.
+-- Select GERI precautions information from the Geriatric Precautions Master Table (RGERIMA1_GERI_MSTR) where the GERI_CODE column equals the GERI_CODE value from the previous step.
+SELECT r1.geri_code, gm.geri_sl, gm.geri_desc, gm.geri_narrative
+FROM rgerigc0_geri_gcnseqno_link r1 
+JOIN rgerima1_geri_mstr gm ON r1.geri_code = gm.geri_code
+WHERE r1.gcn_seqno = :gcnSeqNo
+ORDER BY gm.geri_desc
+['gcnSeqNo' => $gcnSeqNo]
+-- select geriatricPrecautions based for a given drug formulation code 
+SELECT * FROM RGERIGC0_GERI_GCNSEQNO_LINK WHERE gcn_seqno = 46230 LIMIT 5 ;
+ gcn_seqno | geri_code 
+-----------+-----------
+     46230 |       831
+-- get the meaning of the geri_code 
+SELECT geri_code, geri_desc, geri_narrative FROM RGERIMA1_GERI_MSTR WHERE geri_code = 831;
+ geri_code | geri_desc  |                                                                                                                            geri_narrative                                                                                                                             
+-----------+------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------
+       831 | Sertraline | Hepatic-Mild hepatic impairment of aging may predispose the elderly to increased serum levels and increased adverse events.  Endocrine-May exacerbate or cause SIADH
+ or hyponatremia. Monitor sodium level closely when starting or changing dosages in older adults.
+
+
+indications
+https://docs.fdbhealth.com/display/MKDOCUS/Retrieving+a+Drug%27s+List+of+Indications
+Indications refers to the use of that drug for treating a particular disease
+-- Retrieve the INDM Indications Code (INDCTS) associated to the drug product’s Clinical Formulation ID (GCN_SEQNO) using the INDM GCN_SEQNO/Drug Indications Code Relation Table (RINDMGC0_INDCTS_GCNSEQNO_LINK).
+-- For each Clinical Formulation ID (GCN_SEQNO)/INDCTS combination retrieved in step 2, retrieve the following columns from the INDM Master Table (RINDMMA2_INDCTS_MSTR):
+	-- INDM Sequence Number (INDCTS_SN)
+	-- INDM Labeled Code (INDCTS_LBL)
+	-- FML Disease Identifier (DXID)
+	-- INDM Proxy Indicator (PROXY_IND)
+-- Get the description from https://docs.fdbhealth.com/display/MKDOCUS/Finding+DXID+Descriptions+and+Synonyms
+	-- For DxID 00000595’s Primary Professional Name, find its associated FML 56-character Description column (DXID_DESC56) and FML 100-character Description column (DXID_DESC100) in the FML Disease Identifier (DxID) Table (RFMLDX0_DXID).
+SELECT r1.indcts, r2.indcts_sn, r2.indcts_lbl, r2.dxid, r2.proxy_ind, r3.dxid_desc56
+FROM rindmgc0_indcts_gcnseqno_link r1 
+    JOIN rindmma2_indcts_mstr r2 ON r1.indcts = r2.indcts
+    JOIN rfmldx0_dxid r3 ON r2.dxid = r3.dxid
+WHERE r1.gcn_seqno = :gcnSeqNo
+ORDER BY r3.dxid_desc56
+['gcnSeqNo' => $gcnSeqNo]
+-- Select indications for a given gcn_seqno 
+SELECT * FROM RINDMGC0_INDCTS_GCNSEQNO_LINK WHERE gcn_seqno = 46230;
+ gcn_seqno | indcts 
+-----------+--------
+     46230 |    201
+-- get the details of the indicts 
+SELECT * FROM RINDMMA2_INDCTS_MSTR WHERE indcts = 201 AND proxy_ind <> 'Y' LIMIT 5;
+ indcts | indcts_sn | indcts_lbl |   fdbdx   | dxid  | proxy_ind | pred_code 
+--------+-----------+------------+-----------+-------+-----------+-----------
+    201 |         0 | U          | 05.296500 | 12862 | N         | 3
+    201 |         1 | U          | 05.298001 |  8464 | N         | 3
+    201 |         2 | L          | 05.300010 |   970 | N         | 2
+    201 |         3 | L          | 05.300230 |   975 | N         | 2
+    201 |         4 | L          | 05.300300 |   976 | N         | 3
+NB: to remove Non-FDA approved, add where indcts_lbl <> 'U'; //U == unlabeled
+-- get the meaning of DXIDs 
+SELECT * FROM RFMLDX0_DXID WHERE dxid IN (970, 975, 976);
+ dxid |          dxid_desc56          |         dxid_desc100          | dxid_status |   fdbdx   | dxid_disease_duration_cd 
+------+-------------------------------+-------------------------------+-------------+-----------+--------------------------
+  970 | panic disorder                | panic disorder                | 0           | 05.300010 | 1
+  975 | social phobia                 | social phobia                 | 0           | 05.300230 | 2
+  976 | obsessive-compulsive disorder | obsessive-compulsive disorder | 0           | 05.300300 | 2
+
+
+contraindications
+https://docs.fdbhealth.com/display/MKDOCUS/Retrieving+a+List+of+Drug+Contraindications
+-- Get drug ddxcn from rddcmrm0_routed_med_link
+-- Retrieve the FML Disease Identifier (DXID) values associated with DDXCN 50225 from the DDCM Master Table (RDDCMMA1_CONTRA_MSTR).
+-- Retrieve the FML 100-Character Description (DXID_DESC100) for each DXID value using the FML Disease Identifier (DxID) Table (RFMLDX0_DXID).
+SELECT r1.ddxcn, r2.dxid, r2.ddxcn_sl, r3.dxid_desc56
+FROM rddcmrm0_routed_med_link r1 
+    JOIN rddcmma1_contra_mstr r2 ON r1.ddxcn = r2.ddxcn
+    JOIN rfmldx0_dxid r3 ON r2.dxid = r3.dxid
+WHERE r1.routed_med_id = :routedMedID
+ORDER BY r2.ddxcn_sl
+['routedMedID' => $routedMedID]
+
+-- get drug disease contraindications for a given routed_med_id 
+SELECT * FROM RDDCMRM0_ROUTED_MED_LINK  WHERE routed_med_id = 1;
+ routed_med_id | ddxcn 
+---------------+-------
+             1 | 50005
+-- get the details of ddxcn 
+SELECT * FROM RDDCMDD0_CONTRA_DRUG_DESC WHERE ddxcn = 50005;
+ ddxcn | ddxcn_drug_desc 
+-------+-----------------
+ 50005 | SERTRALINE
+
+-- get dxid associated with the ddxcn (get disease id associated with the contraindications)
+SELECT * FROM RDDCMMA1_CONTRA_MSTR WHERE ddxcn = 50005; 
+ddxcn | ddxcn_sn |   fdbdx   | ddxcn_sl |         ddxcn_ref          | dxid  
+-------+----------+-----------+----------+----------------------------+-------
+ 50005 |        0 | 03.276100 | 3        | ZOLOFT PI, 12/2016         |   736
+ 50005 |        1 | 03.253600 | 3        | ZOLOFT PI, 12/2016         |   624
+ 50005 |        2 | 04.286906 | 3        | ZOLOFT PI, 12/2016         |   867
+ 50005 |        3 | 05.296700 | 3        | ZOLOFT PI, 12/2016         |   954
+ 50005 |        4 | 05.300906 | 2        | MEDWATCH, 3/04, PI 5/14    |   985
+ 50005 |        5 | 09.573900 | 2        | ZOLOFT PI, 12/2016         |  2202
+
+-- get human readable meanings of the dxid 
+SELECT * FROM RFMLDX0_DXID WHERE dxid IN (736,624,867,954,985,2202);
+ dxid |        dxid_desc56         |        dxid_desc100        | dxid_status |   fdbdx   | dxid_disease_duration_cd 
+------+----------------------------+----------------------------+-------------+-----------+--------------------------
+  624 | SIADH syndrome             | SIADH syndrome             | 0           | 03.253600 | 3
+  736 | hyponatremia               | hyponatremia               | 0           | 03.276100 | 3
+  867 | increased risk of bleeding | increased risk of bleeding | 0           | 04.286906 | 2
+  954 | bipolar disorder           | bipolar disorder           | 0           | 05.296700 | 2
+  985 | suicidal ideation          | suicidal ideation          | 0           | 05.300906 | 3
+ 2202 | disease of liver           | disease of liver           | 0           | 09.573900 | 2
+
+
+dxSuggest
+https://docs.fdbhealth.com/display/MKDOCUS/Finding+DXID+Descriptions+and+Synonyms
+-- For DxID 00000595’s Primary Professional Name, find its associated FML 56-character Description column (DXID_DESC56) and FML 100-character Description column (DXID_DESC100) in the FML Disease Identifier (DxID) Table (RFMLDX0_DXID).
+-- For DxID 00000595’s Professional Synonyms, find its associated FML 56-character Synonym Description (DXID_SYN_DESC56) and FML 100-character Synonym Description (DXID_SYN_DESC100) in the FML Disease Identifier (DxID) Synonym Table (RFMLSYN0_DXID_SYN). Specify a value of 01 for the FML Name Type Code (DXID_SYN_NMTYP) to signify that you wish to retrieve this DxID’s Professional Synonyms.
+-- i.e search where term matches in the main table (rfmldx0_dxid) and in the synonyms table (rfmlsyn0_dxid_syn) on both 56 and 100 character descriptions
+SELECT distinct(r1.dxid), r1.dxid_desc56 
+FROM rfmldx0_dxid r1
+JOIN rfmlsyn0_dxid_syn r2 ON r1.dxid = r2.dxid
+WHERE (r1.dxid_desc56 ILIKE :term OR r1.dxid_desc100 ILIKE :term OR r2.dxid_syn_desc56 ILIKE :term OR r2.dxid_syn_desc100 ILIKE :term)
+ORDER BY r1.dxid_desc56
+['term' => '%' . $term . '%']
+-- DX has 
+	- Primary Professional Name: one and only one - RFMLDX0_DXID
+	RFMLSYN0_DXID_SYN
+	- Professional Synonym: zero, one, or many -  dxid_syn_nmtyp = 01
+	- Primary Layman Name: zero, one, or many - dxid_syn_nmtyp = 02
+	- Layman Synonym: zero, one, or many - dxid_syn_nmtyp = 03
+	- Abbreviation: zero, one, or many - dxid_syn_nmtyp = 04
+ SELECT * FROM RFMLDX0_DXID WHERE dxid = '595';
+ dxid |       dxid_desc56        |       dxid_desc100       | dxid_status |   fdbdx   | dxid_disease_duration_cd 
+------+--------------------------+--------------------------+-------------+-----------+--------------------------
+  595 | type 1 diabetes mellitus | type 1 diabetes mellitus | 0           | 03.250010 | 2
+
+-- get synonyms: 
+ SELECT * FROM RFMLSYN0_DXID_SYN WHERE dxid = 595 AND dxid_syn_nmtyp = '01';
+ dxid_synid | dxid | dxid_syn_nmtyp |           dxid_syn_desc56           |          dxid_syn_desc100           | dxid_syn_status 
+------------+------+----------------+-------------------------------------+-------------------------------------+-----------------
+        384 |  595 | 01             | juvenile diabetes                   | juvenile diabetes                   | 0
+        387 |  595 | 01             | insulin-dependent DM                | insulin-dependent DM                | 0
+        388 |  595 | 01             | insulin-dependent diabetes mellitus | insulin-dependent diabetes mellitus | 0
+        389 |  595 | 01             | ketosis-prone diabetes mellitus     | ketosis-prone diabetes mellitus     | 0
+        390 |  595 | 01             | ketosis-prone diabetes              | ketosis-prone diabetes              | 0
+        391 |  595 | 01             | juvenile-onset diabetes             | juvenile-onset diabetes             | 0
+        392 |  595 | 01             | juvenile-onset diabetes mellitus    | juvenile-onset diabetes mellitus    | 0
+        393 |  595 | 01             | juvenile onset DM                   | juvenile onset DM                   | 0
+        394 |  595 | 01             | type I diabetes mellitus            | type I diabetes mellitus            | 0
+        395 |  595 | 01             | diabetes mellitus type 1            | diabetes mellitus type 1            | 0
+        396 |  595 | 01             | ketosis-prone DM                    | ketosis-prone DM                    | 0
+      58331 |  595 | 01             | insulin dependent diabetes mellitus | insulin dependent diabetes mellitus | 0
+      58407 |  595 | 01             | immune mediated diabetes mellitus   | immune mediated diabetes mellitus   | 0
+
+
+allergySuggest
+https://docs.fdbhealth.com/display/MKDOCUS/Recording+Patient+Allergy+Information
+-- Query the DAM Allergen Concept ID Description column (DAM_CONCEPT_ID_DESC) in the RDAMAPM0_ALRGN_PICKLIST_MSTR table or the RDAMCA0_CONCEPT table to find all entries with the description “carbamates."
+SELECT r1.dam_concept_id, r1.dam_concept_id_typ, r1.dam_concept_id_desc
+FROM rdamca0_concept r1
+WHERE (r1.dam_concept_id_desc ILIKE :term)
+ORDER BY r1.dam_concept_id_desc
+
+
+drugDrugInteraction
+https://docs.fdbhealth.com/display/MKDOCUS/Screening+for+Active+and+Inactive+Ingredient+Drug-Drug+Interactions
+
+drugCoadministration
+https://docs.fdbhealth.com/display/MKDOCUS/Displaying+Coadministration+Text
+
+duplicateTherapy
+https://docs.fdbhealth.com/display/MKDOCUS/Detecting+Therapeutic+Class+Duplications
+-- Retrieve the Routed Medication ID (ROUTED_MED_ID) in the DPT Routed Medication ID Table(rmirmid1_routed_med), or Routed Generic Identifier (ROUTED_GEN_ID) in the DPT Routed Generic Table, or Clinical Formulation ID (GCN_SEQNO) in the DPT GCN_SEQNO Table for the newly prescribed (prospective) drug and for each drug in the patient profile (profiled drugs).
+-- Retrieve the associated DPT Class Identifiers (DPT_CLASS_ID) from the DPT Class Table (RDPTCL0_CLASS_ID) for each prospective drug and each profiled drug.
+-- Compare the DPT_CLASS_IDs and retrieve the DPT Class Description (DPT_CLASS_DESC) record from the RDPTCL0_CLASS_ID table when Duplicate Therapy Class matches occur.
+-- Compare the number of times that a match of a given class is returned with the DPT Duplication Allowance (DPT_ALLOWANCE) from the RDPTCL0_CLASS_ID table. If the number of matches exceeds the DPT_ALLOWANCE value, a duplicate therapy exists. In most instances, the duplication allowance is zero. Programming for a duplication allowance of one or more should occur only for drugs in the same class that are used concurrently, per accepted medical practice.
+
+=====================================================================================================
+Get drugs used to treat a given condition 
+-- get dxid for the condition eg. 'social phobia'
+SELECT * FROM RFMLDX0_DXID WHERE dxid_desc56 ILIKE 'social%';
+ dxid |  dxid_desc56  | dxid_desc100  | dxid_status |   fdbdx   | dxid_disease_duration_cd 
+------+---------------+---------------+-------------+-----------+--------------------------
+  975 | social phobia | social phobia | 0           | 05.300230 | 2
+
+-- get indcts for the condition 
+SELECT DISTINCT(indcts) FROM RINDMMA2_INDCTS_MSTR WHERE dxid = 975 AND proxy_ind <> 'Y' AND indcts_lbl <> 'U';
+ indcts 
+--------
+    201
+   1006
+   1457
+   1695
+
+-- get clinical formulations (gcn_seqno) for the above indcts 
+SELECT * FROM RINDMGC0_INDCTS_GCNSEQNO_LINK WHERE indcts IN (201,1006,1457,1695);
+ gcn_seqno | indcts 
+-----------+--------
+     46222 |   1006
+     46223 |   1006
+     46224 |   1006
+     46225 |   1006
+     46226 |   1006
+....
+
+-- get drugs that contain this gcn_seqno 
+SELECT medid, med_medid_desc, gcn_seqno FROM rmiid1_med WHERE gcn_seqno IN (SELECT gcn_seqno FROM RINDMGC0_INDCTS_GCNSEQNO_LINK WHERE indcts IN (201,1006,1457,1695));
+SELECT medid, med_medid_desc, gcn_seqno FROM rmiid1_med WHERE gcn_seqno IN (SELECT gcn_seqno FROM RINDMGC0_INDCTS_GCNSEQNO_LINK WHERE indcts IN (201,1006,1457,1695));
+ medid  |                    med_medid_desc                     | gcn_seqno 
+--------+-------------------------------------------------------+-----------
+ 157825 | paroxetine ER 37.5 MG tablet,extended release 24 hr   |     50138
+ 159557 | venlafaxine ER 37.5 mg capsule,extended release 24 hr |     46403
+ 160594 | venlafaxine ER 75 mg capsule,extended release 24 hr   |     46404
+ 162880 | paroxetine 10 mg tablet                               |     46222
+ 165384 | Effexor XR 75 mg capsule,extended release             |     46404
+ 166110 | Paxil CR 37.5 MG tablet,extended release              |     50138
+ 182739 | Effexor XR 37.5 mg capsule,extended release           |     46403
+ 183163 | Paxil 20 mg tablet                                    |     46223
+ 184142 | Paxil 10 mg/5 mL oral suspension                      |     46226
+ 187550 | sertraline 100 mg tablet                              |     46229