atomic-ehr-codegen-python-us-core-profiles: doc fix + regenerate fhir_types (codegen canary)#37
Merged
Merged
Conversation
…ion name to client: "fhirpy" The README and post.py docstring referenced `fhirpyClient: true`, but the current @atomic-ehr/codegen API (and this example`s generate.ts) use `client: "fhirpy"`. Update the three references to match.
…pes with @atomic-ehr/codegen canary Regenerated with @atomic-ehr/codegen@0.0.16-canary.20260626094300.e87ff88. Canary changes: concrete resources type resourceType as `str` (pattern still fixes the value) instead of `Literal[...]`, abstract base types (Resource, DomainResource) no longer carry a resourceType default, and FhirpyBaseModel guards against PydanticUndefined so it does not register a class-level resourceType for those abstract types. Verified: mypy clean (35 files), load.py / avg.py run, and post.py round-trips a transaction against a local Aidbox with typed read-back.
…ofile-typing fix, drop mypy suppressions Pin @atomic-ehr/codegen to 0.0.16-canary.20260702151019.bdf8485 (atomic-ehr/codegen#192), which makes the generated profile layer type-check under strict mypy. mypy.ini is now plain 'strict = True' + pydantic plugin -- the disable_error_code and strict_optional = False suppressions are no longer needed. Exact pin (no caret): '^0.0.16-canary...' resolves to the older stable 0.0.16, which lacks the fix.
…pes with the profile-typing fix Slice setters use a fresh element variable, extension setters narrow the else branch with assert is_record(value) / assert not isinstance(value, Extension), single-value extension setters are typed as the value model instead of Any, and is_record is a TypeGuard.
…mples For each example: regenerate types from the @atomic-ehr/codegen canary, fail on committed-output drift, typecheck, run the scripts and check their output, then POST the bundle to a licensed Aidbox service container and read it back. Trigger only on changes under the example path or its own workflow file.
…r-types with @atomic-ehr/codegen canary and pin it
…ep install so codegen works on npm 10 (CI) The canonical manager copies the local structure-definitions folder into node_modules then runs npm install for each declared dependency; on npm 10 that prunes the just-copied local package as extraneous, failing with 'Package example.folder.structures not found'. Set FCM_SKIP_LOCAL_DEP_INSTALL=1 to skip the redundant install (hl7.fhir.r4.core comes from hl7.fhir.us.core).
350af93 to
e636c28
Compare
… us.core instead of re-installing it
Use a relative path for the local structure-definitions folder and drop the
explicit hl7.fhir.r4.core dependency. It is already provided by
fromPackage("hl7.fhir.us.core"); re-declaring it made the canonical manager
run `npm install hl7.fhir.r4.core`, which on npm 10 (CI) pruned the just-copied
local package and failed with 'Package example.folder.structures not found'.
Generated types are unchanged; only the README duplicate-count report shifts.
…to 0.0.17 0.0.17 is the stable release of the canary the examples were generated with; regenerated output is identical. CI installs @0.0.17 instead of @canary.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes to
developer-experience/atomic-ehr-codegen-python-us-core-profiles:1. Docs: correct the codegen option name
The README and
post.pydocstring referencedfhirpyClient: true, but the current@atomic-ehr/codegenAPI — and this example's owngenerate.ts— useclient: "fhirpy". Fixed the three stale references.2. Bump codegen to the profile-typing fix + regenerate
fhir_types/Pinned
@atomic-ehr/codegento0.0.16-canary.20260702151019.bdf8485— the build that includes the profile type-checking fix (atomic-ehr/codegen#192) — and regeneratedfhir_types/. The generated profile layer now type-checks under strict mypy:dict→model rebind);elsebranch with a runtime-validatingassert is_record(value)/assert not isinstance(value, Extension);Coding) instead ofAny;is_recordis aTypeGuard[MutableMapping[str, Any]].(Also carries the earlier regeneration changes: concrete resources type
resourceTypeasstrwith the value stillpattern-fixed; abstract base types no longer carry aresourceTypedefault;FhirpyBaseModelguards againstPydanticUndefined.)3. Drop mypy suppressions
mypy.iniis now plainstrict = True+ the pydantic plugin. Previously the generatedfhir_types/tripped ~36 strict-mode errors that were masked withdisable_error_code(plusstrict_optional = False); the codegen fix makes both unnecessary. Optional access in the demo/tests uses ordinary None-guards.Verification (after regeneration)
mypy .→ Success, no issues (35 source files) — strict, no suppressionspython load.py→ writesbundle.json(10 entries)python avg.py→Avg BP: 125.2/82.0 mmHg (n=5)python post.py→ transaction committed against a local Aidbox, observations read back as typedObservationresources