Skip to content

Commit 1c26a02

Browse files
committed
Update US Core profiles announcement post
1 parent f18ffc2 commit 1c26a02

2 files changed

Lines changed: 22 additions & 16 deletions

File tree

File renamed without changes.

docs/posts/typescript-us-core-profiles-quick.md renamed to docs/posts/2026-03-12-typescript-us-core-profiles-quick.md

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
1-
# `@atomic-ehr/codegen` adds US Core profile support
1+
# `@atomic-ehr/codegen` v0.0.9 — FHIR profile class generation
22

3-
New release of [`@atomic-ehr/codegen`](https://github.com/atomic-ehr/codegen) generates typed profile classes for **US Core IG**. Extensions get a flat, typed API -- no manual `extension[]` wrangling:
3+
Hey @**everyone**!
44

5-
Import a profiled Patient from an API response and read extensions via typed getters:
5+
We're excited to share **[`@atomic-ehr/codegen` v0.0.9](https://github.com/atomic-ehr/codegen/releases/tag/v0.0.9)** — this release adds **FHIR profile class generation** for TypeScript. We demonstrate it on the **[US Core IG](https://www.hl7.org/fhir/us/core/)** package.
6+
7+
Each profile class provides:
8+
9+
- **Slices** -- category and component slices with discriminator values applied automatically
10+
- **Extensions** -- flat API for complex and simple extensions, multi-form setters (flat input, profile instance, raw Extension)
11+
- **Field accessors** -- typed get/set for profiled fields with fluent chaining
12+
- **Fixed values** -- `code`, `meta.profile` auto-set on `create()`
13+
- **Choice types** -- `effective[x]`, `value[x]` with per-branch accessors
14+
- **Factory methods** -- `from()` (validates), `apply()` (stamps), `create()` (builds from typed input)
15+
- **Validation** -- `validate()` returns `{ errors, warnings }` — checks required fields, choice constraints, and must-support field population
16+
17+
---
18+
19+
Let's see some general use cases on the [US Core Patient](https://www.hl7.org/fhir/us/core/StructureDefinition-us-core-patient.html) profile.
20+
21+
## Reading data from a received resource
622

723
```typescript
824
import { USCorePatientProfile } from "./profiles/Patient_USCorePatientProfile";
@@ -11,12 +27,12 @@ import { USCorePatientProfile } from "./profiles/Patient_USCorePatientProfile";
1127
const patient = USCorePatientProfile.from(apiResponse);
1228

1329
patient.getName(); // [{ family: "Smith", given: ["John"] }]
14-
patient.getRace(); // flat input: { ombCategory: { code: "2054-5", ... }, text: "Black or African American" }
30+
patient.getRace(); // { ombCategory: { code: "2054-5", ... }, text: "Black or African American" }
1531
patient.getSex("profile"); // profile instance: USCoreIndividualSexExtensionProfile
1632
patient.getRace("extension"); // { url: ".../us-core-race", extension: [{ url: "ombCategory", ... }, ...] }
1733
```
1834

19-
Apply the profile to a bare resource and populate it -- each extension setter accepts a flat input, a profile instance, or a raw FHIR Extension:
35+
## Building a resource with a profile
2036

2137
```typescript
2238
import type { Extension } from "./fhir-types/hl7-fhir-r4-core/Extension";
@@ -71,16 +87,6 @@ patient.toResource();
7187
// }
7288
```
7389

74-
Each profile class provides:
75-
76-
- **Field accessors** -- typed get/set for profiled fields with fluent chaining
77-
- **Fixed values** -- `code`, `meta.profile` auto-set on `create()`
78-
- **Slices** -- category and component slices with discriminator values applied automatically
79-
- **Choice types** -- `effective[x]`, `value[x]` with per-branch accessors
80-
- **Extensions** -- flat API for complex and simple extensions, multi-form setters (flat input, profile instance, raw Extension)
81-
- **Factory methods** -- `from()` (validates), `apply()` (stamps), `create()` (builds from typed input)
82-
- **Validation** -- `validate()` returns `{ errors, warnings }` — checks required fields, choice constraints, and must-support field population
83-
8490
See the [generate script](https://github.com/atomic-ehr/codegen/blob/main/examples/typescript-us-core/generate.ts) and [example README](https://github.com/atomic-ehr/codegen/blob/main/examples/typescript-us-core/README.md) for setup.
8591

8692
Working examples:
@@ -92,4 +98,4 @@ Working examples:
9298

9399
Feedback welcome on [GitHub](https://github.com/atomic-ehr/codegen).
94100

95-
NPM: [`@atomic-ehr/codegen`](https://www.npmjs.com/package/@atomic-ehr/codegen)
101+
NPM: [`@atomic-ehr/codegen`](https://www.npmjs.com/package/@atomic-ehr/codegen) | [Release v0.0.9](https://github.com/atomic-ehr/codegen/releases/tag/v0.0.9)

0 commit comments

Comments
 (0)