Lab Results
Route: /lab-results
File: memberportal/src/pages/LabResultsPage.tsx
FHIR Resource: Observation (category: laboratory)
The Lab Results page shows all of the patient's lab test results. It is one of the most feature-rich pages in the portal.
What is displayed​
Each lab result row shows:
- Test name
- Result value + unit
- Reference range (normal range for that test)
- Status badge: Normal, High, Low, or Borderline
- Date of the test
- EHR source badge
Status logic​
Lab status is determined by comparing the result value against the reference range in the FHIR Observation resource:
- High — value is above the high reference range
- Low — value is below the low reference range
- Borderline — value is close to the boundary
- Normal — value is within the reference range
This logic lives in memberportal/src/utils/labUtils.ts.
Filtering and sorting​
Patients can:
- Filter by status tab: All / Normal / High / Low / Borderline (with per-tab counts)
- Filter by date range: Last 30 days / Last 3 months / Last year
- Filter by category (dynamically built from the data — e.g. Chemistry, Hematology)
- Sort by test name, result value, status, or date
- Search by test name
- Change the number of rows shown per page
EHR source is shown via a colour-coded left border on each row (not a dropdown filter).
Trend drawer​
Clicking any row opens a trend drawer showing how that specific test value has changed over time:
- Fetches up to 200
Observationrecords matching the same LOINC code for this patient - Renders a
LineChart(Chart.js) with the value over time - Dashed red reference lines mark the high/low boundaries
- If only one data point exists, a simple "no trend yet" message is shown instead
Patient-mode translations​
When the portal is in patient view mode, test names and status labels are translated into plain language via usePatientTranslate. While translations load, Skeleton placeholders are shown in those columns (TranslatedText, TranslatedBadge).
AI Chat​
- An Ask about Labs icon in the page header opens a
ResourceChatDrawerfor general lab questions. - Each row has an Ask ChartChat column — clicking it opens the drawer pre-loaded with that specific
Observationas context (value, reference range, status, date).
Stat cards​
Three summary cards are shown above the table:
- Total results (and unique test count)
- Out of range (High + Low count, borderline note)
- Within normal range (percentage)
Lab Result Detail​
Route: /lab-results/:resultId
File: memberportal/src/pages/LabResultDetailPage.tsx
Full detail view for a single lab result. Shows all available fields from the Observation resource including:
- Test name and LOINC code
- Result value and units
- Reference range
- Interpretation
- Date and time
- Ordering provider
- EHR source
FHIR query​
GET /fhir/R4/Observation?
patient={patientId}
&_total=accurate
&_sort=-effectiveDateTime
No category=laboratory filter is applied — all Observation resources for the patient are fetched and filtered client-side.