medOS Foundation
Scope: Base and master-data models — organizational entities, master catalogs, inventory & stock, QR codes, reporting, and cross-service utilities. Internal scope
ever-api-foundation.
medOS Foundation is the shared substrate the rest of the platform builds on. It owns the master data (companies, manufacturers, vendors, units, product categories, document types) and the reference utilities (data dictionary, keywords, QR codes, report templates, queue sequencing) that nearly every other service reads from. It also hosts the inventory / stock domain — stock items, balances, batches, locations, transactions, and pharmacy purchasing — plus staff scheduling and leave management. Like all medOS backend services it is a NestJS + Moleculer service communicating over NATS; its scope name is ever-api-foundation and it runs as an internal service (no public port).
Responsibilities
- Master data — companies, company types, manufacturers, vendors, units (and unit categories), product categories, item types, document types.
- Inventory & stock — stock items, balances, batches, transactions and logs, returns, requests, store rooms / shelves, barcode and location records.
- Pharmacy procurement — purchase requisitions (PR) and purchase orders (PO) with their audit logs.
- Reference utilities — data dictionary, keywords, QR code generation, report templates and printing logs, queue sequencing.
- Staff operations — staff schedule management, leave requests (and leave types / per-user records), work-time settings.
- Cross-service plumbing — notifications, documents and folders, acknowledgement and co-sign requests, batch scripts, and external sync adapters.
Major modules
| Module | Purpose |
|---|---|
company / companyType | Organizational entities and their classification (master data). |
manufacturer / vendor | Supplier and manufacturer master records. |
unit / unitCategory / productCategory / itemType | Catalog dimensions for products and inventory. |
stockItem / stockBalance / stockBatch | Core inventory: items, on-hand balances, and lot/batch tracking. |
stockTransaction / stockTransactionLogs / stockReturn / stockRequest | Stock movements, audit logs, returns, and requests. |
store / storeRoom / storeShelf / stockLocation / inventoryLocation | Physical storage hierarchy and location records. |
stockBarcodeDepartment / stockBarcodeOpen | Barcode issuance and lookup for stock items. |
pharmacyPR / pharmacyPRLog | Pharmacy purchase requisitions and their change log. |
pharmacyPO / pharmacyPOLog | Pharmacy purchase orders and their change log. |
qrcode / imageQrCode | Server-rendered QR codes keyed by feature discriminator (see below). |
dataDictionary / keyword | Shared reference data and keyword lookup. |
reportTemplate / reportTemplateSize / reportTemplateRelease / reportPrintingLog | Report template management, versioning, and print audit. |
queueSystem / queueSystemSequence | Queue definitions and sequence generation. |
staffScheduleManagement / listStaffSchedules / workTimeSetting | Staff scheduling and work-time configuration. |
leaveRequest / leaveRequestType / leaveRequestUser | Leave request lifecycle and policy. |
document / documentType / documentFolder / album | Document and media organization. |
notification / notificationRead | Cross-service notifications and read tracking. |
acknowledgementRequest / coSignRequest | Acknowledgement and clinical co-sign request records. |
conference | Conference / multidisciplinary meeting records. |
nhsoToken / nhsoData | NHSO token and reference data for Thai claims integration. |
externalSpecimenDoc / webFormCentralized | External specimen documents and centralized web-form intake. |
batchScript / batchScriptLog | Scheduled batch jobs and their execution logs. |
QR code generation
The qrcode module is one of two QR "centrals" in the platform. It persists a Qrcode record keyed by a QrcodeFeatures discriminator and server-renders the QR image (a data-URL), encoding a reader URL plus the responsible staff member. This is distinct from the client-side, HMAC-token scan/v1 system used for ephemeral wristband / specimen / inventory scans. See the QR architecture notes referenced from the main repository docs for the convergence design.
caller ── POST qrcodes ──▶ foundation/qrcode.service
│ resolve feature → build reader URL
│ render image (data-URL)
▼
Qrcode record (Mongo) ──▶ qrcodeImage returned to caller
Integration notes
- Transport: all actions are exposed over the Moleculer service mesh on NATS under the
ever-api-foundationscope; callers reach them via the API Gateway. - External sync: several modules ship an Odoo sync companion (
*OdooSync.service.tsforstockItem,stockBalance,store,unit,inventoryLocation, etc.) for ERP inventory mirroring. - Read models: inventory and stock changes feed the Supabase realtime read-model cache used by frontend dashboards; Foundation remains the system of write-record in MongoDB.
Related
Related catalog items
CP-5— Data DictionaryCP-10— Staff Schedule ManagementCP-12— SMS & Email / Report TemplatesCL-6,CL-7— Queue ManagementRX-7— Pharmacy PO / PR