# Report 4 — field inventory + screen composition (Explore agent, 2026-10-21)
BE=/home/moonui3/moon-erp-be/Modules, FE=/home/moonui3/public_html/moon-erp/src/app/features. DUP = same concept captured in 2+ places.

## A. Patient master
- lab_patients (Clinic Patient → LabPatient, Clinic/app/Models/Patient.php:23; fillable LIS/app/Models/LabPatient.php:49-87): mrn, name/_ar/_en, date_of_birth, gender, phone(+country), email, blood_group, national_id(+type), nationality, passport_country, insurance_info json, medical_history json, important_note, treatment_plan, general_health_note, address(_ar), partner_id, insurance_contract_id, external_lab_id, tax_status, loyalty_points, portal_*, is_active, is_frozen.
- Form rules LIS/app/Support/PatientFormRules.php:63-68 (locked name/gender/phone :50); setting clinic.patient_form_fields {fields:{key:{visible,required}}} (ClinicSettingDefinitionSeeder.php:560); FE registry clinic/config/profile-form-registry.ts:92-110 (identity/contact/clinical groups).
- Registration form clinic/shared/patient-form/clinic-patient-form.component.html:118-126 + dynamic-field-renderer "extra fields" ONLY on edit (history_questions scope=patient category=profile, PatientProfileFieldController.php:44-45) — NO nut_ prefix filter → nut_ profile fields leak to every clinic.
- ClinicProfilePacks.php: obgy (:63-87) marital_status, spouse_name/occupation/national_id, marriage_duration_years, children_sons/daughters; ksa_nphies (:89); quick_reg (:100).

## B. History engine (history_questions: code, labels, input_type, section, department_id, scope patient|encounter, category, is_required, unit, normal/danger ranges, danger_values, is_computed, computed_key; API category history|profile only, vitals seeder-only)
- PresentHistoryQuestionSeeder (7, patient/history): diabetes, hypertension, smoking, prior_surgery, family_history_flag, on_medication, allergies(text).
- ClinicVitalsQuestionSeeder (9, encounter/vitals): weight, height, bmi(computed), bp_sys, bp_dia, pulse, rbg, temp, spo2 with units/thresholds.
- obgy pack 7 patient/profile.
- nut_ (22, ClinicProfilePacks.php:206-261, applied per company): profile 7 (visit_reason, marital_status, job, how_heard, referred_from, club, weight_stabilized); lifestyle 10 (meals_per_day, water_cups, sleep_hours, activity_minutes_week, emotional_eating, night_eating, sweets_craving, previous_diets, gastric_balloon_or_surgery, smoker); women 3 (pregnant, breastfeeding, cycle_regular); meds 2 (supplements, external_medications).
- dent_ (25, :141-202, all companies): patient alerts/chronic 10 (anticoagulant, bleeding, heart, bisphosphonate, radiotherapy, hepatitis, kidney_liver, asthma, epilepsy, pregnant), allergies 3 (penicillin, anesthetic, latex); encounter dental_exam 12 (pain_tooth/type/since/level, swelling, tmj, lymph, soft_tissue, gingiva, hygiene, occlusion, notes).
- Isolation: EncounterHistoryController.php:83-95 hides nut_/dent_ outside their type; FE history panel drops category=vitals (history-panel.component.ts:275).

## C. Vitals — 5 stores
clinical_examinations (encounter, 9 vitals) · patient_history_answers vitals mirror (VitalsService.php:103-109) · patient_vital_entries (patient dated, same 9) · nutrition_body_compositions (patient, no encounter: weight/height/bmi DUP + fat, muscle, visceral, tbw, bmr, metabolic_age, limbs, waist, hip) · hospital_vital_rounds (admission: temp, pulse, bp, rr, spo2, on_oxygen, consciousness, pain, glucose, intake/output, NEWS2). Nutrition reads weight from 3 (PatientNutritionMetrics.php:397-427).

