Skip to content

Migration: prove one path, describe the rest

SYNTHETIC DATA. This is a migration rehearsal for an illustrative in-house clinical store, not a full EMR. Read the captured migration report and Pass 9 verification receipts before treating any capability below as demonstrated. A missing report, a dry-run, a failed reconciliation or an unexecuted test is not a pass.

Innovare’s roadmap is Allscripts → Ottehr/Oystehr → its own EMR. The proof boundary is: the PoC proves fixtures → illustrative in-house store with verified fidelity; Allscripts export and the Oystehr hop are not executed tonight. That statement is valid only for the captured core run marked PASS, its manifest and its declared field coverage. It does not certify a real source export or clinical readiness.

The canonical report was captured from the real in-house run at artifacts/migration/core3/migration-report.json: 3,188 created, 0 updated, 0 rejected, 0 conflicted; 10 patients; 48 identical risk flags. Counts are 10 Patient, 281 Encounter, 2,582 Observation, 87 Condition, 3 AllergyIntolerance, 113 Immunization and 112 MedicationRequest. Independent reconciliation passed, lakehouse parity passed, and the negative control caught exactly 2/2 deliberate changes with flag parity broken. The report records 673 external reference occurrences and the semantically unmapped paths; those are disclosed limitations, not silently discarded fields. The frozen evaluation instant is 2026-11-12T12:00:00Z and rule version is way1-risk-2026-11-12-v1. See VERIFY for the separate repeat/resume/test receipts.

The fixtures stand in for Allscripts. A real source adapter would use the Allscripts Unity API or a C-CDA export behind the same IFhirSource contract. Mapping C-CDA to FHIR, obtaining export access, source-specific terminology and resolving identity are separate work. Ottehr is the application; Oystehr is the platform. No live Oystehr read or write is needed to prove this core.

Roadmap, not an executed cutover

Allscripts ── PLANNED ──> Ottehr / Oystehr ── PLANNED ──> in-house EMR
    │                                                    ▲
    └── fixtures stand in for this source                 │
                                                         │
Rehearsal                                                │
Synthea / Ottehr fixture inputs                           │
    └── immutable manifest ──> illustrative SQLite store ──┘
                                  │
                                  └── committed read-back → FHIR → reconcile
                                                               → same RiskEngine

Clinical content comes from the committed Synthea and Ottehr samples, with provenance in data/fixtures/SOURCE.md and data/fixtures/ottehr/SOURCE.md. Synthetic does not mean that a captured graph is complete: unresolved dependencies must be listed and rejected. A partial export is never repaired by inventing a patient, encounter or clinical answer. The manifest and failed-id list define the actual accepted and rejected scope; a complete success requires zero rejects and zero conflicts.

The successful core run uses the self-contained Synthea fixture set, bound to source identity fixtures-synthea-v1. The Ottehr QuestionnaireResponse sample references an Encounter/InsurancePlan outside its captured set; it is exercised as a rejection/coverage case, not silently added to the successful migration. The store models QuestionnaireResponse and IntakeAnswer, but the canonical counts above do not claim a successful Ottehr graph migration. A real Ottehr export must first provide a complete, supported dependency graph.

What runs where

Tool Its lane What it does not prove
EF Core migrations Deterministic target DDL, constraints and schema history for InHouseStoreDbContext. EF migrations are not ETL, source mapping or a reconciliation plan.
CLI, manifest and checkpoints Repeatable export, ordered load, resume binding, independent reconciliation and redacted receipts. A successful process exit alone is not evidence of field fidelity; the reconciliation gate must pass.
Aspire Reproducible local rehearsal stack and telemetry. The existing local HAPI is optional. No production deployment, real-system integration or clinical cutover.
cdktn Repeatable Azure target provisioning. Existing infrastructure work is synth-only here; a future target would provision a managed SQL database, private access, identity, secrets and telemetry. No new resources, deployment or cutover is executed by this pass.

