Implementation plan · built from a 7-agent deep analysis of the LIS module · 2026-06-19 · status: AWAITING APPROVAL
Seven parallel agents mapped catalogs, settings, financial wiring, machines, people, the existing setup infra, and the investigation entity. Summary of what needs setup and how it behaves today:
| Area | Seeded today? | Blocks day-1? | Belongs on setup screen |
|---|---|---|---|
| Lab identity (name, logo, contact, license) | No (empty) | name recommended | Yes — step 1 |
| Reference catalogs — sections(13), specimen types(12), units(33), specialties(16), deferral reasons(10), histo templates(16) | Seeders exist but NOT in installer → may be empty on fresh install | Yes (sections/specimen/units) | Yes — verify/seed + light customize |
GL accounts — lis.receivable_account_id, revenue, tax_payable | Auto-wired by my seedDefaultAccountSettings (detail leaves) | Yes | Yes — confirm step (reuse default-accounts) |
| Default price list (+ priced items) | No | Yes — invoices need a default list | Yes — create + bulk-price |
| Investigations (tests) + ranges/panels | NAFIS catalog (1,666) seeded hidden via NafisCatalogSeeder | Yes (need tests to order) | ★ Yes — the headline: import |
| Payment methods / treasuries / banks | 5 method fallbacks; treasuries user-made | No (fallbacks) | Yes — review (optional) |
| Doctors · external labs · insurance | No | No (all optional) | Optional quick-add or defer |
| Analyzers / machines | Device catalog seeded (6 models, 79 tests); machines user-made | No (manual entry works) | Optional "have analyzers? Y/N" |
LabSettingDefinitionSeeder + LabDeviceModelSeeder run in config/moonstack.php → installer.seeders. The catalog seeders (LabSectionSeeder, LabSpecimenTypeSeeder, LabUnitSeeder, LabDoctorSpecialtySeeder, LabDeferralReasonSeeder, LabHistopathTemplateSeeder) are not in the install/update chain — they only run via a manual LISDatabaseSeeder. So a fresh install can land with empty sections/specimen-types/units, which then blocks investigation/request creation. Fix: add them to installer + updater seeders (idempotent), AND let the setup screen verify/seed them on demand. This is the same class as the documented "moonstack-update seeder gap".
/lab-setup, mirroring the existing /setup wizard pattern (setup-wizard.component.ts — 9-step signal-based stepper). REUSE the components that already exist instead of rebuilding:
LisLabInfoComponent (identity / report / barcode / invoice tabs) → identity stepdefault-accounts.config.ts + the Default-Accounts accordion logic → accounts step (LIS section already defined)LisPaymentMethodsComponent + treasuries → payments stepPOST /lis/investigations/import (CSV) + NafisCatalogSeeder → investigations step/setup): lab setup is LIS-specific, large, and must be (a) offered on first run and (b) re-openable anytime from the Lab menu — independent of the global company/accounting setup.
PUT /lis/lab-info.sbscs_code (reuses NafisCatalogSeeder via new POST /lis/investigations/import-standard). Shows progress + summary.POST /lis/investigations/import (cols: name, code, section_code, specimen_code, result_type, unit, price, loinc…).price column we can pre-fill; or flat/percent bulk-set; or per-test). Without a default price list, invoices can't auto-price.lis.receivable_account_id / revenue_account_id / tax_payable_account_id — already auto-wired to detail leaves by seedDefaultAccountSettings; the step just surfaces them with the leaf-only guard (avoids the AR-header trap).AutoAccountService). Has safe fallbacks, so skippable.lis.setup_completed = 1 → go to the Lab dashboard.Modules/LIS/database/data/nafis_catalog.csv (1,666 tests + ranges) via NafisCatalogSeeder. Idempotent by sbscs_code (re-running skips existing — safe). Auto-creates missing sections/categories/specimen types. The CSV path reuses the live ImportInvestigationsJob (skips duplicates by code; no nested ranges/panels — those stay defaults or get set per-test later).NafisCatalogSeeder::seedForCompany() into a reusable service + expose POST /lis/investigations/import-standard { source:"nafis", skip_existing:true } returning {created, skipped, sections_created, ranges_created}. For large runs, dispatch a queued job + poll.
storage/moonstack/installed; FE flag = setup.completed. There is no lab-setup auto-trigger today. Add a lis.setup_completed flag + a GET /lis/setup/status endpoint (returns: has sections? investigations? price list? accounts wired? name set?). On Lab-module entry, if not completed → show a dismissible banner / redirect offering the wizard.nav-items.config.ts, icon pi pi-compass, route /lab-setup, permission lis.settings.manage) so it's reachable anytime — not just first run.| Item | Type | Notes |
|---|---|---|
Add LIS catalog seeders to installer.seeders + updater.seeders | fix gap | Make idempotent (firstOrCreate/updateOrCreate); backfill existing installs on update |
POST /lis/setup/seed-catalogs | new | Run catalog seeders for the company on demand (drives step 2) |
POST /lis/investigations/import-standard | new | Reusable NAFIS service; returns counts; idempotent |
GET /lis/setup/status | new | Drives wizard checklist + first-run detection |
| Bulk price-list create + price endpoint | new/extend | Default list + set prices (flat / from NAFIS / per-test) |
lis.setup_completed definition | new | Add to LabSettingDefinitionSeeder |
| Item | Type |
|---|---|
LabSetupWizardComponent (mirror setup-wizard; signals + stepper/accordion) | new |
Route /lab-setup (+ permission guard) and nav link | new |
i18n keys LAB_SETUP.* in en.json + ar.json (English-first) | new |
First-run banner/redirect using /lis/setup/status | new |
| Identity / accounts / payments / import steps | reuse existing components |
price بتاع NAFIS تلقائي، ولا تحديد سعر موحّد/نسبة، ولا يدوي لكل تحليل؟ (أرشّح: من NAFIS + إمكانية تعديل جماعي.)hazemdev (moonui) زي المعتاد، ولا ده موديول مناسب نجرّب بيه الـ moonui2 / hazemdev2 المتوازي؟Generated from a 7-agent parallel analysis of the LIS module (catalogs · settings · pricing · machines · people · setup-infra · investigations). All file paths verified against /home/moonui/moon-erp-be/Modules/LIS and /home/moonui/public_html/moon-erp. Nothing built yet — this is the plan for review.