Overview
Architecture overview, data models, feature flags, and route map for Lab Forms in livehealth-frontend.
👤 Ritu Kataria📅 Updated: Mar 13, 2026🏷️ feature
livehealth-frontend — Overview
This document covers the frontend implementation of Lab Forms inside the livehealth-frontend repository — the main web application used by lab staff, billing operators, and admin users.
1. Architecture Overview
Lab Forms in livehealth-frontend spans three lifecycle phases:
| Phase | Description | Primary Users |
|---|---|---|
| Configure | Admin creates and manages form configurations (processes, sections, questions) | Lab admins |
| Capture | Forms are filled in during billing / patient registration | Billing staff, phlebotomists |
| View / Edit | Submitted responses are reviewed and, where permitted, corrected | Lab staff, billing supervisors |
For a description of each form type, see the Lab Forms Overview.
2. Core Data Models (TypeScript)
LabFormConfig
Top-level form configuration returned by the config API:
interface LabFormConfig {
id: number;
name: string;
description: string;
icon: string;
process_type: string; // "Bill" | "Test" | "Patient" | ...
form_type: string; // "aoe" | "consent" | "additional_patient_info"
is_disabled: boolean;
requires_pdf_iterations: boolean;
process_code: string;
response_preference: 0 | 1;
ttl?: number;
ttl_mode?: "Day" | "Month" | "Year";
subprocesses: LabFormSection[];
linked_instances?: number[];
}LabFormSection (SubProcess)
interface LabFormSection {
id: number | string; // string for new (UUID), number for existing
name: string;
icon: string;
is_hidden: boolean;
is_disabled: boolean;
is_mandatory: boolean;
for_communication: boolean;
sub_process_code: string;
sequence: number;
questions: LabFormQuestion[];
is_updated?: boolean;
is_new?: boolean;
}LabFormQuestion
interface LabFormQuestion {
id: number | string;
question: string;
question_code: string;
field_type: string;
is_hidden: boolean;
is_disabled: boolean;
is_mandatory: boolean;
allow_skipping: boolean;
allow_prefilling: boolean;
sequence: number;
attributes: QuestionAttributes;
is_updated?: boolean;
is_new?: boolean;
}Question Attribute Interfaces
interface CommonAttributes {
icon?: string;
placeHolder?: string;
readOnly?: boolean;
default_value?: string;
skip_to_conditions?: string; // JSON-serialized array
confirmation_messages?: string; // JSON-serialized array
prefilling_options?: string; // JSON-serialized object
}
interface TextAttributes extends CommonAttributes { max_length?: number }
interface NumberAttributes extends CommonAttributes { min_value?: number; max_value?: number }
interface FloatAttributes extends CommonAttributes { min_value?: number; max_value?: number; max_decimal_places?: number }
interface OptionsAttributes extends CommonAttributes { options: { label: string; value: string }[] }
interface DateAttributes extends CommonAttributes {
dateformat?: string;
allow_past_dates?: boolean;
allow_future_dates?: boolean;
}
interface FileAttributes extends CommonAttributes {
min_number_upload_file?: number;
max_number_upload_file?: number;
allowed_file_types?: string[];
}
interface ConditionalAttributes extends CommonAttributes {
todays_date?: boolean;
requires_confirmation_message?: boolean;
}AOE Runtime Interfaces
interface AOEDetails {
testDetails: TestLevelAOE[] | null; // null = bill-level
forms: AOEProcess[];
}
interface AOEProcess {
id: number;
name: string;
icon: string;
description: string;
subprocesses: AOESubprocess[];
}
interface AOESubprocess {
id: number;
name: string;
icon: string;
questions: LabFormQuestion[];
}
interface TestLevelAOE {
testId: number;
testName: string;
reportId: number;
}3. Feature Flags & Access Control
| Flag | Location | Controls |
|---|---|---|
lab_forms_management | Session | All Lab Form config pages (admin CRUD) |
consent_management | Session | Consent form capturing, consent history tab |
crm_access | Session | Promotion AOE and Store AOE tabs in history |
allow_aoe_edit | Session | Edit AOE button in history values grid |
All flags are checked at the route level and conditionally show/hide menu items and action buttons.
4. Route Map
Admin Configuration Routes
| Path | Component | Description |
|---|---|---|
/admin/lab-form/:formType | LabFormConfiguration | List page — all configs for a form type |
/admin/lab-form/:formType/add | AddEditLabFormConfiguration | Create a new form configuration |
/admin/lab-form/:formType/edit/:configId | AddEditLabFormConfiguration | Edit an existing configuration |
formType is one of: aoe, consent, additional_patient_info.
History / Values Routes
| Path | Component | Description |
|---|---|---|
/lab-form-history/consent | ConsentHistoryNew | Consent status history + form values |
/lab-form-history/aoe | AOEValues | AOE bill/test/promotion/store values |
/lab-form-history/additional-patient-info | PatientInfoValues | Additional patient info values |