Repository navigation
FHIR DataTypes
Bahasa / Language: English · Bahasa Indonesia
33 concrete classes plus the abstract DataType base, all in
satusehat_integration/datatype/datatypes.py, re-exported from satusehat_integration.datatype.
from satusehat_integration.datatype import Identifier, HumanName, CodeableConcept, Coding
nik = Identifier(system="https://fhir.kemkes.go.id/id/nik", value="3312345678901234", use="official")
name = HumanName(family="Sitorus", given=["John"], use="official")
gender = CodeableConcept(coding=[Coding(system="http://hl7.org/fhir/administrative-gender", code="male", display="Male")])
nik.to_array() # {'use': 'official', 'system': '…', 'value': '3312345678901234'}-
Keyword arguments in the constructor — every field can be set at construction time;
to_array()produces the FHIR JSON. -
Empty values are dropped:
Noneand""never reach the payload, including inside nested objects. -
No validation.
Identifieraccepts any string invalue; the server decides whether it is a valid NIK. - Not immutable — unlike the Node port, these are ordinary mutable objects. Do not share one instance between two builders and expect independence.
-
to_array(), notto_json(): it returns adict, not a string.json.dumps()is the caller's job.
The field table below stays in English: the field names are English in the FHIR specification, and translating the description while leaving the name would create two vocabularies for one field.
| Class | Constructor parameters (first four) |
|---|---|
Address |
use, type, text, line
|
Age |
value, comparator, unit, system
|
Annotation |
author, text, time
|
Attachment |
contentType, data, url
|
CodeableConcept |
coding, text
|
Coding |
system, code, display, version
|
ContactPoint |
system, value, use, rank
|
Count |
value, comparator, unit, system
|
DataRequirement |
args, kwargs
|
Distance |
value, comparator, unit, system
|
Dosage |
args, kwargs
|
DosageDoseAndRate |
args, kwargs
|
Duration |
value, comparator, unit, system
|
Expression |
language, expression, description
|
Extension |
url, value
|
HumanName |
family, given, use, text
|
Identifier |
system, value, use, type
|
Money |
value, currency
|
Narrative |
status, div
|
ParameterComponent |
name, value_key, value, resource
|
ParameterDefinition |
name, use, min, max
|
Period |
start, end
|
Quantity |
value, comparator, unit, system
|
Range |
low, high
|
Ratio |
numerator, denominator
|
Reference |
reference, display
|
RelatedArtifact |
type, display
|
SampledData |
origin, period, factor, lowerLimit
|
Signature |
args, kwargs
|
SimpleQuantity |
value, unit, system, code
|
Timing |
args, kwargs
|
TimingRepeat |
args, kwargs
|
TriggerDefinition |
type |
33 kelas konkret ditambah kelas dasar abstrak DataType, semuanya di
satusehat_integration/datatype/datatypes.py, dan diekspor ulang dari satusehat_integration.datatype.
from satusehat_integration.datatype import Identifier, HumanName, CodeableConcept, Coding
nik = Identifier(system="https://fhir.kemkes.go.id/id/nik", value="3312345678901234", use="official")
name = HumanName(family="Sitorus", given=["John"], use="official")
gender = CodeableConcept(coding=[Coding(system="http://hl7.org/fhir/administrative-gender", code="male", display="Male")])
nik.to_array() # {'use': 'official', 'system': '…', 'value': '…'}-
Argumen kata kunci di konstruktor — setiap field bisa diisi saat pembuatan objek;
to_array()menghasilkan JSON FHIR. -
Nilai kosong dibuang:
Nonedan""tidak pernah sampai ke payload, termasuk di dalam objek bersarang. -
Tanpa validasi.
Identifiermenerima string apa pun divalue; server yang memutuskan apakah itu NIK yang sah. - Tidak immutable — berbeda dengan port Node, objek di sini bisa diubah. Jangan berbagi satu instance antara dua builder lalu berharap keduanya mandiri.
-
to_array(), bukanto_json(): keluarannyadict, bukan string.json.dumps()urusan pemanggil.
Tabel field di atas sengaja dibiarkan berbahasa Inggris: nama field-nya memang Inggris di spesifikasi FHIR, dan menerjemahkan keterangan sementara namanya tetap akan menciptakan dua kosakata untuk satu field.