Minimalistic scalable microseconds precise FHIR application server in Elixir.
- Extremely Compact Codebase (<10K LOC)
- Erlang Records Internal Representation (for type-checking and compact footprint)
- Fast (<5ms) JSON Schema
draft-07
Mutual Dependency Validator - FHIR Protocol Version 5.0.0 (204 resource types)
- FHIR Schema Support for R4/R5
- FHIR Terminology (50 code systems)
- HTTP Endpoints
$ mix deps.get
$ iex -S mix
ISO/HL7 27931:2009 application server listening at port: 9234.
JSON Schema: draft-07, FHIR Protocol Version: 5.0.0.
Interactive Elixir (1.12.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>
Validation (ฮผs):
> HL7.Validation.test
...
],
[
{:Person, 1071, "OK"},
{:PlanDefinition, 4544, "OK"},
{:PlanDefinition, 20023, "OK"},
{:Practitioner, 721, "OK"},
{:PractitionerRole, 2167, "OK"},
{:Procedure, 1065, "OK"},
{:ProcedureRequest, 2598, "OK"},
{:Provenance, 2510, "OK"},
{:Quantity, 351, "OK"},
{:Questionnaire, 3633, "OK"},
{:QuestionnaireResponse, 1215, "OK"},
{:Reference, 749, "OK"},
{:Schedule, 876, "OK"},
{:SearchParameter, 4247, "OK"},
{:Sequence, 3199, "OK"},
{:Slot, 879, "OK"},
{:Specimen, 1166, "OK"},
{:Subscription, 554, "OK"},
{:Substance, 690, "OK"},
{:SupplyDelivery, 1278, "OK"},
{:SupplyRequest, 9064, "OK"},
{:Task, 50683, "OK"},
{:TerminologyCapabilities, 3249, "OK"},
{:TriggerDefinition, 1955, "OK"},
{:ValueSet, 1616, "OK"},
{:VisionPrescription, 2435, "OK"}
]
]
Note that List
instance is 64K JSON object.
Note that best possible (fastest) validation at a given platform
can only be achieved with a validation code compiler.
$ curl -X GET "http://localhost:9234/\$meta"
[
{
"parameters": [
{
"name": "return",
"valueMeta": {
"profile": [
"https://hl7.erp.uno/priv/schema/Person.schema.json",
"https://hl7.erp.uno/priv/schema/Patient.schema.json",
"https://hl7.erp.uno/priv/schema/Organization.schema.json",
"https://hl7.erp.uno/priv/schema/Location.schema.json"
],
"security": [
{
"code": "N",
"display": "normal",
"system": "https://hl7.erp.uno/CodeSystem/v4"
}
],
"tag": [
{
"code": "N",
"display": "normal",
"system": "https://hl7.erp.uno/tag/"
}
]
}
}
],
"resourceType": "Parameters"
}
]
$ time curl -X POST "http://localhost:9234/List/\$validate" -d @samples/List/List.json
{
"base": "",
"id": "01111313-long",
"spec": "$validate",
"type": "List",
"verify": {
"code": "success",
"message": "Object conforms to List of R5 schema."
}
}
real 0m0.011s
user 0m0.005s
sys 0m0.000s
- General
- Foundation
- Security
- Terminology
- Administration
- Clinical
- Diagnostic
- Medications
- Financial
- Workflow
Internal data types: instant
, time
, date
, dateTime
, base64binary
, decimal
,
integer64
, boolean
, url
, code
, string
, integer
, uri
, canonical
,
markdown
, id
, oid
, uuid
, unsignedInt
, positiveInt
.
General-purpose types: Address
, Age
, Annotation
, Attachment
,
ContactPoint
, Count
, Distance
, Dosage
, Duration
, Element
,
HumanName
, Identifier
, Meta
, Money
, Period
, Quantity
,
Ratio
, Range
, RatioRange
, Reference
, SampledData
, Timing
.
Infrastructural types: Resource
, DomainResource
, Basic
, Bundle
,
Composition
, List
, Subscription
, Endpoint
, ServiceDefinition
.
Security-sensitive types: Consent
, Permission
, Provenance
, Signature
.
Dictionary-related types: CodeSystem
, ValueSet
, ConceptMap
, NamingSystem
,
Coding
, CodeableConcept
, CodeableReference
, Coding
.
Administrative types: Patient
, RelatedPerson
, Person
, Group
, Practitioner
,
PractitionerRole
, Organization
, Account
, Location
, HealthcareService
,
Endpoint
, Schedule
, Slot
, SpecimenDefinition
, EpisodOfCare
, Encounter
,
EncounterHistory
, Appointment
, Flag
, ObservationDefinition
, NutritionProduct
,
Device
, DeviceDefinition
, DeviceMetric
, DeviceUsage
, DeviceAssociation
.
Clinical data types: Condition
, Procedure
, CarePlan
, Goal
, DetectedIssue
.
Diagnostic data types: Observation
, Specimen
, BodyStructure
.
Medications types: Medication
, MedicationDispense
, MedicationRequest
,
MedicationStatement
, MedicationAdministration
,
Immunization
, ImmunizationEvaluation
, ImmunizationRecommendation
.
Financial data types: Account
, Contract
, Claim
, Enrollment
, Coverage
, PaymentNotice
.
Workflow modeling data types: ActivityDefinition
, Definition
, EventDefinition
,
MessageDefinition
, PlanDefinition
, ObservationDefinition
, ClinicalUse
,
Measure
, OperationDefinition
, Requirements
.
IEx.configure(width: :erlang.element(2, :io.columns))
IEx.configure(inspect: [limit: :infinity])
Low-code schema design suitable for other language implementations. Yes, it is correct, I manually commited and verified 1K files in 1 month.
Language | Package | Files | LOC | Description |
---|---|---|---|---|
Elixir | Xema | 17 | 4536 | JSON Validation |
Elixir | FHIR | 30 | 682 | FHIR HTTP |
JSON | FHIR | 1044 | 143809 | FHIR Schema + R5 Samples suite |
- Namdak Tonpa