The local target is inhouse-store.db. SQLite tables use the emr_ prefix. SQLite ignores schemas; HasDefaultSchema("emr") applies only when the provider is SQL Server. SQLite tests do not validate SQL Server types, concurrency, migrations, performance or deployment. The SQL Server target needs its own provider migrations and integration tests before use.

The repeatable migration pattern

  1. Freeze the input. Read the selected source set into an immutable manifest containing resource type, synthetic id, source version, content SHA-256 and dependency references. A resume binds to the same manifest hash, target identity and mapper version. Changing any of them fails; it is a new migration, not a resume.
  2. Validate the graph. Resolve relative, absolute and fullUrl references. Preserve #contained. Reject unresolved or unsupported references, with a failed synthetic id and an error class. Never silently drop a dependency. Practitioner, Organization and Location are an explicit exception: keep their SourceRef, leave the unmodeled target FK null and count them. That preserves the reference, not the reference-data workflow.
  3. Write in dependency order. Patient first, Encounter second, dependents last. Never merge patients automatically. Identifier collisions and possible duplicates require review.
  4. Check the crosswalk. emr_id_map has a unique (SourceEndpoint, ResourceType, SourceId) key, its TargetId, source version, content hash, mapper version and run id. Equal source version and content hash mean unchanged. The second identical run must have created=0, updated=0, unchanged=N, with no clinical target version changes.
  5. Commit a chunk atomically. In-house target rows, source preservation, crosswalk changes and checkpoint commit in the same database transaction. Clear the EF change tracker after each chunk and disable automatic change detection in the bulk path. There is no legitimate state in which a committed clinical chunk has an uncommitted database checkpoint. The post-commit crash test covers a process dying before its caller observes the durable checkpoint.
  6. Reopen and reconcile. Read the committed normalized store through InHouseStoreSource. Reverse-map it to FHIR; compare it against independent source expectations. Evaluate both through the same Way 1 RiskEngine with the same frozen evaluation date and rule version. Missing clinical facts remain missing.
  7. Report and stop safely. Stop on the first failure unless --continue-on-error is chosen. Any failure still produces a failed-id/error-class receipt and nonzero exit; continuing never turns partial success into PASS.

The id map and checkpoints hold identifiers, hashes and control metadata, never payloads. Preserved OriginalFhirJson and ContentSha256 belong in the separate emr_source_payload table. Independent read-back must not use that source JSON to manufacture a passing result.

Commands and safety boundaries

Run from the repository root:

dotnet run --project src/FhirDemo.Cli -- migrate --from fixtures --to inhouse --dry-run
dotnet run --project src/FhirDemo.Cli -- migrate --from fixtures --to inhouse
dotnet run --project src/FhirDemo.Cli -- migrate --from fixtures --to inhouse
dotnet run --project src/FhirDemo.Cli -- migrate --from fixtures --to inhouse --resume

--dry-run means zero target mutations: no schema creation, checkpoint, run row or remote request that writes data. Only local reports are written. --dry-run --apply, unknown source modes and other contradictory flags fail. --from operational is outside this pass.

Local SQLite and a loopback HAPI do not need --apply. The optional HAPI command is:

dotnet run --project src/FhirDemo.Cli -- migrate --from fixtures --to localehr

Only literal hosts localhost, 127.0.0.1 and ::1 are accepted for localehr; other hosts are refused. HAPI receives one transaction Bundle per patient subgraph, including the Patient and its dependents, in deterministic patient/type/id order. A checkpoint identifies the last completed patient. Purely numeric client ids are prefixed with src- and recorded in the crosswalk. Unchanged resources generate no PUT. Updates carry If-Match/ETag and a conflict fails closed.

The secondary loopback HAPI path was also executed: its captured artifacts/migration/hapi/migration-report.json records PASS, 3,188 created, zero updated/rejected/conflicted and identical risk flags. This is a local FHIR transaction-sink rehearsal, not an Oystehr or Allscripts migration. The transaction response contract was captured from that local HAPI. It does not extend the clinical-workflow or production-cutover claims.

