Implemented operational foundation
AMCDR supports insurer remittance and adjudication, payer exchanges, organisational costing, procurement and stock receipt, analyser work orders and result ingestion, and jurisdiction reporting. Each process stores its status, supporting records, and recovery state in the database.
Where operators work
| Workspace | Capability | Critical gate |
|---|---|---|
| Finance & Insurance → Remittance & organisational costing | PaymentReconciliation import, matching exceptions, posting/reversal, operational cost and overhead pools. | Only validated remittances and approved pools proceed. |
| Resources → Procurement & stock | Supplier, reorder policy, recommendation, requisition, PO, inspection and receipt. | Only accepted quantity from an inspected receipt posts to inventory. |
| Laboratory → Technical details | Instrument, LOINC/UCUM mapping, work order, QC, HL7 v2 ORU and exception reprocessing. | Order, specimen, mapping, duplicate and current-QC checks precede result creation. |
| HMIS Dashboard → Jurisdiction submission | Specification, schema/rule/terminology/FHIR validation, evidence, queue and dispatch. | A failed validation run cannot be submitted. |
Insurer remittance and adjudication
- Verify patient identity, coverage, authorization, account, issued invoice and submitted claim.
- Configure an HTTPS payer endpoint. Store only secret references in AMCDR; keep OAuth credentials, API keys, client certificates and signing keys in deployment secrets.
- Import FHIR R4
PaymentReconciliation, or transform X12 835, EDIFACT or a local file into the canonical request through a certified edge adapter. Preserve the original artifact. - Review claim and line matching. Ambiguous references remain in an exception queue and cannot post.
- Review submitted, allowed, paid, adjustment, denial/remark and patient-responsibility values. The batch cannot allocate more than the received amount.
- A finance administrator posts the validated batch across all matched accounts. Unmatched value remains explicit unapplied cash.
- Correct a posted batch by reversal. The original posting is retained and invoice balances are restored; financial records are never silently overwritten.
The exchange ledger uses idempotency keys, payload hashes, attempts, retry schedules, correlation references and bounded responses. HTTPS, TLS 1.2 or newer, no redirects, optional mTLS/HMAC and secret references are enforced by the outbound transport.
Organisational management costing
Direct and indirect entries retain cost centre, category, type, date, quantity, unit cost, currency and source. Cost pools always begin in draft, then receive an authenticated approval. Drivers such as bed-days, encounters, staff, floor area, machine hours and lab tests allocate shared overhead to target cost centres with an explicit variance.
AMCDR reports clinical-service revenue, direct cost, allocated overhead and margin. The organisation's approved ERP/general ledger remains authoritative for payroll, AP, balanced journals, tax, depreciation, accruals, bank reconciliation, period close and statutory statements. Reconcile AMCDR subledger exports to it.
Procurement and stock replenishment
- Qualify the supplier and configure lead time and payment terms.
- Configure facility/product/unit reorder point, quantity, safety stock and preferred supplier.
- Review replenishment recommendations calculated from posted inventory only.
- Create and submit a requisition; approve it with the configured segregation of duties.
- Create, approve and issue a purchase order linked to that requisition.
- Record accepted/rejected quantities, reason, batch/lot, expiry and delivery evidence.
- Post only an accepted or partially accepted receipt. Posting is one-time and creates the inventory transaction and operational cost provenance.
Laboratory instrument workflow
- Register each analyser or POCT device and control its active, maintenance, out-of-service or retired state.
- Map vendor test codes to governed LOINC, result type, UCUM unit and method/population-appropriate reference ranges.
- Create and dispatch a work order from an existing laboratory order and specimen, preserving placer and filler identifiers.
- Record control results and limits. Failed or expired QC blocks patient-result ingestion under the instrument policy.
- Ingest HL7 v2 ORU (ER7/XML) or canonical result. Unknown order, specimen, mapping, duplicate or QC failure enters the exception queue.
- Correct governing data and reprocess the same message. Clinical verification and finalization remain separate from technical ingestion.
Jurisdiction reporting
Create a versioned specification from the regulator's approved profiles, code systems, ValueSets, measures, schema, rules, endpoint and certification examples. The validation run checks required data, business rules, terminology and configured FHIR profiles and retains structured issues and a payload hash. Only a passed run can be queued. Retried transmissions remain idempotent and preserve acknowledgement or rejection evidence.
Payer and jurisdiction dispatch are disabled by default. Set AMCDR_OUTBOUND_PAYER_EXCHANGE_ENABLED=true or AMCDR_OUTBOUND_JURISDICTION_REPORTING_ENABLED=true only after endpoint certification and change approval.
Failure recovery
| Failure | Required response |
|---|---|
| Payer/report endpoint unavailable | Leave queued for controlled retry; inspect TLS, secret reference and remote status. Never bypass certificate validation. |
| Ambiguous remittance | Resolve the exact claim/invoice/line with an authorized identity before posting. |
| Receipt mismatch | Keep inspection pending or record rejection; do not post unusable stock. |
| Instrument mapping or QC failure | Keep the message in exception, fix mapping/QC and reprocess. Do not clone a manual result to bypass the gate. |
| Report validation failure | Correct source data or publish a new specification version and create a new validation run. |
| Pod/container restart | Persisted queues, attempts, hashes and next-attempt timestamps resume safely without a browser session. |
API and authorization contract
All routes are relative to AMCDR_API_PREFIX and require an authenticated tenant context. Missing tenant context returns 409; insufficient domain authority returns 403. Approval, posting and correction actors come from the authenticated identity rather than client-supplied display text.
| Route family | Governed capability |
|---|---|
/finance/payer-endpoints, /finance/payer-exchanges | Endpoint registration, queue state, retry evidence and dispatch. |
/finance/remittances | PaymentReconciliation import, exception resolution, posting, reversal and FHIR projection. |
/finance/costing/*, /finance/reports/fully-loaded-cost | Drivers, pools, rules, allocation runs, budgets, cost entries and margin reporting. |
/logistics/procurement/* | Suppliers, reorder policies, recommendations, requisitions, purchase orders and goods receipts. |
/lab/instruments/* | Devices, work orders, mappings, QC, result messages, exceptions and governed reprocessing. |
/hmis/reporting/* | Versioned specifications, validation evidence, submission queue and dispatch. |
The generated OpenAPI document for the installed revision is the field-level request and response authority. Compare integrations against it before promotion.
Persistence, tenancy and migration
Alembic revision 0129_enterprise_ops creates 34 tenant-owned tables covering payer/remittance, costing, procurement, laboratory instruments and reporting. Revision 0130_medical_device_integration adds the shared seven-family medical-device gateway. Every table has a non-null tenant_id, forced PostgreSQL row-level security and cross-tenant reference guards. Runtime credentials must be NOSUPERUSER NOBYPASSRLS; the separate migration-owner credential performs schema changes.
alembic current
alembic upgrade head
alembic current # expected: 0130_medical_device_integration
Production application containers keep AMCDR_RUN_MIGRATIONS_ON_STARTUP=false. Back up the database before migration and retain the encrypted WAL/PITR chain through the approved rollback window. After data has been written, a downgrade requires a maintenance window and data-disposition plan.
Worker and secret configuration
AMCDR_OUTBOUND_INTEGRATION_ENABLED=true
AMCDR_OUTBOUND_SCHEDULER_ENABLED=true
AMCDR_OUTBOUND_PAYER_EXCHANGE_ENABLED=false
AMCDR_OUTBOUND_JURISDICTION_REPORTING_ENABLED=false
AMCDR_OUTBOUND_RUNTIME_POLL_SECONDS=30
AMCDR_OUTBOUND_SCHEDULE_PROCESS_LIMIT=20
Run scheduled outbound work in the worker role. The distributed lease prevents multiple replicas from processing the same cycle. Keep the payer and jurisdiction switches disabled until their respective conformance exercises and change approvals pass.
Endpoint records hold only secret_ref. Resolve OAuth, API-key, bearer/basic, mTLS and HMAC material from an approved environment- or file-backed secret store. Never place credentials, private keys, patient payloads or remittance artifacts in Git, ConfigMaps, endpoint records, logs or audit messages.
Monitoring, backup and recovery
Alert on queue depth and age, attempts and errors, remittance exceptions and unapplied value, allocation variance, below-reorder products, receipt discrepancies, QC failure and analyser lag, report-validation failure and acknowledgement delay. Keep identifiers and raw financial, instrument or report payloads out of metric labels and logs.
PostgreSQL is authoritative. Back up it together with installation identity, signing/trust material and any external evidence store; Redis, browser state and OpenSearch are rebuildable. A recovery test must prove the declared RPO/RTO, migration head, RLS, cross-tenant guards, financial and stock reconciliation, exact-once retry behavior and secret resolution.
Release pathways
| Target | Controlled pathway |
|---|---|
| Kubernetes and development Docker | main first passes audits, lint, migration, PostgreSQL acceptance, frontend and documentation builds. The trusted BuildKit runner then publishes an immutable datetime-plus-commit Harbor tag, updates the infrastructure GitOps references, lets Argo CD reconcile and verifies the backend/worker/frontend rollouts before updating development from the same tag. |
| AMCDR VPS | The accepted workflow sends the same complete revision over pinned SSH. The VPS verifies origin/main, deploys from a detached immutable Git worktree, links the protected environment, applies the stable read-only connector override, migrates once with --no-deps -T, recreates stateless application and documentation services, verifies public health and records /opt/amcdr/current-git-revision. |
VPS deployments are serialized and retain prior stateless image IDs for health-failure rollback. Database downgrade is never automatic; continuously delivered migrations must remain backward compatible with the previous application revision.
Do not build a release from the VPS's dirty mutable checkout and do not bypass Harbor TLS verification. See Deployment and Runtime for failure recovery and operator commands.
License and certification boundary
An expired evaluation enters backend-enforced restricted mode: existing patient data, emergency access, approved backup/export and license activation remain available, while normal operational and administrative mutations are denied. Preserve the installation identity volume across container recreation and issue a license to that exact identity through the control plane.
Before go-live, obtain approval for the configured payer mappings, analyser and QC results, regulator submissions, costing and general-ledger reconciliation, supplier and stock controls, security, recovery, and clinical safety.
Production acceptance evidence
- Migrate an empty PostgreSQL database, downgrade one revision and upgrade again.
- Prove missing tenant context and cross-tenant identifiers are rejected.
- Post and reverse one multi-account payer remittance; test ambiguity, duplicate and over-allocation failures.
- Allocate shared cost across multiple cost centres and reconcile source, allocation and variance exactly.
- Complete reorder-to-stock with a partial rejection and prove a repeated receipt post is rejected.
- Prove failed QC/unknown mapping quarantine a result, then reprocess after correction and create exactly one result.
- Prove invalid schema, terminology and FHIR profile cannot queue a jurisdiction report.
- Simulate HTTP 429/500, timeout and TLS errors and inspect persisted retry/evidence controls.
- Test role denials, authenticated actor attribution, backup/restore and worker restart.
- Obtain signed clinical-safety, laboratory, security, finance, procurement, payer and regulator approval before production outbound delivery.