## D. Past history
family_history (DUP family_history_flag), past_medical_history, past_surgical_history (DUP prior_surgery). Header chronic = chronic answers ∪ PMH (PatientReadService.php:156-175). Allergies from 3 sources unioned (:249-275): medical_history json, allergies question, dent_allergy_* flags; 4th nutrition_patient_food_prefs allergen not in header.

## E. Specialty patient-level
Nutrition: nutrition_patient_profiles (activity_level, goal, goal_weight, condition_tag_ids, notes, stopped_*), food_prefs, nut_ answers (reception can fill), contact_logs. Dental: dent_ alerts + core codes (DentalMedicalService.php:23,32); dental_tooth_records baseline; tooth notes/images, plans, ortho_cases (own diagnosis), recalls. Hospital admissions: kind, source, reason, diagnosis text, companion, expected_nights, payer, discharge_summary/instructions, follow_up_on, notes (admit-wizard.component.ts:62-65,161-163). NO triage anywhere.

## F. Visit-level
Shared encounters: chief_complaint, arrived_at, history_snapshot; encounter_complaints; encounter_diagnoses (code, description, is_primary); Rx, lab, rad; encounter-scope answers; NO exam/plan free-text column. Nutrition: patient_diet_plans, visit_adherence, case_notes, body comps (no encounter). Dental: dent_ exam, tooth records today, perio, ortho visits, lab cases. Hospital: MAR, vital rounds, nursing notes, surgery dx pre/post, preauth dx.

## G. Screens (clinic/encounter/consultation.component.html, tabs clinical-types.ts:32-71)
- general `consultation` (131-317): previous visits(133) → vitals(149) → complaint+picks(161-195) → history full(197) → diagnosis(209) → lab/rad(219-270) → Rx(271-285) → nutrition diet-plan panel (287-316 if nutrition module). Order rail right (507-512).
- nutrition `nutrition_measure` (319-336) panel; `nutrition_consult` (338-366) consult board 3 columns: (patient card + read-only vitals, questionnaire, lifestyle, appointments) | (visits & weights, measurements, device sessions, current plan) | (case notes, meds, labs, packages, photos). NO complaint/diagnosis/history panel; Rx/lab/rad as popups (650-683).
- dental `dental_consult` (368-480): alerts → complaint → today → exam → diagnosis → Rx → "more" row: vitals, history patient-only, previous visits. Lab/rad separate (651-660). `dental_chart` (482-505) workspace. Previous visits + vitals FIRST in general, LAST behind toggle in dental. Dental alerts repeat core history codes (DUP UI).
- Patient file (clinic-patient-file.component.html:89-101): consult (embeds nutrition board DUP :105-145), dental workspace (DUP :146), overview profile fields, visits, ledger; history own page patients/:id/history (DUP panel); vitals own page.
- Hospital admission file tabs: bill, nursing, rs, surgery, stays, money, log, discharge.

## H. Who fills
clinic.visit_stations merged|split (default merged, :397): split only changes menu (stations/vitals, stations/sheet; clinic.routes.ts:338-351). clinic.vitals.record, clinic.history.*. Queue chips has_vitals/has_sheet. Reception fills master + profile extras on edit, nutrition questionnaire. NO first-visit/intake flow.

## DUP summary (13)
vitals ×5 · allergies ×4 · chronic ×5 · smoking (smoking vs nut_smoker) · marital (obgy vs nut_) · pregnancy (nut_ vs dent_, patient-level) · medications ×5 · surgery ×3 · family ×2 · goal (nut_visit_reason vs profile.goal) · diagnosis ×5 · complaint (text vs picks) · patient notes ×7.

## Gaps
No intake/first-visit, no triage; visit-type facts stored patient-level (visit_reason, pregnant, lifestyle); nut_ leak into registration; extras not fillable at create; height re-captured each visit ×3; nutrition visits no dx/complaint, body comps no encounter; split stations not enforced; no category=custom.