The remote checkpoint stores the last completed patient's ordinal in the deterministic sorted patient order, bound to the immutable manifest. The committed RemoteIntent.PatientId identifies the patient explicitly in the same state transaction. This avoids an ambiguous resource-type cursor. A fully unchanged remote run may record new run/checkpoint metadata, but sends no PUT and does not bump remote clinical versions. A failed local checkpoint transaction retains a pending intent; uncommitted crosswalk changes are discarded before the failure is recorded. Resume reads the remote result before deciding whether replay is safe.

For a remote sink, persist the intended operation before sending it. After an uncertain HTTP outcome, read back the target and resolve that intent before any replay. A timeout does not establish whether a transaction committed. A transaction-bundle contract is accepted as captured evidence only when its origin is a real response from the local HAPI; mocked responses do not satisfy that receipt.

OystehrFhirSink is exercised only with mocked HTTP guard/dry-run tests in this pass. No Oystehr apply command is run. Remote access requires explicit environment gates; reads are gated too. Apply requires --apply, a disposable-project flag and an exact matching OYSTEHR_SEED_CONFIRM=I_OWN_THIS_PROJECT:<projectId>. An apply request with a missing or mismatched confirmation fails nonzero before the fake handler sees any request. Without apply authorization, the route is dry-run. Authorization headers are redacted from HTTP logging; no OYSTEHR_* secret values belong in committed appsettings.

Field coverage and loss matrix

Fidelity is assessed per record, not just by row counts. The following matrix distinguishes clinical columns from preserved source and from deliberately unimplemented workflows. The captured report's unmappedElements list is the run-specific loss inventory; an empty list must come from inspection, not a hardcoded claim.

The model uses table-per-type inheritance: emr_resource holds the shared clinical columns, with typed emr_patient, emr_encounter, emr_observation, emr_condition, emr_allergy_intolerance, emr_immunization, emr_medication_request and emr_questionnaire_response tables. BP components live in emr_observation_component; response answers live in emr_intake_answer. emr_reference holds source references and resolved target keys. Other fields use normalized scalar/structure rows in emr_element, with explicit element kind and typed text/number/boolean values. These rows retain structural round-trip fidelity, including empty/null/absent distinctions. They are not a claim that every extension or workflow has a clinical implementation. Semantically unmodeled paths remain in the loss inventory even when their structure is preserved.

Source Target and independent check Boundary / loss to disclose
Resource type, id and meta.versionId Typed row identity plus unique crosswalk; verify source version and content hash. This is a current-state migration, not a full version-history import.
Patient identity and demographics Patient fields and identifier evidence; check values, explicit null versus absent, source precision and duplicate warnings. No automatic patient merge or enterprise master-patient-index decision.
Encounter and patient linkage Encounter fields with Patient FK; dependents retain Patient and, where present, Encounter linkage. References to missing modeled resources reject. A valid id alone does not establish an intact relationship.
Clinical (system, code, display, version) Normalized coding fields; compare all represented coding details. No local-code translation or terminology equivalence is inferred. A code without its system is not an equivalent fact.
Observation quantities Value, unit and precision are separate facts; reverse-map the normalized quantity. No unit conversion, rounding or imputation. Altering a unit must fail reconciliation even if the number is unchanged.
BP systolic and diastolic Explicit ObservationComponent children, including coding and quantity. Do not collapse the panel into one value or silently lose one component.
Effective, occurrence, recorded and authored dates Independently represented clinical dates; compare instant, original offset and FHIR precision. A date-only value is not an invented midnight instant. Effective and recorded dates are not substitutes.
Status and verification status Separate normalized status evidence; reverse-map and compare. Risk eligibility remains the existing rule's decision, not a migration rewrite.
AllergyIntolerance, Immunization and Condition Typed entities, normalized coding/date/status/linkage fields. Preserving these records does not implement clinical workflows.
MedicationRequest Honestly named MedicationRequest entity, order evidence and references. This is not a Medication catalog or a functioning ePrescribing/order-entry system.
QuestionnaireResponse and IntakeAnswer Captured response/answer values with linkage and null/absent distinctions. Questionnaire definitions/versioning and form behavior are separate. An incomplete Ottehr dependency graph must reject rather than invent a visit.
Practitioner, Organization and Location references Preserved SourceRef, nullable unmodeled target FK and report count. The referenced entities and their permissions, credentials and scheduling behavior are not migrated.
#contained, extensions, modifierExtensions and other fields Normalized emr_element scalar/structure rows preserve shape and values; inventory modeled versus semantically unmapped elements explicitly. Structural retention is not proof that an unmodeled clinical field is usable. Unsupported clinical semantics block production acceptance; original JSON alone never establishes fidelity.
meta, narrative text and resource history Source is preserved separately; canonical comparison strips meta and narrative text, while version is independently checked. Narrative rendering, provenance and immutable history are outside this current-state comparison.
Original resource JSON Separate emr_source_payload.OriginalFhirJson and hash. Never used by the independent normalized read-back or as a substitute for mapped clinical fields. This is not an archive of the surrounding HTTP exchange.

