- Implemented the symptom database as a full searchable reference area, parallel to terminology.

Added:
New medical_symptoms SQLite catalog with 242 seeded symptom records, 
categories, body systems, tracking notes, urgency-context notes, search 
terms, and MedlinePlus links: [app/bootstrap.php (line 
186)](/Users/tyemeclifford/Documents/GH/workout/app/bootstrap.php:186), 
[seed logic (line 
635)](/Users/tyemeclifford/Documents/GH/workout/app/bootstrap.php:635)
New searchable symptom directory: [public/symptoms.php (line 
1)](/Users/tyemeclifford/Documents/GH/workout/public/symptoms.php:1)
New dynamic per-symptom page, e.g. /symptom.php?id=24: 
[public/symptom.php (line 
1)](/Users/tyemeclifford/Documents/GH/workout/public/symptom.php:1)
Symptom helper/link lookup functions: [app/bootstrap.php (line 
1473)](/Users/tyemeclifford/Documents/GH/workout/app/bootstrap.php:1473)
medicalSymptoms added to the combined library search/API: 
[app/bootstrap.php (line 
2024)](/Users/tyemeclifford/Documents/GH/workout/app/bootstrap.php:2024)
Symptoms added to nav, homepage, and combined medical search: 
[site-header.php (line 
27)](/Users/tyemeclifford/Documents/GH/workout/public/partials/site-header.php:27), 
[index.php (line 
11)](/Users/tyemeclifford/Documents/GH/workout/public/index.php:11), 
[medical.php (line 
13)](/Users/tyemeclifford/Documents/GH/workout/public/medical.php:13)
This commit is contained in:
Ty Clifford
2026-06-30 16:19:09 -04:00
parent b8045eb068
commit 0d492451c7
14 changed files with 638 additions and 352 deletions
+36 -2
View File
@@ -10,9 +10,11 @@ $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';
?>
@@ -20,14 +22,14 @@ require __DIR__ . '/partials/site-header.php';
<section class="admin-public-shell">
<div class="site-section-heading">
<p class="site-eyebrow">Searchable medical library</p>
<h1>Search terms, conditions, medicines, chemical names, and brands.</h1>
<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 Lipitor, atorvastatin, blood pressure, CBC, metformin">
<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 !== ''): ?>
@@ -37,6 +39,7 @@ require __DIR__ . '/partials/site-header.php';
<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>
@@ -61,6 +64,37 @@ require __DIR__ . '/partials/site-header.php';
<?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>