Aidbox
Search
⌃K

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.

Skip validation of references in resource using 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
box_features_validation_skip_reference=true

Usage

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