Canonical reconciliation parses and serializes FHIR, strips comparison-exempt metadata/narrative, sorts object keys and normalizes instants to UTC while separately checking precision and original offset. It does not compare arbitrary JSON strings, and it does not compare forward-mapper output against itself. Arrays whose order is significant are not casually reordered.

Required independent checks include counts by type, every represented field, zero orphan FKs, correct Patient/Encounter linkage, explicit unmapped elements, duplicate-patient warnings and per-patient risk-flag equality. Both sides go through the same Way 1 mapping and RiskEngine; there is no third rule adapter.

The three required negative tests drop a field, alter a unit and break a reference. Each must fail the report with a nonzero exit. The separate two-change negative control alters one A1c value and nulls one target field; its report must identify exactly those two changes and break flag parity. The successful receipt reads negative control: PASS (caught 2/2). That is a pass for detecting corruption, not a pass for the corrupted migration.

Same pattern, both planes

The Innovare style is OLTP: the in-house store is the proposed system of record replacing Oystehr in hop 3. EF migrations define its database, cdktn provisions its future Azure surroundings, and Aspire reproduces the local rehearsal.

The SSM style is OLAP: the DuckDB lakehouse remains the analytics plane across all hops. The architectural analogy is SSM moving Epic data into a lake; this demonstration does not claim to have executed an Epic migration. Changing the clinical source should not change the meaning of a risk flag.

Clinical source / OLTP                 Analytics / OLAP

Allscripts        [PLANNED] ───────┐
Oystehr           [PLANNED] ───────┤
                                  ├── IFhirSource ── bronze ── silver ── gold
In-house store    [CORE TARGET] ───┘                              risk flags
    │
    └── normalized read-back → reverse-mapped FHIR → same Way 1 RiskEngine

Gate: source flags = committed-store flags = lakehouse gold flags
      frozen evaluation date; frozen rule version; never impute

After the core migration, re-run bronze → silver → gold reading from the in-house store as the source. Compare gold flags against the pre-migration source result per patient. Reusing the original fixture input for both lakehouse runs would not prove that the analytics plane survived the migration. A report whose lakehouse parity is not established must say so.

Outside this FHIR demonstration; requires separate migration or reimplementation

These are proposed accountable roles, not claims that an owner has accepted a delivery date. Real export access and retention obligations must be agreed before a production plan can pass.

