chore: remove DB and binary from repo, add .gitignore to exclude artifacts

This commit is contained in:
2026-02-20 15:28:41 -05:00
parent 5d34942588
commit 63cb2b7b1c
25 changed files with 4376 additions and 421 deletions

238
app/templates/base.html Normal file
View File

@@ -0,0 +1,238 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>FHIR Health Platform</title>
<style>
/* ---- Reset & base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--color-primary: #0062cc;
--color-primary-h: #004fa3;
--color-bg: #f4f6f9;
--color-surface: #ffffff;
--color-border: #dde3ec;
--color-text: #1a2533;
--color-muted: #6b7a99;
--color-patient: #0a7c59;
--color-hcp: #1a5fb4;
--radius: 8px;
--shadow: 0 1px 4px rgba(0,0,0,.08);
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
background: var(--color-bg);
color: var(--color-text);
min-height: 100vh;
display: flex;
flex-direction: column;
}
/* ---- Nav ---- */
header {
background: var(--color-surface);
border-bottom: 1px solid var(--color-border);
padding: 0 24px;
height: 56px;
display: flex;
align-items: center;
justify-content: space-between;
box-shadow: var(--shadow);
}
.brand { font-size: 1.1rem; font-weight: 700; color: var(--color-primary); letter-spacing: -.2px; }
.brand span { color: var(--color-text); font-weight: 400; }
nav a, nav button {
font-size: .875rem;
color: var(--color-muted);
text-decoration: none;
background: none;
border: none;
cursor: pointer;
padding: 6px 12px;
border-radius: 6px;
transition: background .15s, color .15s;
}
nav a:hover, nav button:hover { background: var(--color-bg); color: var(--color-text); }
/* ---- Main layout ---- */
main { flex: 1; padding: 32px 24px; max-width: 960px; margin: 0 auto; width: 100%; }
footer {
text-align: center;
font-size: .75rem;
color: var(--color-muted);
padding: 16px;
border-top: 1px solid var(--color-border);
}
/* ---- Cards ---- */
.card {
background: var(--color-surface);
border: 1px solid var(--color-border);
border-radius: var(--radius);
box-shadow: var(--shadow);
padding: 24px;
margin-bottom: 20px;
}
.card-title {
font-size: .65rem;
font-weight: 700;
letter-spacing: .08em;
text-transform: uppercase;
color: var(--color-muted);
margin-bottom: 16px;
}
/* ---- Badge ---- */
.badge {
display: inline-block;
font-size: .7rem;
font-weight: 600;
letter-spacing: .04em;
text-transform: uppercase;
padding: 3px 10px;
border-radius: 20px;
}
.badge-patient { background: #d1fae5; color: var(--color-patient); }
.badge-practitioner { background: #dbeafe; color: var(--color-hcp); }
/* ---- Detail grid ---- */
.detail-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 12px 20px;
}
.detail-item label {
display: block;
font-size: .72rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: .06em;
color: var(--color-muted);
margin-bottom: 3px;
}
.detail-item p { font-size: .95rem; color: var(--color-text); }
/* ---- User row (header block) ---- */
.user-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.avatar {
width: 52px; height: 52px;
border-radius: 50%;
display: flex; align-items: center; justify-content: center;
font-size: 1.3rem; font-weight: 700; color: #fff;
flex-shrink: 0;
}
.avatar-patient { background: var(--color-patient); }
.avatar-practitioner { background: var(--color-hcp); }
.user-header-info h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 4px; }
/* ---- Buttons ---- */
.btn {
display: inline-block;
padding: 9px 18px;
border-radius: 6px;
font-size: .875rem;
font-weight: 600;
cursor: pointer;
border: none;
transition: background .15s, box-shadow .15s;
text-decoration: none;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-h); }
.btn-outline { background: transparent; color: var(--color-primary); border: 1.5px solid var(--color-primary); }
.btn-outline:hover { background: #e8f0ff; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
/* ---- Empty / hero ---- */
.hero {
text-align: center;
padding: 72px 24px;
}
.hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: 12px; }
.hero p { font-size: 1rem; color: var(--color-muted); max-width: 480px; margin: 0 auto 28px; }
/* ---- Divider ---- */
hr { border: none; border-top: 1px solid var(--color-border); margin: 20px 0; }
/* ---- Utility ---- */
.text-muted { color: var(--color-muted); font-size: .85rem; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
/* ---- FHIR Table ---- */
.fhir-table {
width: 100%;
border-collapse: collapse;
font-size: .9rem;
margin-top: 12px;
}
.fhir-table th {
text-align: left;
padding: 10px 12px;
border-bottom: 2px solid var(--color-border);
color: var(--color-muted);
font-size: .7rem;
text-transform: uppercase;
letter-spacing: .06em;
}
.fhir-table td {
padding: 12px;
border-bottom: 1px solid var(--color-border);
}
.badge-outline {
background: transparent;
border: 1px solid var(--color-border);
color: var(--color-muted);
}
/* ---- Tabs ---- */
.tabs {
display: flex;
border-bottom: 1px solid var(--color-border);
margin-bottom: 16px;
}
.tab-link {
padding: 10px 20px;
cursor: pointer;
border: none;
background: none;
font-size: .875rem;
font-weight: 600;
color: var(--color-muted);
border-bottom: 2px solid transparent;
transition: all .2s;
}
.tab-link:hover {
color: var(--color-primary);
}
.tab-link.active {
color: var(--color-primary);
border-bottom: 2px solid var(--color-primary);
}
</style>
</head>
<body>
<header>
<div class="brand">FHIR <span>Health Platform</span></div>
<nav>
{{block "nav" .}}{{end}}
</nav>
</header>
<main>
{{block "content" .}}{{end}}
</main>
<footer>
FHIR Health Platform &mdash; SMART on FHIR R4
</footer>
{{block "scripts" .}}{{end}}
</body>
</html>

View File

@@ -0,0 +1,335 @@
{{template "base.html" .}}
{{define "nav"}}
<a href="/">Home</a>
<form action="/logout" method="POST" style="display:inline">
<button class="btn btn-danger" type="submit" style="padding:6px 12px;font-size:.875rem;">Logout</button>
</form>
{{end}}
{{define "content"}}
{{/* ---- Practitioner block ---- */}}
{{if .Practitioner}}
<div class="card">
<div class="card-title">Logged-in Clinician</div>
<div class="user-header">
<div class="avatar avatar-practitioner">
{{if .Practitioner.FirstName}}{{slice .Practitioner.FirstName 0 1}}{{end}}{{if .Practitioner.LastName}}{{slice .Practitioner.LastName 0 1}}{{end}}
</div>
<div class="user-header-info">
<h2>
{{if .Practitioner.FirstName}}{{.Practitioner.FirstName}} {{end}}
{{if .Practitioner.MiddleName}}{{.Practitioner.MiddleName}} {{end}}
{{if .Practitioner.LastName}}{{.Practitioner.LastName}}{{end}}
</h2>
{{if eq .Practitioner.Role "practitioner"}}
<span class="badge badge-practitioner">Health Care Practitioner</span>
{{else}}
<span class="badge badge-patient">Patient (Self-Service)</span>
{{end}}
</div>
</div>
<div class="detail-grid">
<div class="detail-item">
<label>Date of Birth</label>
<p>{{formatDate .Practitioner.DOB}}</p>
</div>
<div class="detail-item">
<label>Gender</label>
<p>{{titleCase .Practitioner.Gender}}</p>
</div>
<div class="detail-item">
<label>Email</label>
<p>{{orDash .Practitioner.Email}}</p>
</div>
<div class="detail-item">
<label>FHIR ID</label>
<p class="text-muted">{{.Practitioner.FHIRID}}</p>
</div>
</div>
</div>
{{else}}
<div class="card">
<p class="text-muted">No practitioner context was returned by this EHR. Session not established.</p>
</div>
{{end}}
{{/* ---- Patient block ---- */}}
{{if .Patient}}
<div class="card">
<div class="card-title">Active Patient</div>
<div class="user-header">
<div class="avatar avatar-patient">
{{if .Patient.FirstName}}{{slice .Patient.FirstName 0 1}}{{end}}{{if .Patient.LastName}}{{slice .Patient.LastName 0 1}}{{end}}
</div>
<div class="user-header-info">
<h2>
{{if .Patient.FirstName}}{{.Patient.FirstName}} {{end}}
{{if .Patient.MiddleName}}{{.Patient.MiddleName}} {{end}}
{{if .Patient.LastName}}{{.Patient.LastName}}{{end}}
</h2>
<span class="badge badge-patient">Patient</span>
</div>
</div>
<hr/>
<div class="detail-grid">
<div class="detail-item">
<label>Date of Birth</label>
<p>{{formatDate .Patient.DOB}}</p>
</div>
<div class="detail-item">
<label>Gender</label>
<p>{{titleCase .Patient.Gender}}</p>
</div>
<div class="detail-item">
<label>Email</label>
<p>{{orDash .Patient.Email}}</p>
</div>
<div class="detail-item">
<label>FHIR ID</label>
<p class="text-muted">{{.Patient.FHIRID}}</p>
</div>
<div class="detail-item">
<label>EHR Server</label>
<p class="text-muted">{{.Patient.EHRURL}}</p>
</div>
<div class="detail-item">
<label>Internal ID</label>
<p class="text-muted">{{.Patient.ID}}</p>
</div>
</div>
</div>
{{/* ---- Clinical Data block ---- */}}
<div class="card">
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:12px;">
<div class="card-title" style="margin-bottom:0;">Clinical Data</div>
<div style="display:flex;align-items:center;gap:12px;">
{{if .LatestSync}}
<span class="text-muted" style="font-size:.8rem;">
Last synced: {{formatDateTime .LatestSync.SyncedAt}}
&nbsp;&middot;&nbsp;
{{.LatestSync.ObsCount}} obs &middot; {{.LatestSync.CondCount}} cond &middot; {{.LatestSync.DocCount}} docs
</span>
{{else}}
<span class="text-muted" style="font-size:.8rem;">Never synced</span>
{{end}}
<form action="/dashboard/sync" method="POST" style="display:inline;">
<button class="btn btn-primary" type="submit" style="padding:6px 14px;font-size:.875rem;">
&#x21bb;&nbsp;Sync with EHR
</button>
</form>
</div>
</div>
<div class="tabs">
<button class="tab-link active" onclick="openTab(event, 'observations')">Observations ({{len .Observations}})</button>
<button class="tab-link" onclick="openTab(event, 'conditions')">Conditions ({{len .Conditions}})</button>
<button class="tab-link" onclick="openTab(event, 'notes')">Clinical Notes ({{len .DocumentReferences}})</button>
<button class="tab-link" onclick="openTab(event, 'smart')">SMART Inspector</button>
</div>
<div id="observations" class="tab-content" style="display:block;">
{{if .Observations}}
<table class="fhir-table">
<thead>
<tr>
<th>Date</th>
<th>Code</th>
<th>Value</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{{range .Observations}}
<tr>
<td>{{orDash .EffectiveDate}}</td>
<td>{{orDash .CodeText}}</td>
<td>
{{if .ValueQuantity}}
{{printf "%.4g" (derefFloat64 .ValueQuantity)}} {{.ValueUnit}}
{{else if .ValueString}}
{{.ValueString}}
{{else}}
{{end}}
</td>
<td><span class="badge badge-outline">{{.Status}}</span></td>
</tr>
{{end}}
</tbody>
</table>
{{else}}
<p class="text-muted mt-4">No observations found. Use "Sync with EHR" to pull data.</p>
{{end}}
</div>
<div id="conditions" class="tab-content" style="display:none;">
{{if .Conditions}}
<table class="fhir-table">
<thead>
<tr>
<th>Recorded Date</th>
<th>Code</th>
<th>Clinical Status</th>
<th>Verification</th>
</tr>
</thead>
<tbody>
{{range .Conditions}}
<tr>
<td>{{orDash .RecordedDate}}</td>
<td>{{orDash .CodeText}}</td>
<td>{{titleCase .ClinicalStatus}}</td>
<td>{{titleCase .VerificationStatus}}</td>
</tr>
{{end}}
</tbody>
</table>
{{else}}
<p class="text-muted mt-4">No conditions found. Use "Sync with EHR" to pull data.</p>
{{end}}
</div>
<div id="notes" class="tab-content" style="display:none;">
{{if .DocumentReferences}}
<table class="fhir-table">
<thead>
<tr>
<th>Date</th>
<th>Type</th>
<th>Description</th>
<th>Status</th>
<th>Content</th>
</tr>
</thead>
<tbody>
{{range .DocumentReferences}}
<tr>
<td>{{orDash .Date}}</td>
<td>{{orDash .TypeText}}</td>
<td>{{orDash .Description}}</td>
<td><span class="badge badge-outline">{{orDash .Status}}</span></td>
<td>
{{if .ContentURL}}
<a href="{{.ContentURL}}" target="_blank" rel="noopener noreferrer" style="font-size:.8rem;">View</a>
{{else if .ContentData}}
<span class="text-muted" style="font-size:.8rem;">Inline ({{.ContentType}})</span>
{{else}}
{{end}}
</td>
</tr>
{{end}}
</tbody>
</table>
{{else}}
<p class="text-muted mt-4">No clinical notes found. Use "Sync with EHR" to pull data.</p>
{{end}}
</div>
<div id="smart" class="tab-content" style="display:none;">
<div class="mt-4">
<div class="detail-item mb-4">
<label>FHIR Base URL (ISS)</label>
<p class="text-muted">{{.Session.EHRURL}}</p>
</div>
<div class="detail-item mb-4">
<label>Granted Scopes</label>
<p class="text-muted">{{.Session.Scope}}</p>
</div>
<div class="detail-item mb-4">
<label>Access Token</label>
<code style="word-break: break-all; font-size: 0.75rem; background: var(--color-bg); padding: 8px; border-radius: 4px; display: block;">{{.Session.AccessToken}}</code>
</div>
{{if .Session.IDToken}}
<div class="detail-item mt-4">
<label>ID Token</label>
<code style="word-break: break-all; font-size: 0.75rem; background: var(--color-bg); padding: 8px; border-radius: 4px; display: block;">{{.Session.IDToken}}</code>
</div>
{{end}}
</div>
</div>
</div>
{{/* ---- Raw FHIR resource accordion ---- */}}
{{if .RawPatient}}
<details style="margin-bottom:20px;">
<summary style="cursor:pointer; font-size:.875rem; font-weight:600; color:var(--color-primary); padding:8px 0;">
View Raw FHIR Patient Resource
</summary>
<div class="card" style="margin-top:8px;">
<table style="width:100%;border-collapse:collapse;font-size:.85rem;">
<thead>
<tr style="border-bottom:2px solid var(--color-border);">
<th style="text-align:left;padding:6px 12px 8px;color:var(--color-muted);font-size:.7rem;letter-spacing:.06em;text-transform:uppercase;">Field</th>
<th style="text-align:left;padding:6px 12px 8px;color:var(--color-muted);font-size:.7rem;letter-spacing:.06em;text-transform:uppercase;">Value</th>
</tr>
</thead>
<tbody>
<tr style="border-bottom:1px solid var(--color-border);">
<td style="padding:7px 12px;font-weight:600;">resourceType</td>
<td style="padding:7px 12px;">{{.RawPatient.ResourceTypeField}}</td>
</tr>
<tr style="border-bottom:1px solid var(--color-border);">
<td style="padding:7px 12px;font-weight:600;">id</td>
<td style="padding:7px 12px;">{{.RawPatient.ID}}</td>
</tr>
<tr style="border-bottom:1px solid var(--color-border);">
<td style="padding:7px 12px;font-weight:600;">gender</td>
<td style="padding:7px 12px;">{{.RawPatient.Gender}}</td>
</tr>
<tr style="border-bottom:1px solid var(--color-border);">
<td style="padding:7px 12px;font-weight:600;">birthDate</td>
<td style="padding:7px 12px;">{{.RawPatient.BirthDate}}</td>
</tr>
{{range .RawPatient.Name}}
<tr style="border-bottom:1px solid var(--color-border);">
<td style="padding:7px 12px;font-weight:600;">name ({{.Use}})</td>
<td style="padding:7px 12px;">
{{range .Given}}{{.}} {{end}}{{.Family}}
</td>
</tr>
{{end}}
{{range .RawPatient.Telecom}}
<tr style="border-bottom:1px solid var(--color-border);">
<td style="padding:7px 12px;font-weight:600;">telecom ({{.System}})</td>
<td style="padding:7px 12px;">{{.Value}}</td>
</tr>
{{end}}
{{range .RawPatient.Address}}
<tr style="border-bottom:1px solid var(--color-border);">
<td style="padding:7px 12px;font-weight:600;">address</td>
<td style="padding:7px 12px;">
{{range .Line}}{{.}}, {{end}}{{.City}}{{if .State}}, {{.State}}{{end}} {{.PostalCode}}
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</details>
{{end}}
{{end}}{{/* end if .Patient */}}
{{end}}{{/* end content */}}
{{define "scripts"}}
<script>
function openTab(evt, tabName) {
var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("tab-content");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
tablinks = document.getElementsByClassName("tab-link");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
document.getElementById(tabName).style.display = "block";
evt.currentTarget.className += " active";
}
</script>
{{end}}

13
app/templates/error.html Normal file
View File

@@ -0,0 +1,13 @@
{{template "base.html" .}}
{{define "nav"}}
<a href="/">Home</a>
{{end}}
{{define "content"}}
<div class="hero">
<h1>{{.Code}}</h1>
<p>{{.Message}}</p>
<a class="btn btn-outline" href="/">Go Home</a>
</div>
{{end}}

15
app/templates/index.html Normal file
View File

@@ -0,0 +1,15 @@
{{template "base.html" .}}
{{define "nav"}}
<a href="/">Home</a>
{{end}}
{{define "content"}}
<div class="hero">
<h1>FHIR Health Platform</h1>
<p>A SMART on FHIR-powered platform for secure, context-aware EHR integration. Launch from your EHR to get started.</p>
<a class="btn btn-primary" href="https://launch.smarthealthit.org/?launch_url=http%3A%2F%2Flocalhost%3A8080%2Flaunch" target="_blank" rel="noopener">
Launch with SmartHealthIT Sandbox
</a>
</div>
{{end}}