e45324fde4
What changed: Rebuilt the Conditions page into a searchable condition database: [public/workouts.php (line 1)](/Users/tyemeclifford/Documents/GH/workout/public/workouts.php:1) Added dynamic condition detail pages, e.g. /condition.php?name=Type%202%20Diabetes or /condition.php?id=2: [public/condition.php (line 1)](/Users/tyemeclifford/Documents/GH/workout/public/condition.php:1) Added condition detail/link lookup helpers: [app/bootstrap.php (line 1680)](/Users/tyemeclifford/Documents/GH/workout/app/bootstrap.php:1680) Expanded the seeded condition catalog to 203 conditions with categories, tracking notes, and MedlinePlus links: [app/bootstrap.php (line 636)](/Users/tyemeclifford/Documents/GH/workout/app/bootstrap.php:636) Updated combined medical search to link conditions internally with “View condition”: [public/medical.php (line 48)](/Users/tyemeclifford/Documents/GH/workout/public/medical.php:48) Updated related records on symptom/term pages to point to condition detail pages. Updated README route docs: [README.md (line 21)](/Users/tyemeclifford/Documents/GH/workout/README.md:21)
73 lines
3.4 KiB
PHP
73 lines
3.4 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require __DIR__ . '/../app/bootstrap.php';
|
|
$pdo = app_db();
|
|
|
|
$pageTitle = 'Condition Database | Neon Medical Tracker';
|
|
$activePage = 'conditions';
|
|
$searchQuery = trim((string) ($_GET['q'] ?? ''));
|
|
$library = library_search_payload(['q' => $searchQuery, 'limit' => 500]);
|
|
$conditions = $library['medicalConditions'];
|
|
$totalConditions = (int) db_value($pdo, 'SELECT COUNT(*) FROM medical_conditions');
|
|
|
|
require __DIR__ . '/partials/site-header.php';
|
|
?>
|
|
<main>
|
|
<section class="admin-public-shell">
|
|
<div class="site-section-heading">
|
|
<p class="site-eyebrow">Condition database</p>
|
|
<h1>Search conditions by name, category, overview, and tracking context.</h1>
|
|
<p>Condition entries are concise reference summaries with MedlinePlus source links. They support tracking and discussion, not diagnosis or treatment decisions.</p>
|
|
</div>
|
|
|
|
<form class="library-search" method="get" action="/workouts.php">
|
|
<label>
|
|
<span>Search conditions</span>
|
|
<input name="q" value="<?= htmlspecialchars($searchQuery, ENT_QUOTES) ?>" placeholder="Try diabetes, asthma, migraine, kidney, depression, arthritis">
|
|
</label>
|
|
<button class="site-primary" type="submit">Search</button>
|
|
<?php if ($searchQuery !== ''): ?>
|
|
<a class="site-secondary" href="/workouts.php">Clear</a>
|
|
<?php endif; ?>
|
|
</form>
|
|
|
|
<div class="library-stats" aria-label="Condition result count">
|
|
<article><strong><?= count($conditions) ?></strong><span><?= $searchQuery === '' ? 'shown of ' . number_format($totalConditions) . ' conditions' : 'condition results' ?></span></article>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="admin-public-shell">
|
|
<div class="site-section-heading">
|
|
<p class="site-eyebrow">Catalog directory</p>
|
|
<h2>Condition records</h2>
|
|
</div>
|
|
|
|
<?php if (!$conditions): ?>
|
|
<article class="empty-state">
|
|
<h3>No conditions found.</h3>
|
|
<p>Try a diagnosis name, body system, symptom, medicine, lab, or tracking phrase.</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>
|
|
</main>
|
|
<?php require __DIR__ . '/partials/site-footer.php'; ?>
|