Workstream Owner + plan Export access required Destination Validation
Auth/users Identity lead: reprovision identities and invitations. Identity-provider and tenant-admin export rights. New identity provider and application user registry. Sign-in, account linking, disabled users and least-privilege access tests.
Consent directives + enforcement Privacy lead and clinical safety lead: map policy and enforce it. Authorized consent export plus policy/version history. Consent registry and enforcement points. Positive/negative access cases, revocation, scope and effective dates.
Documents/attachments + access controls Document-platform owner: separate blob pipeline. DocumentReference/Binary API and Oystehr Z3 bucket access, with ACLs. Governed object storage and searchable document index. Object hashes, counts, metadata, ownership, ACL-denial tests and sample rendering. None in the synthetic set; the real set will have them.
Scheduling Operations lead: migrate future appointments and resource rules. Scheduling API/export and resource calendars. Scheduling service. Time zones, recurrence, cancellations, double-booking and appointment ownership.
Billing/claims/coverage/AR run-out Revenue-cycle lead: separate financial migration and run-out plan. Billing extracts, payer/coverage contracts and clearinghouse access. Billing platform, coverage registry and retained AR system. Balances, claim states, remittances, payer links and reconciliation totals.
Open orders/ePrescribing Clinical orders lead: reconcile active orders and reauthorize interfaces. Order/eRx export, prescriber rights and vendor agreements. Order management/eRx service. Open/cancelled order reconciliation, signatures, pharmacy routing and duplicate prevention.
Terminology catalogs and local Allscripts codes Terminology lead: version mappings and retain unresolved codes. Licensed catalogs and local-code dictionary exports. Versioned terminology service. Code-system/version coverage, clinician-approved mappings and unknown-code rejection.
Provenance/history Clinical data steward: archive histories and maintain lineage. Version-history and provenance export privileges. Read-only provenance/history archive with source-to-target links. Version ordering, actor/time evidence, hash inventory and retrieval.
Immutable audit / AuditEvent Security and records-retention owners: archive read-only, do not rewrite into clinical tables. AuditEvent, application audit and resource-history exports; retention authorization. Immutable access-controlled archive. Retention, immutability, integrity, legal holds and audited retrieval.
Operational config Platform owner: inventory, recreate and review configuration. Source admin/config export access. Version-controlled target configuration and secret manager. Environment diff, secret isolation, routing and rollback rehearsal.
Zambdas Application owner: port and retest each function. Function source, dependency versions and deployment configuration. Target function/runtime platform. Contract, authorization, timeout, retry and rule-parity tests.
Task/Communication Care-coordination lead: map state and active work. Task/Communication export plus workflow semantics. Target work queues and communications service. Ownership, status, attachments, due dates, notifications and outstanding work.
Questionnaire definitions + versioning Forms owner: version the definitions separately from answers. Questionnaire and form definition/version exports. Versioned form catalog. Answer-to-definition links, branching, required fields and historical rendering.
Practitioner/Organization/Location reference data Provider operations lead: reconcile and provision reference data. Directory exports and identity/credentialing evidence. Target directory and organizational hierarchy. Referential coverage, identifiers, active status and clinician review.
Oystehr RBAC roles/policies + app configs Security/platform owners: redesign permissions and rebuild app registration. Tenant-admin role/policy/config export rights. Target authorization policies, app registrations and secrets. Deny-by-default tests, service identities, privilege boundaries and config inventory.
Subscriptions/webhooks Integration lead: recreate endpoints and event ownership. Subscription inventory and event-delivery configuration. Target event broker/webhook system. Authentication, replay, ordering, deduplication and dead-letter handling.
Lab, eRx and HL7v2 interfaces Integration and clinical operations leads: certify each partner interface. Interface-engine configuration, partner agreements and message access. Target interface engine and partner endpoints. End-to-end acknowledgements, terminology, routing, error recovery and clinical acceptance.
Telehealth Telehealth operations owner: reconnect vendor workflows. Session, appointment and vendor-configuration exports. Target telehealth service. Patient/clinician access, consent, scheduling links and retained artifacts.

Cutover runbook — UNEXECUTED

  1. Write freeze or change capture. Name the owner of every writer and choose a bounded freeze or a verified change stream. Record the last accepted source watermark; account for deletions and late corrections.
  2. Final delta. Export the final bounded delta into a new manifest, preserve its relationship to the initial load, and retry only under the same resume binding. Do not reinterpret an old checkpoint against a changed source.
  3. Reconciliation gate. Require zero unexplained differences, zero orphans, approved duplicate resolution, field/terminology coverage, audit completeness and identical expected rule outcomes. Failed gates keep the source authoritative.
  4. Clinical acceptance. Clinicians and operational owners approve chart samples, active-work continuity, missing-data behavior and the separate workstreams above. Technical parity is necessary but insufficient.
  5. Writer ownership. Explicitly transfer each application/interface to the target, disable old writers, verify routing and monitor acknowledgements. Avoid two uncoordinated systems of record.
  6. Rollback limits for post-cutover writes. A database restore cannot safely undo new prescriptions, messages, billing actions or external events. Define a reverse-delta/compensation process, reconciliation owner and decision window before the first target write. Preserve both histories; never silently discard post-cutover work.

