@extends('layouts.app') @push('styles') @include('dashboard.styles') @endpush @section('content')
Clinic Leader Dr.
NCD program analytics for {{ $clinicLeader }} and stakeholders.
From ncd_pt_registers: one stacked bar per {{ $trendGranularity === 'yearly' ? 'year' : 'month' }} (total cohort). Hover to see segment values.
From the yearly cohort and diagnosis trend in ncd_pt_registers: cumulative cohort counts by diagnosis bucket (HTN only, DM only, Both, No diagnosis).
From ncd_pt_registers: Male/Female stacked cohort counts per {{ $trendGranularity === 'yearly' ? 'year' : 'month' }}.
Based on ncd_pt_registers.visit_Age (5-year bins, ages 1-100)
Latest visit per patient: if outcome is Died/Tout, classify as Exited (not Active).
Otherwise, if Next_Appointment + {{ $ltfuGraceDays }} days is before observe date
({{ $ltfuObserveDate }}), classify as LTFU; else Active.
Patients evaluated: {{ number_format($ltfuPatients) }}.
Per patient and visit sequence ({{ $visitPlanMinYear }} to {{ $visitPlanMaxYear }}): compare the next visit date to prior visit’s Next_Appointment.
Ontime = 0-{{ $onTimeDays }} days, Unplan = early (<0), Late = {{ $onTimeDays + 1 }}-{{ $lateUpperDays - 1 }} days,
LTFU = >={{ $lateUpperDays }} days after appointment, Return to care = later visit after an >={{ $lateUpperDays }} day gap.
Assessed pairs: {{ number_format((int) ($visitPlanSummary['assessed_pairs'] ?? 0)) }}, LTFU pairs: {{ number_format($visitPlanLtfuPairs) }}, return-to-care events: {{ number_format($visitPlanRtcEvents) }}, unique RTC patients: {{ number_format($visitPlanRtcPatients) }}, before {{ $visitPlanMinYear }} (excluded): {{ number_format((int) ($visitPlanSummary['excluded_before_min_year'] ?? 0)) }}, missing Next_Appointment: {{ number_format((int) ($visitPlanSummary['missing_next_appointment'] ?? 0)) }}, no following visit: {{ number_format((int) ($visitPlanSummary['no_following_visit'] ?? 0)) }}.
Return-to-care event: for the same patient, when two consecutive visits are separated by {{ $rtcGapDays }} days or more, the later visit is counted as return to care.
Events: {{ number_format((int) ($rtcSummary['events'] ?? 0)) }}, unique patients: {{ number_format((int) ($rtcSummary['unique_patients'] ?? 0)) }}, pairs under {{ $rtcGapDays }} days: {{ number_format((int) ($rtcSummary['excluded_pairs_under_gap'] ?? 0)) }}.
Hypertension cohort uses ncd_pt_registers.1stHypertension = New/Known.
Baseline BP stage uses register priority 3rdBP -> 2ndBP -> 1stBP.
Last record stage uses the latest valid follow-up bp_raw on or before the observe date, even if that BP is from an earlier year.
Active and LTFU subsets use the same latest appointment +84 day status as the LTFU chart.
Patients without a usable baseline or last-record BP stage are shown as Unavailable so the chart covers the whole cohort.
Cohort patients: {{ number_format((int) ($controlOverall['cohort_patients'] ?? 0)) }}. Comparable pairs: {{ number_format((int) ($controlOverall['paired_patients'] ?? 0)) }}.
Compared results: {!! $formatComparedSummary($controlOverall['direction_summary'] ?? []) !!}
Active cohort: {{ number_format((int) ($controlActive['cohort_patients'] ?? 0)) }}. Comparable pairs: {{ number_format((int) ($controlActive['paired_patients'] ?? 0)) }}.
Compared results: {!! $formatComparedSummary($controlActive['direction_summary'] ?? []) !!}
LTFU cohort: {{ number_format((int) ($controlLtfu['cohort_patients'] ?? 0)) }}. Comparable pairs: {{ number_format((int) ($controlLtfu['paired_patients'] ?? 0)) }}.
Compared results: {!! $formatComparedSummary($controlLtfu['direction_summary'] ?? []) !!}
| Data quality | |
|---|---|
| {{ $row['metric'] ?? '' }} | {{ number_format((int) ($row['value'] ?? 0)) }} |
| Top invalid baseline BP values | |
|---|---|
| {{ $item['value'] ?? '' }} | {{ number_format((int) ($item['count'] ?? 0)) }} |
| None | |
| Top invalid last-record BP values | |
|---|---|
| {{ $item['value'] ?? '' }} | {{ number_format((int) ($item['count'] ?? 0)) }} |
| None | |
The diabetes cohort uses ncd_pt_registers.2nd_Hypertension = New/Known/Know.
Patients are included in this glucose comparison only if their latest 4 follow-up visits on or before the observe date have NCD_Diagnosis = Diabetes or Both.
Baseline glucose uses ncd_pt_registers.1st_tot_Diabetes and 2nd_tot_Diabetes.
When the register diabetes diagnosis is New, Known, or Know and baseline glucose is missing, the chart falls back to the earliest follow-up FBS with a valid FBS_test_date where NCD_Diagnosis is Diabetes or Both.
The latest side uses the latest follow-up on or before the observe date, then scans that patient's prior 1-year follow-up glucose records.
Age is from register visit_Age at baseline, then recalculated at the latest follow-up date.
FBS, RBS, and 2HPP are evaluated within that 1-year window, and HbA1c < 7.5% is included when available within 1 year.
If any available value exceeds the target, the patient is classified as uncontrolled.
Patients without a usable baseline-to-last glucose pair are shown as Unavailable for comparison so the chart covers the whole cohort.
Cohort patients: {{ number_format((int) ($glucoseOverall['cohort_patients'] ?? 0)) }}. Comparable pairs: {{ number_format((int) ($glucoseOverall['paired_patients'] ?? 0)) }}.
Compared results: {!! $formatComparedSummary($glucoseOverall['comparison_summary'] ?? []) !!}
Active cohort: {{ number_format((int) ($glucoseActive['cohort_patients'] ?? 0)) }}. Comparable pairs: {{ number_format((int) ($glucoseActive['paired_patients'] ?? 0)) }}.
Compared results: {!! $formatComparedSummary($glucoseActive['comparison_summary'] ?? []) !!}
LTFU cohort: {{ number_format((int) ($glucoseLtfu['cohort_patients'] ?? 0)) }}. Comparable pairs: {{ number_format((int) ($glucoseLtfu['paired_patients'] ?? 0)) }}.
Compared results: {!! $formatComparedSummary($glucoseLtfu['comparison_summary'] ?? []) !!}
| Data quality | |
|---|---|
| {{ $row['metric'] ?? '' }} | {{ number_format((int) ($row['value'] ?? 0)) }} |
| Top invalid baseline glucose values | |
|---|---|
| {{ $item['value'] ?? '' }} | {{ number_format((int) ($item['count'] ?? 0)) }} |
| None | |
| Top invalid latest 1-year follow-up glucose values | |
|---|---|
| {{ $item['value'] ?? '' }} | {{ number_format((int) ($item['count'] ?? 0)) }} |
| None | |