Profiling and validation overview
This chapter explains how Profiling works in Aidbox
FHIR resources are very loose in requirements which gives FHIR its flexibility. For example, all elements are optional in the Patient resource, and it's possible to create a Patient resource without any data which does not make much sense. So, sometimes there is a need to constraint resources.
In FHIR, you need to create a StructureDefinition resource and describe the requirements for a resource you want to restrict. And it is definitely not an easy task. There are special tools developed specifically for this.
Aidbox implements two ways of working with profiles: using AidboxProfile resource and with zen-lang schemas.

aidbox-validation-skip request header

aidbox-validation-skip header allows to skip resource reference validations.
The header functionality can be enabled with box_features_validation_skip_reference env.
Example
1
box_features_validation_skip_reference=true
Copied!

Usage

Request without aidbox-validation-skip request header causes an error.
Request
Response
1
PUT /fhir/Observation/f001
2
content-type: text/yaml
3
4
resourceType: Observation
5
id: f001
6
subject:
7
reference: Patient/id-does-not-exist
8
status: final
9
code:
10
coding:
11
- system: http://loinc.org
12
code: 15074-8
Copied!
1
status: 422
2
body:
3
issue:
4
- expression:
5
- Observation.subject
6
diagnostics: Referenced resource Patient/id-does-not-exist does not exist
Copied!
The request is successful when aidbox-validation-skip request header is provided.
Request
Response
1
PUT /fhir/Observation/f001
2
content-type: text/yaml
3
aidbox-validation-skip: reference
4
5
resourceType: Observation
6
id: f001
7
subject:
8
reference: Patient/id-does-not-exist
9
status: final
10
code:
11
coding:
12
- system: http://loinc.org
13
code: 15074-8
Copied!
1
status: 201
2
* body is skipped for simplicity *
Copied!