-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIndicationCodesExtractorTest.php
703 lines (586 loc) · 29.6 KB
/
IndicationCodesExtractorTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
<!-- BEGINNING OF DOCUMENT -->
<!DOCTYPE html>
<?php
//header('Content-Type: text/csv');
//header('Content-Disposition: attachment; filename="sample.csv"');
// Hypothes.is API TOKEN: (just a test) 6879-ef-QplA3MslmdVLEuDjP0pQrHmkAxhweWPjAZYOlH_M
// DailyMed group id on Hypothes.is: pGv4X7iV
// List of usernames on the dailymed group that actually have annotations:
/*amrapaliz 66
jonquet 2
liuwenqiangcs 37
lrieswijk 4
micheldumontier 3
rcelebi 98
sandeepayyar19 17
shima 11
Tudorzinho 4
yashvyas 11
Yijia_Zhang 61*/
// DrugCentral DB connection pot
include("conn_dev.php");
// Hypothes.is API wrapper (I also wrapped the DailyMed API call that we use here, in there as well)
require_once('Hypothesis.inc.php');
// Don't time out script if it takes long
set_time_limit(0);
// Function to calculate the difference between two arrays
function arrayRecursiveDiff($a1, $a2) {
$result = array();
foreach($a1 as $va1) {
$found = false;
foreach($a2 as $va2) {
try{
//echo "va1: ".$va1." va2: ".$va2."<br>";
// if its a single value we need to convert to a singleton array
if (!is_array($va1)){
$va1 = compact($va1);
}
if (!is_array($va2)){
$va2 = compact($va2);
}
$x = array_diff($va1, $va2);
if (empty($x)) {
$found = true;
}
}
catch (Exception $e){
echo "va1: ".$va1." va2: ".$va2.", Exception Line 45: ".$e->getMessage();
}
}
if (!$found) {
$result[] = $va1;
}
}
foreach($a2 as $va2) {
$found = false;
foreach($a1 as $va1) {
try{
//echo "va1: ".$va1." va2: ".$va2."<br>";
// if its a single value we need to convert to a singleton array
if (!is_array($va1)){
$va1 = compact($va1);
}
if (!is_array($va2)){
$va2 = compact($va2);
}
$x = array_diff($va2, $va1);
if (empty($x)) {
$found = true;
}
}
catch (Exception $e){
echo "va1: ".$va1." va2: ".$va2.", Exception Line 63: ".$e->getMessage();
}
}
if (!$found) {
$result[] = $va2;
}
}
return $result;
}
// Function to avoid the "string expected" array found problem
function serialize_array_values($arr){
foreach($arr as $key=>$val){
try{
echo "val: ".$val."<br>";
// if sub-array $val is one value it will not be an array
if (is_array($val)){
sort($val);
}
}
catch (Exception $e){
echo "val: ".$val.", Exception Line 83: ".$e->getMessage();
}
$arr[$key]=serialize($val);
}
return $arr;
}
// Function to avoid the "string expected" array found problem
function serialize_array_values2($arr){
foreach($arr as $key=>$val){
sort($val);
$arr[$key]=json_encode($val);
}
return $arr;
}
function contains($str, $c){
for ($x = 0; $x < strlen($str);$x++){
if ($str[$x] == $c){
return true;
}
}
return false;
}
// Hypothes.is API TOKEN
$token = '6879-2oY7ox3Ka1n2H9x_vimd8sVIZJZWEaDLSprWamIvWlA';
// Hypothes.is and DailyMed PHP Wrapper instances
$hypothesis = new HypothesisAPI();
// Drugname typed in input textbox
$drugname=@$_POST['drugname'];
// Whether the checkbox to indicate drug class has been ticked or not
$isdrugclass=@$_POST['isdrugclass'];
// Just a input validation flag to check if we entered entered anything or if its a single drug or class of drugs
// that we are reporting on
$candisplaystuff = 0;
// Input error flag
$error = 0;
$matchingSETIDs = array();
// If the drugname is specified (textbox is not empty) and the drug class checkbox is not ticked
if(isset($_POST['drugname']) && $drugname <> "" && $isdrugclass == ""){
// Can display results because textbox is not empty
$candisplaystuff = 2;
// -------- DRUGCENTRAL STUFF ---------- //
// Query string to get drug central id for the given drug name
$atcCodeQueryStr = "SELECT code from atc where chemical_substance = '".$drugname."' limit 1";
// Actual query to get the drug central id
$atcCodeQueryResult = pg_query($conn, $atcCodeQueryStr) or die("Could not execute query");
// If there is exactly one result
if (pg_num_rows($atcCodeQueryResult) == 1){
//echo "Rows: ".pg_num_rows($atcCodeQueryResult)." <br>";
// Get the single cell in the result of the query
$atcCell = pg_fetch_object($atcCodeQueryResult);
// Get the single value inside the cell
$atc = $atcCell->code;
// Get the struct id of the drug on the drug central database. The struct id is needed so we can
// pull up the indication information about the drug from the drug central database table:
// omop_relationship
// First the query string
$getStructIDQueryStr = "SELECT struct_id from struct2atc where atc_code ='".$atc."' limit 1";
// The actual query
$getStructIDQueryResult = pg_query($conn, $getStructIDQueryStr) or die("Could not execute query");
// If there is exactly one result
if (pg_num_rows($getStructIDQueryResult) == 1){
// Get the single cell in the result of the query
$structIDCell = pg_fetch_object($getStructIDQueryResult);
// Get the single value inside the cell
$struct_id = $structIDCell->struct_id;
// Query string to get all the drug central indications for this drug
$getIndicationCodesQueryStr = "SELECT omop_relationship.id,
omop_relationship.struct_id,
omop_relationship.concept_id,
omop_relationship.relationship_name,
omop_relationship.concept_name,
omop_relationship.umls_cui,
omop_relationship.snomed_full_name,
omop_relationship.cui_semantic_type,
omop_relationship.snomed_conceptid,
d.doid
FROM (omop_relationship
LEFT JOIN ( SELECT doid_xref.xref,
string_agg((doid_xref.doid)::text, ','::text) AS doid
FROM doid_xref
WHERE ((doid_xref.source)::text ~~ 'SNOMED%'::text)
GROUP BY doid_xref.xref) d ON ((omop_relationship.snomed_conceptid = (d.xref)::bigint)))
WHERE omop_relationship.struct_id = $struct_id and omop_relationship.relationship_name = 'indication'";
// Actual query directive to get all the drug central indications for this drug
$getIndicationCodesQueryResult = pg_query($conn, $getIndicationCodesQueryStr) or die("Could not execute query");
// If there is at least one indication for this drug
if (pg_num_rows($getIndicationCodesQueryResult) > 0){
// -------- DAILYMED STUFF ---------- //
// DailyMed API e.g. https://dailymed.nlm.nih.gov/dailymed/services/v2/spls.json?drug_name=cisplatin
// Get SPL (structured product label) information from DailyMed about the drug(s) that have the name given.
// I.e., returns a JSON object which holds an array of products (product labels) on DailyMed which have
// the given drug name as the main ingredient
$splDailyMed = $dailyMed->getSPLInfo($drugname);
// We should have at least one product label for the drug on DailyMed (count the size of the returned array)
if (count($splDailyMed->data) > 0){
// There may be more than one product containing the same drug (from other manufacturers etc.)
// We are only interested in the one which is annotated by Linda! We have to loop through
// each label until we find it.
// Get the array / list of drugs from the JSON object
$d = $splDailyMed->data;
// Get the number of products in the array (size of array)
$numDMEntries = count($d);
// Now we will loop through each of them until we find the one with the annotations
$done = false;
$idx = 0;
while (!$done && ($idx < $numDMEntries)){
// Not "first drug". A better name for this variable would be "current drug"
// Get current drug in the array
$firstDrug = $d[$idx];
// Get the SET ID (DailyMed ID) for the drug
$set_id = $firstDrug->setid;
// Set the base URL on DailyMed where we are going to search for drug annotations
$dailyMedBaseUrl = "https://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=";
// Add the SET ID so we can isolate the actual web page on DailyMed for the given drug
$dailyMedDrugUrl = $dailyMedBaseUrl.$set_id;
// Actually get all the hypothesis annotations. This calls the Hypothes.is API command for getting all the annotations on this page
// I.e., all annotations at this URL which are by lrieswijk and have a tag in it called "indication" (the indications)
// NB. each annotation is actually a set / array of tags, so $result is a set of arrays, one for each indication
$result = $hypothesis->search(array('uri' => $dailyMedDrugUrl, 'user' => 'lrieswijk', 'tag' => 'indication'), $token);
//$result = $hypothesis->search(array('uri' => $dailyMedDrugUrl, 'user' => 'lrieswijk'), $token);
//$result = $hypothesis->search(array('uri' => $dailyMedDrugUrl, 'group' => 'dailymed'), $token);
$dailyMedIndications = array();
// If there is at least one indication for the drug
if (count($result) > 0){
$str = "";
$idx2 = 0;
// For each indication listed (NEED TO FIX THIS FOREACH AND HOW I STORE AND DISPLAY THE INFO IN THE TABLE!!!)
foreach ($result as $value) {
// Initialise current row (array) of the indications table
$currentRow = array(6);
// Add the first column value (SET ID)
$currentRow[0] = $set_id;
// Drill down to the actual text that we annotating
$t = $value->target;
// ?
$s = $t[0]->selector;
// Now add the second column value (indication name or text)
$currentRow[1] = $s[3]->exact;
// Get the tags for this indication as an array
$annotations = $value->tags;
// ?
$arr = array();
array_push($arr, 2);
array_push($arr, 3);
$umlsCodes = array();
$doidCodes = array();
// Iterate through the tags to find UMLS and DOID codes
for ($x = 0; $x < count($annotations); $x++){
// Get the first four characters of the tag (the annotation protocol dictates that DOID codes
// and UMLS codes start with either "DOID" or "UMLS" respectively)
$firstFourChars = substr($annotations[$x], 0, 4);
if ($firstFourChars == "UMLS"){
$pos = strpos($annotations[$x], ':');
array_push($umlsCodes, substr($annotations[$x],$pos+1));
// ?
if(($key = array_search(2, $arr)) !== false) {
unset($arr[$key]);
}
}
if ($firstFourChars == "DOID"){
$colon = false;
$colon = contains($annotations[$x], ':');
if ($colon){
$pos = strpos($annotations[$x], ':');
array_push($doidCodes, substr($annotations[$x],$pos+1));
}
else{
$pos = strpos($annotations[$x], '_');
array_push($doidCodes, substr($annotations[$x],$pos+1));
}
// ?
if(($key = array_search(3, $arr)) !== false) {
unset($arr[$key]);
}
}
}
$currentRow[2] = implode(',', $umlsCodes);
$currentRow[3] = implode(',', $doidCodes);
// ?
$currentRow[4] = "";
$currentRow[5] = "";
// Rows of table
array_push($dailyMedIndications, $currentRow);
// Increment row for this indication
$idx2++;
}
$done = true;
}
// increment product label index (go to next product label)
$idx++;
}
}
else{
echo "No SPL for: ".$drugname."<br>";
}
}
else{
$candisplaystuff = 999;
}
}
else{
$candisplaystuff = 999;
}
}
else{
$candisplaystuff = 999;
}
}
else if(isset($_POST['drugname']) && $drugname <> "" && $isdrugclass == "true"){ // If we are searching for all drugs in a particular drug class
// Different output flag value (we have to display a table with numbers representing indication matches per drug)
$candisplaystuff = 3;
$data = array();
// First get all ATC codes and Struct_IDs for given drug class
// Query string formulation
$getSetIDsQueryStr = "SELECT dm_id FROM dailymed_comparison WHERE atc LIKE '".$drugname."%'";
//$getStructIDsAndATCCodesQueryStr = "select distinct a.struct_id, b.atc from struct2atc a, cardiovascular_drugs b where a.atc_code like '".$drugname."%' and a.atc_code = b.atc and (b.atc NOT IN (SELECT distinct c.atc FROM dailymed_comparison c WHERE c.atc LIKE 'C%'));";
// Actual query directive to get the Struct_IDs and ATC codes for the given drug class
$getSetIDsQueryResult = pg_query($conn, $getSetIDsQueryStr) or die("Could not execute query");
// If there is at least one atc / set id pair for this drug class in DrugCentrals DB
if (pg_num_rows($getSetIDsQueryResult) > 0){
echo "here!<br>";
// Initialise array of SET IDs (drugs) that will match our condition: that they have co-prescribed medication tags in them
// For each drug, check if it has "role" prefixed tags in its annotations and store these to array
while($grow = pg_fetch_array($getSetIDsQueryResult)){
// Set the base URL on DailyMed where we are going to search for drug annotations
//$dailyMedBaseUrl = "https://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=939b5d1f-9fb2-4499-80ef-0607aa6b114e";
// Append the SET ID so we can isolate the actual web page on DailyMed for the given drug
$dailyMedDrugUrl = "https://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=939b5d1f-9fb2-4499-80ef-0607aa6b114e";
// Actually get all the Hypothes.is annotations.
// Part 1: Get annotations pertaining to this drugs indications.
// (a) first we pull annotations from the dailymed private group that have tag "indication"
$result = $hypothesis->search(array('uri' => $dailyMedDrugUrl, 'group' => 'pGv4X7iV'), $token);
print_r($result);
// (b) and then we pull the public annotations
$result_public = $hypothesis->search(array('uri' => $dailyMedDrugUrl), $token);
print_r($result_public);
// (c) add all public annotations to the dailymed private array (collect all indications in one array)
foreach ($result_public as $value) {
array_push($result, $value);
}
}
}
// Append the SET ID so we can isolate the actual web page on DailyMed for the given drug
/* $dailyMedDrugUrl = "https://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=939b5d1f-9fb2-4499-80ef-0607aa6b114e";
// Actually get all the Hypothes.is annotations.
// Part 1: Get annotations pertaining to this drugs indications.
// (a) first we pull annotations from the dailymed private group that have tag "indication"
$result = $hypothesis->search(array('uri' => $dailyMedDrugUrl, 'group' => 'pGv4X7iV'), $token);
print_r($result);
// (b) and then we pull the public annotations
$result_public = $hypothesis->search(array('uri' => $dailyMedDrugUrl), $token);
print_r($result_public);
// (c) add all public annotations to the dailymed private array (collect all indications in one array)
foreach ($result_public as $value) {
array_push($result, $value);
}*/
/*$fp = fopen('php://output', 'w');
foreach ( $data as $line ) {
$val = explode(",", $line);
fputcsv($fp, $val);
}
fclose($fp);*/
}
?>
<!-- DISPLAY TABLE OF RESULTS -->
<html lang="en">
<head>
<meta charset="utf-8" />
<title>DrugCentral vs DailyMed: indication codes comparison</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta content="" name="description" />
<meta content="" name="author" />
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css" />
<link href="css/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="css/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="css/layout.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="dist.css"></link>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript" src="js/jquery/asidebar.jquery.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
.container{
margin-top: 100px;
margin: auto;
}
h1{
/*margin-top: 100px;*/
text-align: center;
color: #747f8c;
}
@import url('http://fonts.googleapis.com/css?family=Roboto+Condensed');
.back {
width: 33%;
height: 100px;
background-color: #eeeeee;
border: 10px;
border-color: #ffffff;
border-style: solid;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
counter-increment: bc;
padding: 0px 5px 5px 5px;
}
.back:before {
content: counter(bc) "_";
position: absolute;
padding: 10px;
}
@media screen and (max-width: 1260px) {
.back {
width: 50%;
}
}
@media screen and (max-width: 840px) {
.back
{ width: 100%;
}
}
.button_base {
font-size: 18px;
margin:auto!important;
border-radius: 10px;
width: 218px;
height: 50px;
text-align: center;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-user-select: none;
cursor: default;
}
.button_base:hover {
cursor: pointer;
}
.b01_simple_rollover {
color: #ffffff;
border: #747f8c solid 1px;
background-color: #51ede4;
}
.b01_simple_rollover:hover {
color: #747f8c;
background-color: #ffffff;
}
.formcontainer{
float: left;
width:150px;
}
p {
font-size: 14pt;
padding-left: 0.5cm;
}
input[type=submit]{
text-align: center;
font-weight: bold;
}
.table td {
text-align: center;
}
.table th {
text-align: center;
}
table, td, th {
border: 1px solid #ddd;
text-align: left;
}
table {
border-collapse: collapse;
width: 100%;
}
th, td {
padding: 15px;
}
</style>
<h1 style="margin-top:100px;">DrugCentral vs DailyMed: indication codes comparison</h1>
</head>
<body>
<br><br>
<section>
<div id="formcontainer">
<form action="IndicationCodesExtractorTest.php" method="post">
<div align="center">
<div style="color: #747f8c; font-size: 20px;"> Drug name or class: </div> <br> <input type="text" id="drugname" name="drugname">
</div>
<br>
<div align="center">
<input type="checkbox" name="isdrugclass" value="true">Class<br>
</div>
<br>
<div align="center">
<input class="back button_base b01_simple_rollover" type="submit" value="View Report">
</div>
<br><br>
</form>
</div>
<?php if ($candisplaystuff == 2) { ?>
<h1><?php echo $drugname." (".$atc.")"; ?></h1>
<div class="container">
<table class="table table-hover" style="table-layout:fixed">
<thead>
<tr bgcolor="#51ede4">
<th>DrugCentral ID</th>
<th>Indication Name</th>
<th>UMLS Code</th>
<th>DOID Code</th>
<th>SNOMED Code</th>
<th>SNOMED Name</th>
</tr>
</thead>
<tbody>
<?php while($grow = pg_fetch_array($getIndicationCodesQueryResult)) { ?>
<tr>
<td><?php echo $grow['struct_id']; ?></td>
<td><?php echo $grow['concept_name']; ?></td>
<td><?php echo $grow['umls_cui']; ?></td>
<td><?php echo str_replace("DOID", "", $grow['doid']); ?></td>
<td><?php echo $grow['snomed_conceptid']; ?></td>
<td><?php echo $grow['snomed_full_name']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<br><br>
<table class="table table-hover" style="table-layout:fixed">
<thead>
<tr bgcolor="#51ede4">
<th>DailyMed ID</th>
<th>Indication Name</th>
<th>UMLS Code</th>
<th>DOID Code</th>
<th>SNOMED Code</th>
<th>SNOMED Name</th>
</tr>
</thead>
<tbody>
<?php for($x = 0; $x < count($result); $x++) { ?>
<tr>
<td><?php echo $dailyMedIndications[$x][0]; ?></td>
<td><?php echo $dailyMedIndications[$x][1]; ?></td>
<td><?php echo $dailyMedIndications[$x][2]; ?></td>
<td><?php echo $dailyMedIndications[$x][3]; ?></td>
<td><?php echo $dailyMedIndications[$x][4]; ?></td>
<td><?php echo $dailyMedIndications[$x][5]; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php }
else{
if ($candisplaystuff == 1){
echo '<script language="javascript">';
echo 'alert("Please type in a drug name")';
echo '</script>';
exit;
}
else if ($candisplaystuff == 999){
echo '<script language="javascript">';
echo 'alert("Could not find information for this drug or class.")';
echo '</script>';
exit;
}
else if ($candisplaystuff == 3){ ?>
<h1><?php echo "Drug Class: ".$drugname; ?></h1>
<div class="container">
<table class="table table-hover" style="table-layout:fixed">
<thead>
<tr bgcolor="#51ede4">
<th>#</th>
<th>SET IDs</th>
</tr>
</thead>
<tbody>
<?php for($x = 0; $x < count($matchingSETIDs); $x++) { ?>
<tr>
<td><?php echo $x; ?></td>
<td><?php echo "<a href='https://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=".$matchingSETIDs[$x]."'>".$matchingSETIDs[$x]."</a>"; ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php }
} ?>
</section>
</body>
</html>
<!-- END OF DOCUMENT -->