At scale

At 10M+ rows, use typed staging tables + SqlBulkCopy + a carefully constrained MERGE (or separate insert/update statements when safer for the chosen SQL Server version). Keep unique source keys, source hashes, batch manifests and transactional checkpoints. Validate concurrency and rerun semantics against the actual SQL Server provider; SQLite rehearsal timings do not establish throughput. Index and partition for the source access pattern, bound memory, measure transaction-log pressure and back-pressure retries.

FHIR Bulk $export is the right source interface at scale when the vendor supports it. Stream its NDJSON into the same manifest and validation boundary; do not replace reconciliation with file counts. Export permissions, job consistency, deletions, attachments and resource-history coverage still need explicit agreements.

Evidence, contracts and redaction

Each run writes beneath artifacts/migration/. Commit one canonical redacted report under docs/; the UI reads the generated snapshot/migration-report.json copy. Every report carries a SYNTHETIC DATA banner. Public receipts contain counts, synthetic resource ids, hashes, safe field paths/error classes and flag codes/counts only: no names, DOBs, free text, URLs, headers or secrets. The UI displays only approved summary fields and refuses malformed or contradictory evidence.

The quality matrix has migration column D. NUnit + Moq cover the migration; AutoFixture/Bogus are restricted to non-clinical manifest/crosswalk/checkpoint data. Clinical inputs use Synthea/Ottehr fixtures. Stryker covers mapping, crosswalk lookup/upsert, unchanged detection, manifest/resume binding and reconciliation. Its break threshold must be positive and mutant count nonzero; the dropped-field, altered-unit and broken-reference tests must kill mutants. Semgrep and gitleaks cover the migration code and release tree.

Manifest/report contracts must be pinned to captured real runs with an origin comment. HAPI's transaction response contract must come from the local HAPI, when available. CI must load in-house twice, require zero writes on the second run and require reconciliation plus flag parity to pass. See VERIFY.md for actual commands, test totals, mutation receipts, scanner results and any unexecuted gates; this document does not manufacture those receipts.

Security review — Pass 17

The red team stopped migration approval because an omitted flag could write data and request destinations were insufficiently constrained. The fixes below are covered by regression tests, with failing-before/fixed-after receipts under .artifacts/pass17/. These are synthetic, mocked-network checks; no live Oystehr project was written.

