Product EngineeringFeaturesLab FormsFrontendlivehealth-frontend

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:

PhaseDescriptionPrimary Users
ConfigureAdmin creates and manages form configurations (processes, sections, questions)Lab admins
CaptureForms are filled in during billing / patient registrationBilling staff, phlebotomists
View / EditSubmitted responses are reviewed and, where permitted, correctedLab 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

FlagLocationControls
lab_forms_managementSessionAll Lab Form config pages (admin CRUD)
consent_managementSessionConsent form capturing, consent history tab
crm_accessSessionPromotion AOE and Store AOE tabs in history
allow_aoe_editSessionEdit 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

PathComponentDescription
/admin/lab-form/:formTypeLabFormConfigurationList page — all configs for a form type
/admin/lab-form/:formType/addAddEditLabFormConfigurationCreate a new form configuration
/admin/lab-form/:formType/edit/:configIdAddEditLabFormConfigurationEdit an existing configuration

formType is one of: aoe, consent, additional_patient_info.

History / Values Routes

PathComponentDescription
/lab-form-history/consentConsentHistoryNewConsent status history + form values
/lab-form-history/aoeAOEValuesAOE bill/test/promotion/store values
/lab-form-history/additional-patient-infoPatientInfoValuesAdditional patient info values

On this page