Sooner or later, a team exchanging FHIR data needs to say more precisely than the base specification what its resources must contain. That means writing profiles, deciding what must support means for each element, and occasionally defining an extension. Done by hand in StructureDefinition JSON, the work is slow and error-prone.
This post is for FHIR engineers and analysts authoring profiles for their own APIs or a partner network. It covers writing profiles in FHIR Shorthand with SUSHI, constraints and slicing, defining must support, deciding when an extension is justified, and publishing with the IG Publisher.
What does authoring your own FHIR profiles involve?
Defining FHIR rules for your API?
Our FHIR integration page covers the profiles, APIs and exchange work we build for health software teams and their partners.
Authoring your own FHIR profiles means writing machine-readable rules that narrow base resources for a use case: which elements are required, which codes are allowed, which slices exist and what must support means, plus any extensions needed. Agnotic Technologies writes these profiles in FHIR Shorthand and publishes them as implementation guides.
Start from existing profiles wherever you can. A profile built on US Core or another published guide inherits its rules, and your partners already know them.
Why write profiles in FHIR Shorthand?
Write profiles in FHIR Shorthand because it states intent in a few readable lines instead of hundreds of lines of StructureDefinition JSON. Reviews become readable diffs, and the compiler catches many mistakes before publishing.
HL7's FHIR Shorthand specification defines FSH as a domain-specific language for defining the FHIR artifacts in implementation guides, names SUSHI as a reference implementation and de facto standard compiler that turns FSH into FHIR artifacts, and notes that FSH and SUSHI are integrated with the HL7 IG Publisher.
- Source: FSH files in version control, one profile or extension per file.
- Compile: SUSHI turns FSH and its configuration into StructureDefinitions, value sets and examples.
- Build: the IG Publisher renders pages, a package and a QA report.
- Validate: the published package is loaded into a validator and checked against real data.
Which constraints should a profile add?
A profile should add only the constraints your use case truly depends on. Every extra rule is one more thing every sender must get right.
- Cardinality: make an element required only when the receiver cannot work without it.
- Bindings: bind codes to a value set, with the strength chosen deliberately.
- Fixed and pattern values: set a category or code system where the profile is about one kind of data.
- Invariants: express rules across elements, such as an end date after a start date.
- Type restrictions: limit choice elements, such as a value that must be a Quantity.
Write a short sentence for each constraint explaining why it exists. Months later, that sentence decides whether a partner's request to relax it is safe.
How does slicing work in practice?
Slicing divides a repeating element into named parts with their own rules, identified by a discriminator. It lets a profile say, for example, that a category list must contain one specific code alongside any others.
- Discriminator: the path and type, such as a pattern on a coding, that tells slices apart.
- Slices: named entries with their own cardinality and fixed or pattern values.
- Rules: open slicing allows other entries; closed slicing allows only the named slices.
- In FSH: a contains statement names the slices, and caret rules set the discriminator.
Prefer open slicing unless closed is essential. Closed slicing breaks as soon as a sender adds a harmless extra code.
What should must support mean in your profile?
Must support should mean exactly what your systems will do with the element, written down in the guide. Without that statement, every implementer guesses.
In HL7 FHIR R4, labeling an element MustSupport means systems that produce or consume the resource shall support it in some meaningful way; the base specification never sets the flag, and a profile that does must make clear exactly what kind of support is required.
- For senders: populate the element when the data exists in the source system.
- For receivers: store it, display it, or use it in processing, stated per element where it differs.
- For missing data: say whether an absent element is allowed or a data-absent reason is expected.
Keep the must support list short. Flagging every element makes the flag meaningless, and implementers start ignoring it on the elements that really matter.
When is an extension justified?
An extension is justified when your use case needs data that no base element or existing published extension can carry. Search the base resource, the core extensions and the guides you build on first.
The HL7 FHIR R4 specification states that there can be no stigma associated with the use of extensions by any application, project or standard, because extensions are what allow the core specification to stay simple, and every extension carries a url that identifies its meaning.
- Reuse first: an existing extension from a published guide beats a new one with the same meaning.
- Simple or complex: one value for a single fact, nested sub-extensions only when parts belong together.
- Context: state which resources or elements the extension may appear on.
- Modifier extensions: avoid unless the data changes the meaning of the resource, because receivers must reject what they do not understand.
Write a definition and an example for every extension you publish. A partner reading only the url and the data type should still understand what a value means.
Publishing with the IG Publisher
Publish with the IG Publisher so partners get human-readable pages, a package their tools can load and a QA report showing the guide's own errors. Treat the QA report as a build gate.
Give the guide a stable canonical URL before anyone implements it, version each release, and keep a change log. Partners need to know which version of a profile a message claims to meet. Read the QA report's warnings too, since many become errors in later publisher versions.
What goes wrong when teams author profiles?
Most problems come from over-constraining or from leaving meaning unwritten. Both push work onto every implementer.
- Required everything: elements made mandatory that real systems cannot always provide.
- Undefined must support: the flag set with no statement of what support means.
- Duplicate extensions: new extensions for data an existing published extension already carries.
- Closed slicing by default: valid messages rejected because of an extra code.
- Moving canonicals: URLs changed after partners have built against them.
Each of these is easier to prevent in review than to undo after release. A reviewer who asks why a rule exists, what support means and whether an extension already exists catches most of them.
A worked example: a home monitoring profile set
A remote monitoring program needs to send blood pressure and weight readings from home devices to several clinics. The team builds on the base vital signs profiles and adds a small set of its own constraints.
In FSH, each profile requires the device reference and the patient, binds the method to a short value set, and slices category to require the vital signs code. A single simple extension records whether the reading was taken during a scheduled check-in.
Must support is defined per element: clinics must store and display the device and method. The guide is published with the IG Publisher, and every release passes the QA report before partners see it.
Who decides what goes into a FHIR profile?
Profiles need clinical, technical and partner owners. Each one decides different things.
- Clinical lead: which data is needed and what each constraint means clinically.
- FHIR analyst: FSH source, slicing, bindings, extensions and the narrative pages.
- Engineering: validation in the API and test data that exercises every profile.
- Partner liaison: change requests, release notes and version communication.
Route every change request through the same place. A request that reaches an engineer directly tends to become a quiet edit, and partners find out when validation fails.
How should profiles be versioned?
Version profiles with the guide, using a release number partners can pin, and keep the canonical URL stable across releases. A message can then name both the profile and the version it claims to meet.
- Patch releases: wording fixes and examples, with no change to what validates.
- Minor releases: new optional elements, slices or extensions that existing data still passes.
- Major releases: tightened rules or removed elements, announced with a migration period.
Keep older releases published. Partners upgrade on their own schedules, and their validators need the version they built against.
Testing profiles against real data
Test profiles by validating real-shaped messages from every sender against the published package. Examples written by the authors pass by design; production data shows where the rules are too strict or too loose.
Run validation in CI on each profile change, keep a set of known-good and known-bad messages, and review every new error before relaxing or tightening a rule.
What are FHIR profiling best practices?
Build on existing profiles, write in FHIR Shorthand, and add only constraints the use case depends on, each with a reason. Prefer open slicing, define must support per element, and reuse extensions before creating new ones.
Publish with a stable canonical URL, gate releases on the IG Publisher QA report, and validate real messages from every sender.
How can Agnotic help author FHIR profiles and IGs?
Agnotic authors FHIR profiles, extensions and implementation guides in FHIR Shorthand, sets up SUSHI and IG Publisher builds, and adds validation to your API and CI pipeline. We keep constraints tied to real use cases and data your partners can send.
Write and publish your FHIR guide with Agnotic
We author profiles and run the builds that keep them valid.
Related reading on Agnotic
FHIR guides, US Core and standards.


