fhir 0.12.0 copy "fhir: ^0.12.0" to clipboard
fhir: ^0.12.0 copied to clipboard

FHIR library of versions R4, STU3, DSTU2, and R5 (draft) for Dart & Flutter.

example/lib/main.dart

//ignore_for_file: always_specify_types, avoid_print
import 'package:fhir/r4.dart';

void main() {
  final patient = Patient(
    fhirId: '12345',
    active: FhirBoolean(true),
    name: <HumanName>[
      const HumanName(
        family: 'Atreides',
        given: ['Paul'],
      ),
    ],
    address: const <Address>[Address(postalCode: '12345')],
    gender: FhirCode('male'),
    birthDate: FhirDate(DateTime(3071, 04, 25)),
  );

  print(patient.toYaml());

  final condition = Condition(
    subject: const Reference(reference: 'Patient/12345'),
    clinicalStatus: CodeableConcept(
      coding: <Coding>[
        Coding(
          system: FhirUri(
              'http://terminology.hl7.org/CodeSystem/condition-clinical'),
          code: FhirCode('active'),
          display: 'Active',
        ),
      ],
    ),
    verificationStatus: CodeableConcept(
      coding: <Coding>[
        Coding(
            system: FhirUri(
                'http://terminology.hl7.org/CodeSystem/condition-ver-status'),
            code: FhirCode('confirmed'),
            display: 'Confirmed')
      ],
    ),
    category: [
      CodeableConcept(
        coding: <Coding>[
          Coding(
            system: FhirUri(
                'http://hl7.org/fhir/us/core/CodeSystem/condition-category'),
            code: FhirCode('health-concern'),
          )
        ],
      )
    ],
    code: CodeableConcept(
      coding: <Coding>[
        Coding(
          system: FhirUri('http://factor.info/sct'),
          code: FhirCode('32911000'),
          display: 'Homeless',
        ),
      ],
      text: 'Homeless (finding)',
    ),
    onsetPeriod: Period(
      start: FhirDateTime(
        DateTime(
          DateTime.now().year - 1,
          DateTime.now().month,
          DateTime.now().day,
        ),
      ),
    ),
  );

  print(condition.toYaml());

  final observation = Observation(
    subject: const Reference(reference: 'Patient/12345'),
    status: FhirCode('final'),
    category: [
      CodeableConcept(
        coding: <Coding>[
          Coding(
            system: FhirUri(
                'http://hl7.org/fhir/us/core/CodeSystem/condition-category'),
            code: FhirCode('social-history'),
            display: 'Social History',
          )
        ],
      ),
      CodeableConcept(
        coding: <Coding>[
          Coding(
            system: FhirUri(
                'http://hl7.org/fhir/us/core/CodeSystem/condition-category'),
            code: FhirCode('survey'),
            display: 'Survey',
          )
        ],
      ),
    ],
    code: CodeableConcept(
      coding: <Coding>[
        Coding(
          system: FhirUri('http://loinc.org'),
          code: FhirCode('LA19952-3'),
          display: 'At risk',
        ),
      ],
      text: 'Food insecurity risk [HVS]',
    ),
    effectivePeriod: Period(
      start: FhirDateTime(
        DateTime(
          DateTime.now().year - 1,
          DateTime.now().month,
          DateTime.now().day,
        ),
      ),
    ),
    valueCodeableConcept: CodeableConcept(
      coding: <Coding>[
        Coding(
          system: FhirUri('http://loinc.org'),
          code: FhirCode('LA17956-6'),
          display: 'Unemployed',
        ),
      ],
      text: 'Unemployed',
    ),
  );

  print(observation.toYaml());
}
37
likes
150
pub points
90%
popularity

Publisher

verified publisherfhirfli.dev

FHIR library of versions R4, STU3, DSTU2, and R5 (draft) for Dart & Flutter.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

freezed_annotation, intl, json_annotation, uuid, xml2json, yaml

More

Packages that depend on fhir