Finding Fix Regression test
Missing --apply still wrote SQLite and sent FHIR bundles. Both local EHR and in-house runners require Apply && !DryRun before schema/data/network writes. Omitted apply produces a report without opening the database, including when resume is requested. MissingApplyCreatesDryRunReportWithoutDatabaseOrHttpAsync, MissingApplyCreatesDryRunReportWithoutDatabaseAsync, NoApplyCommandWritesDryRunReportWithoutDatabaseAsync
Resource types, IDs and unresolved references could become request paths. Allowlist mapper-supported types; validate source and target IDs, reject traversal, escape path segments, and enforce the configured scheme/host/port. Every reference must resolve into the prepared ID map before any database or HTTP write. The sink owns a nonredirecting, proxy-disabled production handler so a caller cannot bypass the origin check by injecting a client. UnsafeResourcePathsRejectBeforeDatabaseOrHttpAsync, UnresolvedOrganizationReferenceIsRejectedBeforeAnyHttpAsync, ProductionConstructorOwnsTransportWithoutRedirectsOrProxy
Oystehr confirmation did not sufficiently constrain the destination. The sink owns its nonredirecting handler, permits only https://fhir-api.zapehr.com/r4b, requires exact ordinal I_OWN_THIS_PROJECT: confirmation, and binds every request to the confirmed x-oystehr-project-id. UnapprovedEndpointIsRejectedWithoutHttp, ConfirmedProjectIsBoundToEveryRequestAsync, CallerProjectHeaderMismatchIsRejectedWithoutHttp, TemporaryRedirectIsRejectedWithoutFollowingLocation
Raw transaction responses could leak data and grow without a bound. Transaction/readback bodies are bounded to 1 MiB before parsing; reports retain numeric HTTP status codes rather than remote response content. TransactionResponsePersistsOnlyStatusCodesAsync, OversizedTransactionResponseFailsWithoutRawArtifactAsync, OversizedUnknownLengthReadStopsAtLimitBeforeAnyPostAsync
Numeric and GUID identifiers escaped redaction; integrity failures rewrote their own evidence. Drop diagnostic IDs to REDACTED. Preserve the supplied mapper version, rule version and evaluation date and set FAIL when they disagree with the expected values. NumericAndGuidIdentifiersAreDroppedFromEveryReportArtifact, IntegrityMismatchPreservesOriginalVersionsAndDateAndFailsReport
Multiple unfinished runs could persist. A new EF migration adds a filtered unique unfinished-run slot and an explicit unique intent index on (RunId, PatientId). Previously applied migrations are unchanged. DatabaseRejectsSecondUnfinishedRunAsync, CompletedRunsDoNotBlockNewRunAndDuplicateIntentCannotPersistAsync, NewConstraintUpgradesPreviouslyAppliedSchemaAsync, ResumeValidatesOldSchemaBeforeUpgradeAndPreservesRunAsync

Earlier command transcripts in this document are historical evidence. New write rehearsals require --apply. The full captured local-EHR graph includes out-of-scope references; it now fails preflight until those references are explicitly supported. Tests use a closed subgraph derived from the captured fixtures and separately prove the unresolved graph is rejected.

A 307 test proves that the sink does not follow the redirect or send to its destination. It cannot establish whether the original server processed the first request. SQL Server deployment/concurrency validation and live Oystehr execution remain unperformed.

What I'd say if asked

“Have you migrated Allscripts?” No. The fixtures stand in for it. We prove the target load, independent read-back, reconciliation, restart behavior and analytics continuity for the captured synthetic set. Unity/C-CDA access and mapping are a separate source-adapter engagement.

“Is this your new EMR?” No. It is an illustrative in-house clinical store. The excluded-work table is why a clinical-data load alone is not an EMR replacement.

“How do you know you did not just copy the same mistake twice?” The check reads committed normalized columns, reverse-maps them to FHIR and compares against the source. Corrupting a value, removing a field or breaking a link must fail. Risk parity uses one engine, a frozen date and a frozen rule version.

“What happens after the initial load?” Production needs a bounded delta/CDC contract. A future --since _lastUpdated source option would feed a new manifest, with a watermark, overlap/deduplication and deletion handling. That option is documented, not built in this pass.

“Why not Bulk $export?” It is the right tool at scale where available. The resulting NDJSON feeds the same manifest, mapping and reconciliation pattern. The small fixture proof does not need an asynchronous vendor export service.

“How large is a batch?” In-house batches are bounded transactional chunks. HAPI batches are complete patient subgraphs because splitting by type can break linkage. Tune against payload, memory, server transaction limits and log growth. A patient graph exceeding a server limit needs an explicit strategy and a new test; do not silently split it or retry forever.

“Does SQLite prove our SQL Server deployment?” No. SQLite ignores the emr schema, so this store uses emr_ table names. SQL Server gets HasDefaultSchema("emr") only under that provider and needs independent migration/concurrency/performance validation.

“What if the second run updates every row?” It fails the idempotency bar. Equal source version and hash must skip writes; HAPI must not receive PUT for unchanged data.

“Can we roll back?” The rehearsal can be rerun from its manifest. Production rollback is constrained by post-cutover writes and external effects; the unexecuted cutover runbook requires an explicit compensation plan.