fhir_r5_path 0.7.0 copy "fhir_r5_path: ^0.7.0" to clipboard
fhir_r5_path: ^0.7.0 copied to clipboard

FHIRPath for FHIR R5: the version binding for the model-independent fhirpath engine, with terminology support.

example/main.dart

// Query FHIR R5 resources with FHIRPath using fhir_r5_path.
//
// fhir_r5_path is the R5 binding over the model-independent `fhirpath`
// engine: build a FHIRPathEngine (model-aware via WorkerContext), parse an
// expression once, then evaluate it against any resource. Each evaluation
// returns a List<FhirBase> — FHIRPath always yields a collection.
//
// Run: dart run example/main.dart
// ignore_for_file: avoid_print
import 'package:fhir_r5/fhir_r5.dart';
import 'package:fhir_r5_path/fhir_r5_path.dart';

Future<void> main() async {
  // Create the engine once; parse-once / evaluate-many is the intended use.
  final engine = await FHIRPathEngine.create(WorkerContext());

  final patient = Patient(
    id: 'example'.toFhirString,
    active: true.toFhirBoolean,
    name: [
      HumanName(
        family: 'Rossi'.toFhirString,
        given: ['Mario'.toFhirString],
      ),
    ],
    telecom: [
      ContactPoint(
        system: ContactPointSystem.email,
        use: ContactPointUse.mobile,
        rank: FhirPositiveInt(3),
      ),
    ],
  );

  // Evaluate a handful of expressions against the patient.
  for (final expression in <String>[
    'Patient.active',
    'name.given.first()',
    "name.family = 'Rossi'",
    'telecom.rank > 1',
    "'abcdefg'.endsWith('efg')",
  ]) {
    final result = await engine.evaluate(patient, engine.parse(expression));
    print('$expression  =>  $result');
  }
}
0
likes
160
points
249
downloads

Documentation

API reference

Publisher

verified publisherfhirfli.dev

Weekly Downloads

FHIRPath for FHIR R5: the version binding for the model-independent fhirpath engine, with terminology support.

Homepage
Repository (GitHub)
View/report issues

Topics

#fhir #fhirpath #hl7 #healthcare #interoperability

License

MIT (license)

Dependencies

collection, fhir_node, fhir_path, fhir_r5, http, meta, ucum

More

Packages that depend on fhir_r5_path