Vijayakrishnan 3 роки тому
батько
коміт
f7777f8dc3
1 змінених файлів з 202 додано та 188 видалено
  1. 202 188
      app/Http/Controllers/FDBPGController.php

+ 202 - 188
app/Http/Controllers/FDBPGController.php

@@ -13,6 +13,7 @@ class FDBPGController extends Controller
         return view('app.fdb-pg.fdb-rx');
     }
 
+    // 1. medication suggest
     public function medSuggest(Request $request)
     {
         $term = $request->input('term') ? trim($request->input('term')) : '';
@@ -24,6 +25,7 @@ class FDBPGController extends Controller
         return view('app.fdb-pg.fdb-med-suggest', compact('matches'));
     }
 
+    // 2. routed meds from men name
     public function routedMeds(Request $request)
     {
         $medNameID = $request->input('med-name-id') ? trim($request->input('med-name-id')) : '';
@@ -35,6 +37,7 @@ class FDBPGController extends Controller
         return json_encode($matches);
     }
 
+    // 3. routed dosage from routed med
     public function routedDosages(Request $request)
     {
         $routedMedID = $request->input('routed-med-id') ? trim($request->input('routed-med-id')) : '';
@@ -46,6 +49,7 @@ class FDBPGController extends Controller
         return json_encode($matches);
     }
 
+    // 4. strengths from routed med
     public function meds(Request $request)
     {
         $dosageFormMedId = $request->input('dosage-form-med-id') ? trim($request->input('dosage-form-med-id')) : '';
@@ -57,6 +61,7 @@ class FDBPGController extends Controller
         return json_encode($matches);
     }
 
+    // side effects for a given rx
     public function sideEffects(Request $request)
     {
         $gcnSeqNo = $request->input('gcn-seq-no') ? trim($request->input('gcn-seq-no')) : '';
@@ -74,6 +79,7 @@ ORDER BY sm.side_sev DESC, sm.side_freq ASC
         return view('app.fdb-pg.fdb-side-effects', compact('sides'));
     }
 
+    // ger prec for a given rx
     public function geriatricPrecautions(Request $request)
     {
         $gcnSeqNo = $request->input('gcn-seq-no') ? trim($request->input('gcn-seq-no')) : '';
@@ -90,6 +96,7 @@ ORDER BY gm.geri_desc
         return view('app.fdb-pg.fdb-geriatric-precautions', compact('precautions'));
     }
 
+    // indication of a given rx
     public function indications(Request $request)
     {
         $gcnSeqNo = $request->input('gcn-seq-no') ? trim($request->input('gcn-seq-no')) : '';
@@ -107,6 +114,7 @@ ORDER BY r3.dxid_desc56
         return view('app.fdb-pg.fdb-indications', compact('indications'));
     }
 
+    // contra-indications of a given rx
     public function contraindications(Request $request)
     {
         $routedMedID = $request->input('routed-med-id') ? trim($request->input('routed-med-id')) : '';
@@ -124,6 +132,7 @@ ORDER BY r2.ddxcn_sl
         return view('app.fdb-pg.fdb-contraindications', compact('contraindications'));
     }
 
+    // dx suggest
     public function dxSuggest(Request $request)
     {
         $term = $request->input('term') ? trim($request->input('term')) : '';
@@ -140,6 +149,7 @@ ORDER BY r1.dxid_desc56
         return view('app.fdb-pg.fdb-dx-suggest', compact('matches'));
     }
 
+    // allergy suggest
     public function allergySuggest(Request $request)
     {
         $term = $request->input('term') ? trim($request->input('term')) : '';
@@ -155,6 +165,7 @@ ORDER BY r1.dam_concept_id_desc
         return view('app.fdb-pg.fdb-allergy-suggest', compact('matches'));
     }
 
+    // drug <-> allergy match making
     public function drugAllergies(Request $request) {
 
         // override
@@ -214,88 +225,88 @@ ORDER BY r1.dam_concept_id_desc
 
     }
 
