1. Profiles — Binding Resources
One Profile (StructureDefinition) adds constraints on the base FHIR resource — required elements, limited cardinalities, binding terminologies, added extensions.
Profile example using FHIR Shorthand (FSH)
Profile: VNPatient
Parent: Patient
Id: vn-patient
Title: "VN Core Patient Profile"
Description: "Patient profile cho y tế Việt Nam, yêu cầu CCCD, ngày sinh, giới tính"
// Bắt buộc các elements
* identifier 1..* MS
* identifier ^slicing.discriminator.type = #pattern
* identifier ^slicing.discriminator.path = "type"
* identifier ^slicing.rules = #open
* identifier contains
cccd 0..1 MS and
bhyt 0..1 MS
* identifier[cccd].system = "http://cccd.gov.vn" (exactly)
* identifier[cccd].type = http://terminology.hl7.org/CodeSystem/v2-0203#NI
* identifier[cccd].value 1..1
* identifier[bhyt].system = "http://bhxh.gov.vn/bhyt" (exactly)
* identifier[bhyt].type = http://terminology.hl7.org/CodeSystem/v2-0203#SB
* name 1..* MS
* gender 1..1 MS
* birthDate 1..1 MS
// Extension
* extension contains
VNEthnicity named ethnicity 0..1 MS and
VNNationality named nationality 0..1 MS
// Binding
* maritalStatus from http://hl7.org/fhir/ValueSet/marital-status (extensible)
StructureDefinition (JSON)
{
"resourceType": "StructureDefinition",
"url": "http://fhir.vn/StructureDefinition/vn-patient",
"name": "VNPatient",
"title": "VN Core Patient Profile",
"status": "active",
"kind": "resource",
"abstract": false,
"type": "Patient",
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Patient",
"derivation": "constraint",
"differential": {
"element": [
{
"id": "Patient.identifier",
"path": "Patient.identifier",
"min": 1,
"mustSupport": true,
"slicing": {
"discriminator": [
{"type": "pattern", "path": "type"}
],
"rules": "open"
}
},
{
"id": "Patient.identifier:cccd",
"path": "Patient.identifier",
"sliceName": "cccd",
"min": 0,
"max": "1",
"mustSupport": true
},
{
"id": "Patient.identifier:cccd.system",
"path": "Patient.identifier.system",
"fixedUri": "http://cccd.gov.vn"
},
{
"id": "Patient.identifier:cccd.value",
"path": "Patient.identifier.value",
"min": 1
},
{
"id": "Patient.name",
"path": "Patient.name",
"min": 1,
"mustSupport": true
},
{
"id": "Patient.gender",
"path": "Patient.gender",
"min": 1,
"mustSupport": true
},
{
"id": "Patient.birthDate",
"path": "Patient.birthDate",
"min": 1,
"mustSupport": true
}
]
}
}
2. Extensions
Extensions allow adding data that the base FHIR Resource does not have — this is the mechanism extensibility core.
Simple Extension
Extension: VNEthnicity
Id: vn-ethnicity
Title: "Dân tộc Việt Nam"
Description: "Mã dân tộc theo danh mục 54 dân tộc Việt Nam"
Context: Patient
* value[x] only CodeableConcept
* valueCodeableConcept from VNEthnicityVS (required)
{
"resourceType": "Patient",
"extension": [
{
"url": "http://fhir.vn/StructureDefinition/vn-ethnicity",
"valueCodeableConcept": {
"coding": [
{
"system": "http://fhir.vn/CodeSystem/vn-ethnicity",
"code": "01",
"display": "Kinh"
}
]
}
}
]
}
Complex Extension
Extension: VNAddress
Id: vn-address
Title: "Địa chỉ hành chính Việt Nam"
Context: Address
* extension contains
province 1..1 MS and
district 1..1 MS and
ward 0..1 MS
* extension[province].value[x] only CodeableConcept
* extension[province].valueCodeableConcept from VNProvinceVS (required)
* extension[district].value[x] only CodeableConcept
* extension[district].valueCodeableConcept from VNDistrictVS (required)
* extension[ward].value[x] only CodeableConcept
* extension[ward].valueCodeableConcept from VNWardVS (required)
Modifier Extension
Modifier extension change meaning of the element containing it — receivers MUST understand this extension.
{
"resourceType": "AllergyIntolerance",
"modifierExtension": [
{
"url": "http://hospital.vn/fhir/StructureDefinition/allergy-certainty",
"valueCode": "unconfirmed"
}
]
}
3. Slicing
Slicing divides a repeating element (cardinality 0..*) into separate "slices" with different constraints.
* identifier ^slicing.discriminator.type = #pattern
* identifier ^slicing.discriminator.path = "type"
* identifier ^slicing.rules = #open
* identifier ^slicing.ordered = false
* identifier contains
cccd 0..1 MS and // Slice cho CCCD
bhyt 0..1 MS and // Slice cho BHYT
mrn 1..1 MS // Slice cho MRN (bắt buộc)
| Discriminator Type | Description |
|---|---|
| value. value | Distinguished by specific values |
| pattern. pattern | Distinguish using pattern matching |
| type | Differentiate by type (choice types) |
| profile. profile | Distinguish by profile |
| exists | Distinguished by existence |
4. Invariants (FHIRPath Constraints)
Invariant: vn-patient-1
Description: "Phải có ít nhất CCCD hoặc BHYT"
Expression: "identifier.where(system='http://cccd.gov.vn').exists() or identifier.where(system='http://bhxh.gov.vn/bhyt').exists()"
Severity: #error
Invariant: vn-patient-2
Description: "Nếu có CCCD thì phải có 12 chữ số"
Expression: "identifier.where(system='http://cccd.gov.vn').value.matches('^[0-9]{12}$')"
Severity: #error
5. Implementation Guide (IG)
IG is a complete package: profiles, extensions, ValueSets, CodeSystems, examples, narrative documentation.
IG project structure
vn-core-ig/
├── sushi-config.yaml # SUSHI config
├── input/
│ ├── fsh/
│ │ ├── profiles/
│ │ │ ├── VNPatient.fsh
│ │ │ ├── VNEncounter.fsh
│ │ │ └── VNObservation.fsh
│ │ ├── extensions/
│ │ │ ├── VNEthnicity.fsh
│ │ │ └── VNAddress.fsh
│ │ ├── terminology/
│ │ │ ├── VNEthnicityCS.fsh
│ │ │ └── VNEthnicityVS.fsh
│ │ └── examples/
│ │ └── ExamplePatient.fsh
│ └── pagecontent/
│ ├── index.md
│ └── design.md
├── ig.ini
└── _genonce.sh
sushi-config.yaml
id: vn.fhir.core
canonical: http://fhir.vn/ig/core
name: VNCoreIG
title: "Vietnam Core FHIR Implementation Guide"
status: active
version: 0.1.0
fhirVersion: 5.0.0
copyrightYear: 2025+
releaseLabel: ci-build
publisher:
name: Vietnam Health IT Association
dependencies:
hl7.fhir.r5.core: 5.0.0
Build IG
# Install SUSHI
npm install -g fsh-sushi
# Compile FSH → FHIR JSON
sushi .
# Run IG Publisher
./_genonce.sh
# Output: output/ directory with HTML pages
6. US Core and IPS as reference
| IG | Description | Profiles |
|---|---|---|
| US Core | United States, required for the 21st Century Cures Act | Patient, Encounter, Condition, Observation, Medication, ... |
| IPS | International Patient Summary, ISO 27269 | Patient, Medication, Allergy, Problem, Immunization, ... |
| AU Base | Australia | AU Patient, AU Practitioner, ... |
7. Summary
Profile — Resource binding (required elements, binding, cardinality)
Extension — Add data that is not in the base (simple, complex, modifier)
Slicing — Divide repeating elements into slices with separate constraints
Invariants — Business rules using FHIRPath
FSH + SUSHI — DSL language for writing concise profiles/extensions
IG Publisher — Build website documentation from FSH/JSON