c1cb93083e
Changed: Added official_use, source name, and source URL fields to the medicine schema in [app/bootstrap.php (line 200)](/Users/tyemeclifford/Documents/GH/workout/app/bootstrap.php:200). Added shared display helpers and API used_for output in [app/bootstrap.php (line 1848)](/Users/tyemeclifford/Documents/GH/workout/app/bootstrap.php:1848). Updated openFDA imports to pull indications_and_usage first, then purpose, and store source links in [app/bootstrap.php (line 3060)](/Users/tyemeclifford/Documents/GH/workout/app/bootstrap.php:3060). Updated the medicine detail page to show “What It Is Used For” plus the openFDA label link in [public/medicine.php (line 72)](/Users/tyemeclifford/Documents/GH/workout/public/medicine.php:72). Updated catalog/list contexts to use the same helper, including [public/nutrition.php (line 66)](/Users/tyemeclifford/Documents/GH/workout/public/nutrition.php:66). Updated docs/counts in [README.md (line 45)](/Users/tyemeclifford/Documents/GH/workout/README.md:45) and [CHANGELOG.md (line 15)](/Users/tyemeclifford/Documents/GH/workout/CHANGELOG.md:15). Database is updated to 7,646 medicines, with 200 openFDA label-derived use summaries, 8,077 medicine-condition links, and 10,590 medicine-symptom links. Verified: Refreshed openFDA label-use data with scripts/update_medicine_catalog.php 200 openFDA. /medicine.php?id=7644, /medicine.php?id=6, /nutrition.php?q=serdexmethylphenidate, /api.php?action=library_search&q=ADHD&limit=5, and / all returned 200. Confirmed the page shows “What It Is Used For”, “Used for: ...”, and an openFDA label source link. Stock php -l was not available in this workspace, but the FrankenPHP bootstrap and route/API smoke tests executed successfully. Sources used: openFDA drug label fields and openFDA query parameters.
192 lines
10 KiB
PHP
192 lines
10 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require __DIR__ . '/../app/bootstrap.php';
|
|
$pdo = app_db();
|
|
|
|
$pageTitle = 'Medical Terminology Database | Neon Medical Tracker';
|
|
$activePage = 'terminology';
|
|
$searchQuery = trim((string) ($_GET['q'] ?? ''));
|
|
$library = library_search_payload(['q' => $searchQuery, 'limit' => 500]);
|
|
$terms = $library['medicalTerms'];
|
|
$conditions = $library['medicalConditions'];
|
|
$symptoms = $library['medicalSymptoms'];
|
|
$medicines = $library['medicationCatalog'];
|
|
$studies = $library['researchStudies'];
|
|
$totalMedicines = (int) db_value($pdo, 'SELECT COUNT(*) FROM medication_catalog');
|
|
$totalSymptoms = (int) db_value($pdo, 'SELECT COUNT(*) FROM medical_symptoms');
|
|
|
|
require __DIR__ . '/partials/site-header.php';
|
|
?>
|
|
<main>
|
|
<section class="admin-public-shell">
|
|
<div class="site-section-heading">
|
|
<p class="site-eyebrow">Searchable medical library</p>
|
|
<h1>Search symptoms, terms, conditions, medicines, chemical names, and brands.</h1>
|
|
<p>Entries are concise app-authored summaries with links to NIH/NLM systems such as MedlinePlus, RxNorm, DailyMed, PubChem, PubMed, and ClinicalTrials.gov. This is a tracking/reference aid, not medical advice.</p>
|
|
</div>
|
|
|
|
<form class="library-search" method="get" action="/medical.php">
|
|
<label>
|
|
<span>Search medical library</span>
|
|
<input name="q" value="<?= htmlspecialchars($searchQuery, ENT_QUOTES) ?>" placeholder="Try chest pain, rash, Lipitor, blood pressure, CBC, metformin">
|
|
</label>
|
|
<button class="site-primary" type="submit">Search</button>
|
|
<?php if ($searchQuery !== ''): ?>
|
|
<a class="site-secondary" href="/medical.php">Clear</a>
|
|
<?php endif; ?>
|
|
</form>
|
|
|
|
<div class="library-stats" aria-label="Search result counts">
|
|
<article><strong><?= count($medicines) ?></strong><span><?= $searchQuery === '' ? 'medicines shown of ' . number_format($totalMedicines) : 'medicine results' ?></span></article>
|
|
<article><strong><?= count($symptoms) ?></strong><span><?= $searchQuery === '' ? 'symptoms shown of ' . number_format($totalSymptoms) : 'symptom results' ?></span></article>
|
|
<article><strong><?= count($terms) ?></strong><span>terms</span></article>
|
|
<article><strong><?= count($conditions) ?></strong><span>conditions</span></article>
|
|
<article><strong><?= count($studies) ?></strong><span>study links</span></article>
|
|
</div>
|
|
|
|
<?php if (!$conditions): ?>
|
|
<article class="empty-state">
|
|
<h3>No conditions found.</h3>
|
|
<p>Try another medicine, symptom, lab, or tracking term.</p>
|
|
</article>
|
|
<?php else: ?>
|
|
<div class="library-list">
|
|
<?php foreach ($conditions as $condition): ?>
|
|
<article class="library-row">
|
|
<div class="library-row-main">
|
|
<h3><?= htmlspecialchars((string) $condition['name'], ENT_QUOTES) ?></h3>
|
|
<p><?= htmlspecialchars((string) $condition['overview'], ENT_QUOTES) ?></p>
|
|
<div class="library-row-meta">
|
|
<span><?= htmlspecialchars((string) $condition['category'], ENT_QUOTES) ?></span>
|
|
<span><?= htmlspecialchars((string) $condition['source_name'], ENT_QUOTES) ?></span>
|
|
</div>
|
|
</div>
|
|
<div class="library-row-actions">
|
|
<a class="site-primary" href="<?= htmlspecialchars(condition_detail_path($condition), ENT_QUOTES) ?>">View condition</a>
|
|
</div>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</section>
|
|
|
|
<section class="admin-public-shell">
|
|
<div class="site-section-heading">
|
|
<p class="site-eyebrow">Symptoms</p>
|
|
<h2>Symptom reference records</h2>
|
|
</div>
|
|
<?php if (!$symptoms): ?>
|
|
<article class="empty-state">
|
|
<h3>No symptoms found.</h3>
|
|
<p>Try a body system, symptom name, sign, or tracking phrase.</p>
|
|
</article>
|
|
<?php else: ?>
|
|
<div class="library-list">
|
|
<?php foreach ($symptoms as $symptom): ?>
|
|
<article class="library-row">
|
|
<div class="library-row-main">
|
|
<h3><?= htmlspecialchars((string) $symptom['name'], ENT_QUOTES) ?></h3>
|
|
<p><?= htmlspecialchars((string) $symptom['plain_language_description'], ENT_QUOTES) ?></p>
|
|
<div class="library-row-meta">
|
|
<span><?= htmlspecialchars((string) $symptom['category'], ENT_QUOTES) ?></span>
|
|
<span><?= htmlspecialchars((string) ($symptom['body_system'] ?: 'Symptom'), ENT_QUOTES) ?></span>
|
|
</div>
|
|
</div>
|
|
<div class="library-row-actions">
|
|
<a class="site-primary" href="<?= htmlspecialchars(symptom_detail_path($symptom), ENT_QUOTES) ?>">View symptom</a>
|
|
</div>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</section>
|
|
|
|
<section class="admin-public-shell">
|
|
<div class="site-section-heading">
|
|
<p class="site-eyebrow">Terminology</p>
|
|
<h2>Plain-language medical terms</h2>
|
|
</div>
|
|
<?php if (!$terms): ?>
|
|
<article class="empty-state">
|
|
<h3>No terms found.</h3>
|
|
<p>Try a broader medical word, lab name, symptom, or abbreviation.</p>
|
|
</article>
|
|
<?php else: ?>
|
|
<div class="library-list">
|
|
<?php foreach ($terms as $term): ?>
|
|
<article class="library-row">
|
|
<div class="library-row-main">
|
|
<h3><?= htmlspecialchars((string) $term['term'], ENT_QUOTES) ?></h3>
|
|
<p><?= htmlspecialchars((string) $term['plain_language_definition'], ENT_QUOTES) ?></p>
|
|
<div class="library-row-meta">
|
|
<span><?= htmlspecialchars((string) $term['category'], ENT_QUOTES) ?></span>
|
|
<span><?= htmlspecialchars((string) $term['source_name'], ENT_QUOTES) ?></span>
|
|
</div>
|
|
</div>
|
|
<div class="library-row-actions">
|
|
<a class="site-primary" href="<?= htmlspecialchars(term_detail_path($term), ENT_QUOTES) ?>">View term</a>
|
|
</div>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</section>
|
|
|
|
<section class="admin-public-shell">
|
|
<div class="site-section-heading">
|
|
<p class="site-eyebrow">Medication catalog</p>
|
|
<h2>Medicines with chemical, brand, RxNorm, DailyMed, and PubChem links</h2>
|
|
</div>
|
|
<?php if (!$medicines): ?>
|
|
<article class="empty-state">
|
|
<h3>No medicines found.</h3>
|
|
<p>Try a generic name, brand name, chemical name, or medication class.</p>
|
|
</article>
|
|
<?php else: ?>
|
|
<div class="library-list">
|
|
<?php foreach ($medicines as $medicine): ?>
|
|
<article class="library-row">
|
|
<div class="library-row-main">
|
|
<h3><?= htmlspecialchars(ucfirst((string) $medicine['generic_name']), ENT_QUOTES) ?></h3>
|
|
<p><?= htmlspecialchars(medicine_used_for_text($medicine), ENT_QUOTES) ?></p>
|
|
<div class="library-row-meta">
|
|
<span><?= htmlspecialchars((string) ($medicine['class_name'] ?: 'Medication'), ENT_QUOTES) ?></span>
|
|
<span>Active: <?= htmlspecialchars((string) ($medicine['active_ingredient'] ?: $medicine['generic_name']), ENT_QUOTES) ?></span>
|
|
<span>Brands: <?= htmlspecialchars((string) ($medicine['brand_names'] ?: 'Vary by market'), ENT_QUOTES) ?></span>
|
|
</div>
|
|
</div>
|
|
<div class="library-row-actions">
|
|
<a class="site-primary" href="<?= htmlspecialchars(medicine_detail_path($medicine), ENT_QUOTES) ?>">View medicine</a>
|
|
</div>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</section>
|
|
|
|
<section class="admin-public-shell">
|
|
<div class="site-section-heading">
|
|
<p class="site-eyebrow">NIH/NLM study links</p>
|
|
<h2>Research categories connected to the listed medicines</h2>
|
|
</div>
|
|
<div class="term-table">
|
|
<?php foreach ($studies as $study): ?>
|
|
<article>
|
|
<div>
|
|
<h3><?= htmlspecialchars($study['title'], ENT_QUOTES) ?></h3>
|
|
<span><?= htmlspecialchars($study['category'] . ' / ' . $study['related_medicine'], ENT_QUOTES) ?></span>
|
|
</div>
|
|
<p><?= htmlspecialchars($study['summary'], ENT_QUOTES) ?></p>
|
|
<div class="source-links">
|
|
<a href="<?= htmlspecialchars($study['source_url'], ENT_QUOTES) ?>"><?= htmlspecialchars($study['nih_source'], ENT_QUOTES) ?></a>
|
|
<a href="<?= htmlspecialchars($study['pubmed_url'], ENT_QUOTES) ?>">PubMed</a>
|
|
<a href="<?= htmlspecialchars($study['clinicaltrials_url'], ENT_QUOTES) ?>">ClinicalTrials.gov</a>
|
|
</div>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</section>
|
|
</main>
|
|
<?php require __DIR__ . '/partials/site-footer.php'; ?>
|