-    private function drugAllergyIngredientAllergenVsSingleRx($_allergen, $_rx) {
+        private function drugAllergyIngredientAllergenVsSingleRx($_allergen, $_rx) {
 
-        $matches = DB::connection('pgsql_fdb')->select("
-(
-    -- ingredients from medication
-    SELECT R1.related_hic_seqn as hic_seqn, R2.hic_desc
-    FROM RHICHCR0_HIC_HIC_LINK R1
-             JOIN RHICD5_HIC_DESC R2 ON R1.related_hic_seqn = R2.hic_seqn
-    WHERE R1.hic_seqn IN (
-        SELECT S2.dam_alrgn_hic_seqn
-        FROM RMEDMHL0_MED_HICLSEQNO_LINK S1
-                 JOIN RDAMHHA0_HIC_HICL_ALG_LINK S2 ON S1.hicl_seqno = S2.hicl_seqno
-        WHERE S1.med_concept_id = :medid
-          AND S1.med_concept_id_typ = 3
-    )
-)
-INTERSECT
-(
-    -- all ingredients directly and related from allergens
+            $matches = DB::connection('pgsql_fdb')->select("
     (
+        -- ingredients from medication
         SELECT R1.related_hic_seqn as hic_seqn, R2.hic_desc
         FROM RHICHCR0_HIC_HIC_LINK R1
                  JOIN RHICD5_HIC_DESC R2 ON R1.related_hic_seqn = R2.hic_seqn
-        WHERE R1.hic_seqn = :allergenConceptID
+        WHERE R1.hic_seqn IN (
+            SELECT S2.dam_alrgn_hic_seqn
+            FROM RMEDMHL0_MED_HICLSEQNO_LINK S1
+                     JOIN RDAMHHA0_HIC_HICL_ALG_LINK S2 ON S1.hicl_seqno = S2.hicl_seqno
+            WHERE S1.med_concept_id = :medid
+              AND S1.med_concept_id_typ = 3
+        )
     )
-    UNION
-    -- all ingredients via related dam allergen groups
+    INTERSECT
     (
-        SELECT r3.hic_seqn, r4.hic_desc
-        FROM RDAMGHC0_HIC_ALRGN_GRP_LINK R1
-                 JOIN rdamagd1_alrgn_grp_desc R2 on R1.dam_alrgn_grp = R2.dam_alrgn_grp
-                 JOIN RDAMGHC0_HIC_ALRGN_GRP_LINK R3 on R1.dam_alrgn_grp = R3.dam_alrgn_grp
-                 JOIN RHICD5_HIC_DESC R4 on r3.hic_seqn = r4.hic_seqn
-        WHERE R1.hic_seqn = :allergenConceptID
-          AND R2.dam_alrgn_grp_status_cd = 0
-        ORDER BY r3.hic_seqn
+        -- all ingredients directly and related from allergens
+        (
+            SELECT R1.related_hic_seqn as hic_seqn, R2.hic_desc
+            FROM RHICHCR0_HIC_HIC_LINK R1
+                     JOIN RHICD5_HIC_DESC R2 ON R1.related_hic_seqn = R2.hic_seqn
+            WHERE R1.hic_seqn = :allergenConceptID
+        )
+        UNION
+        -- all ingredients via related dam allergen groups
+        (
+            SELECT r3.hic_seqn, r4.hic_desc
+            FROM RDAMGHC0_HIC_ALRGN_GRP_LINK R1
+                     JOIN rdamagd1_alrgn_grp_desc R2 on R1.dam_alrgn_grp = R2.dam_alrgn_grp
+                     JOIN RDAMGHC0_HIC_ALRGN_GRP_LINK R3 on R1.dam_alrgn_grp = R3.dam_alrgn_grp
+                     JOIN RHICD5_HIC_DESC R4 on r3.hic_seqn = r4.hic_seqn
+            WHERE R1.hic_seqn = :allergenConceptID
+              AND R2.dam_alrgn_grp_status_cd = 0
+            ORDER BY r3.hic_seqn
+        )
     )
-)
-",
-            ['medid' => $_rx->medid, 'allergenConceptID' => $_allergen->dam_concept_id]
-        );
+    ",
+                ['medid' => $_rx->medid, 'allergenConceptID' => $_allergen->dam_concept_id]
+            );
 
-        return !!count($matches);
-    }
+            return !!count($matches);
+        }
 
-    private function drugAllergyMedicationAllergenVsSingleRx($_allergen, $_rx) {
+        private function drugAllergyMedicationAllergenVsSingleRx($_allergen, $_rx) {
 
-        $matches = DB::connection('pgsql_fdb')->select("
-(
-    -- ingredients from medication
-    SELECT R1.related_hic_seqn as hic_seqn
-    FROM RHICHCR0_HIC_HIC_LINK R1
-             JOIN RHICD5_HIC_DESC R2 ON R1.related_hic_seqn = R2.hic_seqn
-    WHERE R1.hic_seqn IN (
-        SELECT S2.dam_alrgn_hic_seqn
-        FROM RMEDMHL0_MED_HICLSEQNO_LINK S1
-                 JOIN RDAMHHA0_HIC_HICL_ALG_LINK S2 ON S1.hicl_seqno = S2.hicl_seqno
-        WHERE S1.med_concept_id = :medid
-          AND S1.med_concept_id_typ = 3
+            $matches = DB::connection('pgsql_fdb')->select("
+    (
+        -- ingredients from medication
+        SELECT R1.related_hic_seqn as hic_seqn
+        FROM RHICHCR0_HIC_HIC_LINK R1
+                 JOIN RHICD5_HIC_DESC R2 ON R1.related_hic_seqn = R2.hic_seqn
+        WHERE R1.hic_seqn IN (
+            SELECT S2.dam_alrgn_hic_seqn
+            FROM RMEDMHL0_MED_HICLSEQNO_LINK S1
+                     JOIN RDAMHHA0_HIC_HICL_ALG_LINK S2 ON S1.hicl_seqno = S2.hicl_seqno
+            WHERE S1.med_concept_id = :medid
+              AND S1.med_concept_id_typ = 3
+        )
     )
-)
-INTERSECT
-(
-    -- all ingredients directly and related from allergens
-    SELECT R1.dam_alrgn_hic_seqn as hic_seqn
-    FROM RDAMHHA0_HIC_HICL_ALG_LINK R1
-    WHERE R1.hicl_seqno IN (
-        SELECT R1.hicl_seqno
-        FROM RMEDMHL0_MED_HICLSEQNO_LINK R1
-        WHERE R1.med_concept_id_typ = 1
-          AND R1.med_concept_id = :allergenConceptID
-          AND MED_CONCEPT_HICL_SRC_CD = 0
+    INTERSECT
+    (
+        -- all ingredients directly and related from allergens
+        SELECT R1.dam_alrgn_hic_seqn as hic_seqn
+        FROM RDAMHHA0_HIC_HICL_ALG_LINK R1
+        WHERE R1.hicl_seqno IN (
+            SELECT R1.hicl_seqno
+            FROM RMEDMHL0_MED_HICLSEQNO_LINK R1
+            WHERE R1.med_concept_id_typ = 1
+              AND R1.med_concept_id = :allergenConceptID
+              AND MED_CONCEPT_HICL_SRC_CD = 0
+        )
     )
-)
-",
-            ['medid' => $_rx->medid, 'allergenConceptID' => $_allergen->dam_concept_id]
-        );
+    ",
+                ['medid' => $_rx->medid, 'allergenConceptID' => $_allergen->dam_concept_id]
+            );
 
-        return !!count($matches);
-    }
+            return !!count($matches);
+        }
 
-    private function drugAllergyGroupAllergenVsSingleRx($_allergen, $_rx) {
+        private function drugAllergyGroupAllergenVsSingleRx($_allergen, $_rx) {
 
         $matches = DB::connection('pgsql_fdb')->select("
 (
@@ -339,6 +350,7 @@ INTERSECT
         return !!count($matches);
     }
 
+    // drug <-> drug match making
     public function drugDrugInteraction(Request $request) {
 
         if($request->input('test')) {
@@ -386,135 +398,135 @@ INTERSECT
         return implode("<br>", $output);
     }
 
-    private function drugDrugInteractionSinglePair($_rx1, $_rx2) {
+        private function drugDrugInteractionSinglePair($_rx1, $_rx2) {
 
-        $output = [];
+            $output = [];
+
+            // get active ingredient DDI_CODEX values for drug 1 and 2
+            $rx1ActiveDdiCodex = $this->getActiveDdiCodexFromGcnSeqNo($_rx1->gcn_seqno);
+            $rx2ActiveDdiCodex = $this->getActiveDdiCodexFromGcnSeqNo($_rx2->gcn_seqno);
+            if(!$rx1ActiveDdiCodex || !$rx2ActiveDdiCodex || !count($rx1ActiveDdiCodex) || !count($rx2ActiveDdiCodex)) return "";
+
+    //        dump($rx1_DDI_CODEX);
+    //        dump($rx2_DDI_CODEX);
+
+            // get inactive ingredient DDI_CODEX values for drug 1 and 2
+            // to get this we need to first get the NDCs of the drugs
+            $rx1Ndc = $this->getNdcFromMedId($_rx1->medid);
+            $rx2Ndc = $this->getNdcFromMedId($_rx2->medid);
+
+    //        dump($rx1Ndc);
+    //        dump($rx2Ndc);
+
+            $rx1InactiveDdiCodex = $this->getInactiveDdiCodexFromNdc($rx1Ndc);
+            $rx2InactiveDdiCodex = $this->getInactiveDdiCodexFromNdc($rx2Ndc);
+            // if(!$rx1InactiveDdiCodex || !$rx2InactiveDdiCodex || !count($rx1InactiveDdiCodex) || !count($rx2InactiveDdiCodex)) return "";
+
+    //        dump($rx1InactiveDdiCodex);
+    //        dump($rx2InactiveDdiCodex);
+
+            // get ddi codex - monox pairs for drug 1 & 2
+            $rx1ActiveDdiCodexMonoxPairs = $this->getDdiCodexMonoxPairs($rx1ActiveDdiCodex);
+            $rx1InactiveDdiCodexMonoxPairs = $this->getDdiCodexMonoxPairs($rx1InactiveDdiCodex);
+            $rx2ActiveDdiCodexMonoxPairs = $this->getDdiCodexMonoxPairs($rx2ActiveDdiCodex);
+            $rx2InactiveDdiCodexMonoxPairs = $this->getDdiCodexMonoxPairs($rx2InactiveDdiCodex);
 
-        // get active ingredient DDI_CODEX values for drug 1 and 2
-        $rx1ActiveDdiCodex = $this->getActiveDdiCodexFromGcnSeqNo($_rx1->gcn_seqno);
-        $rx2ActiveDdiCodex = $this->getActiveDdiCodexFromGcnSeqNo($_rx2->gcn_seqno);
-        if(!$rx1ActiveDdiCodex || !$rx2ActiveDdiCodex || !count($rx1ActiveDdiCodex) || !count($rx2ActiveDdiCodex)) return "";
-
-//        dump($rx1_DDI_CODEX);
-//        dump($rx2_DDI_CODEX);
-
-        // get inactive ingredient DDI_CODEX values for drug 1 and 2
-        // to get this we need to first get the NDCs of the drugs
-        $rx1Ndc = $this->getNdcFromMedId($_rx1->medid);
-        $rx2Ndc = $this->getNdcFromMedId($_rx2->medid);
-
-//        dump($rx1Ndc);
-//        dump($rx2Ndc);
-
-        $rx1InactiveDdiCodex = $this->getInactiveDdiCodexFromNdc($rx1Ndc);
-        $rx2InactiveDdiCodex = $this->getInactiveDdiCodexFromNdc($rx2Ndc);
-        // if(!$rx1InactiveDdiCodex || !$rx2InactiveDdiCodex || !count($rx1InactiveDdiCodex) || !count($rx2InactiveDdiCodex)) return "";
-
-//        dump($rx1InactiveDdiCodex);
-//        dump($rx2InactiveDdiCodex);
-
-        // get ddi codex - monox pairs for drug 1 & 2
-        $rx1ActiveDdiCodexMonoxPairs = $this->getDdiCodexMonoxPairs($rx1ActiveDdiCodex);
-        $rx1InactiveDdiCodexMonoxPairs = $this->getDdiCodexMonoxPairs($rx1InactiveDdiCodex);
-        $rx2ActiveDdiCodexMonoxPairs = $this->getDdiCodexMonoxPairs($rx2ActiveDdiCodex);
-        $rx2InactiveDdiCodexMonoxPairs = $this->getDdiCodexMonoxPairs($rx2InactiveDdiCodex);
-
-//        dump($rx1ActiveDdiCodexMonoxPairs);
-//        dump($rx1InactiveDdiCodexMonoxPairs);
-//        dump($rx2ActiveDdiCodexMonoxPairs);
-//        dump($rx2InactiveDdiCodexMonoxPairs);
-
-        // compare 1-active to 2-active and 2-inactive
-        $activeCatches = [];
-        foreach ($rx1ActiveDdiCodexMonoxPairs as $compareLeft) {
-            foreach ($rx2ActiveDdiCodexMonoxPairs as $compareRight) {
-                if($compareLeft->ddi_monox == $compareRight->ddi_monox && $compareLeft->ddi_codex != $compareRight->ddi_codex) {
-                    $activeCatches[] = $compareLeft->ddi_codex;
+    //        dump($rx1ActiveDdiCodexMonoxPairs);
+    //        dump($rx1InactiveDdiCodexMonoxPairs);
+    //        dump($rx2ActiveDdiCodexMonoxPairs);
+    //        dump($rx2InactiveDdiCodexMonoxPairs);
+
+            // compare 1-active to 2-active and 2-inactive
+            $activeCatches = [];
+            foreach ($rx1ActiveDdiCodexMonoxPairs as $compareLeft) {
+                foreach ($rx2ActiveDdiCodexMonoxPairs as $compareRight) {
+                    if($compareLeft->ddi_monox == $compareRight->ddi_monox && $compareLeft->ddi_codex != $compareRight->ddi_codex) {
+                        $activeCatches[] = $compareLeft->ddi_codex;
+                    }
                 }
-            }
-            foreach ($rx2InactiveDdiCodexMonoxPairs as $compareRight) {
-                if($compareLeft->ddi_monox == $compareRight->ddi_monox && $compareLeft->ddi_codex != $compareRight->ddi_codex) {
-                    $activeCatches[] = $compareLeft->ddi_codex;
+                foreach ($rx2InactiveDdiCodexMonoxPairs as $compareRight) {
+                    if($compareLeft->ddi_monox == $compareRight->ddi_monox && $compareLeft->ddi_codex != $compareRight->ddi_codex) {
+                        $activeCatches[] = $compareLeft->ddi_codex;
+                    }
                 }
             }
-        }
 
-        // compare 1-inactive to 2-active and 2-inactive
-        $inactiveCatches = [];
-        foreach ($rx1InactiveDdiCodexMonoxPairs as $compareLeft) {
-            foreach ($rx2ActiveDdiCodexMonoxPairs as $compareRight) {
-                if($compareLeft->ddi_monox == $compareRight->ddi_monox && $compareLeft->ddi_codex != $compareRight->ddi_codex) {
-                    $inactiveCatches[] = $compareLeft->ddi_codex;
+            // compare 1-inactive to 2-active and 2-inactive
+            $inactiveCatches = [];
+            foreach ($rx1InactiveDdiCodexMonoxPairs as $compareLeft) {
+                foreach ($rx2ActiveDdiCodexMonoxPairs as $compareRight) {
+                    if($compareLeft->ddi_monox == $compareRight->ddi_monox && $compareLeft->ddi_codex != $compareRight->ddi_codex) {
+                        $inactiveCatches[] = $compareLeft->ddi_codex;
+                    }
                 }
-            }
-            foreach ($rx2InactiveDdiCodexMonoxPairs as $compareRight) {
-                if($compareLeft->ddi_monox == $compareRight->ddi_monox && $compareLeft->ddi_codex != $compareRight->ddi_codex) {
-                    $inactiveCatches[] = $compareLeft->ddi_codex;
+                foreach ($rx2InactiveDdiCodexMonoxPairs as $compareRight) {
+                    if($compareLeft->ddi_monox == $compareRight->ddi_monox && $compareLeft->ddi_codex != $compareRight->ddi_codex) {
+                        $inactiveCatches[] = $compareLeft->ddi_codex;
+                    }
                 }
             }
-        }
 
-        if(count($activeCatches)) {
-            $output[] = "<b>{$_rx2->rx}</b> interacts with one or more active ingredients in <b>{$_rx1->rx}</b>.";
-        }
-        if(count($inactiveCatches)) {
-            $output[] = "<b>{$_rx2->rx}</b> interacts with one or more inactive ingredients in <b>{$_rx1->rx}</b>.";
-        }
+            if(count($activeCatches)) {
+                $output[] = "<b>{$_rx2->rx}</b> interacts with one or more active ingredients in <b>{$_rx1->rx}</b>.";
+            }
+            if(count($inactiveCatches)) {
+                $output[] = "<b>{$_rx2->rx}</b> interacts with one or more inactive ingredients in <b>{$_rx1->rx}</b>.";
+            }
 
-        // TODO: find out and show the names of the actual ingredients causing interaction
+            // TODO: find out and show the names of the actual ingredients causing interaction
 
-        return implode("<br>", $output);
-    }
+            return implode("<br>", $output);
+        }
 
-    private function getActiveDdiCodexFromGcnSeqNo($_gcnSeqNo) {
-        $ddiCodexArray = [];
-        $query = DB::connection('pgsql_fdb')->select("
-SELECT r1.ddi_codex
-FROM RADIMGC4_GCNSEQNO_LINK r1 
-WHERE r1.gcn_seqno = :gcnSeqNo
-            ",
-            ['gcnSeqNo' => $_gcnSeqNo]
-        );
-        if(count($query)) {
-            $ddiCodexArray = array_map(function($_x) {
-                return $_x->ddi_codex;
-            }, $query);
+        private function getActiveDdiCodexFromGcnSeqNo($_gcnSeqNo) {
+            $ddiCodexArray = [];
+            $query = DB::connection('pgsql_fdb')->select("
+    SELECT r1.ddi_codex
+    FROM RADIMGC4_GCNSEQNO_LINK r1 
+    WHERE r1.gcn_seqno = :gcnSeqNo
+                ",
+                ['gcnSeqNo' => $_gcnSeqNo]
+            );
+            if(count($query)) {
+                $ddiCodexArray = array_map(function($_x) {
+                    return $_x->ddi_codex;
+                }, $query);
+            }
+            return $ddiCodexArray;
         }
-        return $ddiCodexArray;
-    }
 
-    private function getNdcFromMedId($_medId) {
-        $ndcArray = [];
-        $query = DB::connection('pgsql_fdb')->select("
-select ndc from rmindc1_ndc_medid where medid = :medId
-            ",
-            ['medId' => $_medId]
-        );
-        if(count($query)) {
-            $ndcArray = array_map(function($_x) {
-                return $_x->ndc;
-            }, $query);
+        private function getNdcFromMedId($_medId) {
+            $ndcArray = [];
+            $query = DB::connection('pgsql_fdb')->select("
+    select ndc from rmindc1_ndc_medid where medid = :medId
+                ",
+                ['medId' => $_medId]
+            );
+            if(count($query)) {
+                $ndcArray = array_map(function($_x) {
+                    return $_x->ndc;
+                }, $query);
+            }
+            return $ndcArray;
         }
-        return $ndcArray;
-    }
 
-    private function getInactiveDdiCodexFromNdc($_ndc) {
-        $ddiCodexArray = [];
-        $query = DB::connection('pgsql_fdb')->select("
-SELECT distinct r1.ddi_codex
-FROM RDDIMIN0_NDC_INACTV_DDIM_LINK r1 
-WHERE r1.ddi_ndc IN (" . implode(',', array_map(function($_x) {return "'" . $_x . "'";}, $_ndc)) . ")
-            "
-        );
-        if(count($query)) {
-            $ddiCodexArray = array_map(function($_x) {
-                return $_x->ddi_codex;
-            }, $query);
+        private function getInactiveDdiCodexFromNdc($_ndc) {
+            $ddiCodexArray = [];
+            $query = DB::connection('pgsql_fdb')->select("
+    SELECT distinct r1.ddi_codex
+    FROM RDDIMIN0_NDC_INACTV_DDIM_LINK r1 
+    WHERE r1.ddi_ndc IN (" . implode(',', array_map(function($_x) {return "'" . $_x . "'";}, $_ndc)) . ")
+                "
+            );
+            if(count($query)) {
+                $ddiCodexArray = array_map(function($_x) {
+                    return $_x->ddi_codex;
+                }, $query);
+            }
+            return $ddiCodexArray;
         }
-        return $ddiCodexArray;
-    }
 
-    private function getDdiCodexMonoxPairs($_ddiCodexArray) {
+        private function getDdiCodexMonoxPairs($_ddiCodexArray) {
         $ddiCodexMonoxPairsArray = [];
         if(count($_ddiCodexArray)) {
             $ddiCodexMonoxPairsArray = DB::connection('pgsql_fdb')->select("
@@ -527,6 +539,7 @@ WHERE r1.ddi_codex IN (" . implode(',', array_map(function($_x) {return "'" . $_
         return $ddiCodexMonoxPairsArray;
     }
 
+    // drug <-> drug coadministration notes
     public function drugCoadministration(Request $request) {
         $gcnSeqnos = $request->input('gcn-seqnos') ? trim($request->input('gcn-seqnos')) : '';
         if (empty($gcnSeqnos)) return '';
@@ -541,6 +554,7 @@ WHERE r1.side_a_gcn_seqno in ($gcnSeqnos) AND r1.side_b_gcn_seqno in ($gcnSeqnos
         return view('app.fdb-pg.fdb-coadministration', compact('coadministration'));
     }
 
+    // duplicate therapy indications
     public function duplicateTherapy(Request $request) {
 
         if($request->input('test')) {
@@ -592,18 +606,18 @@ WHERE r1.side_a_gcn_seqno in ($gcnSeqnos) AND r1.side_b_gcn_seqno in ($gcnSeqnos
             }, $matches)) . "</ol>";
     }
 
-    private function getDptClassFromGcnSeqNo($_gcnSeqNo) {
-        return DB::connection('pgsql_fdb')->select("
-SELECT distinct r1.dpt_class_id, r2.dpt_allowance, r2.dpt_class_desc
-FROM RDPTGC0_GCNSEQNO_LINK r1 
-JOIN RDPTCL0_CLASS_ID r2 on r1.dpt_class_id = r2.dpt_class_id
-WHERE r1.gcn_seqno = :gcnSeqNo
-            ",
-            ['gcnSeqNo' => $_gcnSeqNo]
-        );
-    }
+        private function getDptClassFromGcnSeqNo($_gcnSeqNo) {
+            return DB::connection('pgsql_fdb')->select("
+    SELECT distinct r1.dpt_class_id, r2.dpt_allowance, r2.dpt_class_desc
+    FROM RDPTGC0_GCNSEQNO_LINK r1 
+    JOIN RDPTCL0_CLASS_ID r2 on r1.dpt_class_id = r2.dpt_class_id
+    WHERE r1.gcn_seqno = :gcnSeqNo
+                ",
+                ['gcnSeqNo' => $_gcnSeqNo]
+            );
+        }
 
-    private function compareDPTs($_dptArray1, $_dptArray2) {
+        private function compareDPTs($_dptArray1, $_dptArray2) {
         $output = [];
         for ($i=0; $i<count($_dptArray1); $i++) {
             for ($j=0; $j<count($_dptArray2); $j++) {