fhirpath-rb 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9eefe06c5824eee637149d60af147480e36b717e5c6f15d3ad498529b9a2c52c
4
- data.tar.gz: 1a2692a532e82590b309277b0f8a75ea7dff0d95565bda303dcb386303634274
3
+ metadata.gz: 386fdadfc9286fb53c26e7b958d24b794931720c5f289e846290def5f85d032d
4
+ data.tar.gz: e3f288571780f12833b512ad1ca730fd9783534eb93898192d431f21102bb152
5
5
  SHA512:
6
- metadata.gz: 70c7b85868c2ec1cc185674a314d5923fcaeb31d950c4143fb4f439746aa7b9862d28e6f49914689d421af1c6888bf1ee0f8899cea6ced726b8113db89d23410
7
- data.tar.gz: 05cf47e784e7560b02a77914cd1a64a9801296898ad94a46281a5960ca1b8574cddd2dd70d7b576e4a983059d13b0c684d786eb475f41cac1152d51987808296
6
+ metadata.gz: bc6396439374fc4072acc765b8300265972e68daab0458ed585f230e291c8e03b7bcf96c0eee50ea33eda8d03b831a26d0220387f1dd57f44c8916c9c0283a45
7
+ data.tar.gz: aa748f5c286c44eaade1a1cc99e6ce66bd8335d60cba9f9ef9f2c76460fa8f3cda91adb5d4c31abb29d46972c36eba0fab2f2eae09f5ea598350c60968039cdc
data/README.md CHANGED
@@ -9,17 +9,39 @@ Ruby ecosystem.
9
9
 
10
10
  ## Installation
11
11
 
12
- Not yet released to RubyGems. Once published:
13
-
14
12
  ```bash
15
13
  bundle add fhirpath-rb
16
14
  ```
17
15
 
18
- ## Planned usage
16
+ ## Usage
17
+
18
+ `compile_as_first` and `compile_as_array` parse a FHIRPath expression once and return a
19
+ reusable callable that accepts a [fhir_models](https://github.com/fhir-crucible/fhir_models)
20
+ resource instance and wraps results as instances of a given `output_type` (raw values pass
21
+ through as-is when `output_type` isn't a fhir_models class):
19
22
 
20
23
  ```ruby
21
24
  require "fhirpath"
22
25
 
26
+ patient = FHIR::Patient.new(
27
+ "name" => [
28
+ { "use" => "official", "given" => ["Peter", "James"], "family" => "Chalmers" },
29
+ { "use" => "usual", "given" => ["Jim"] }
30
+ ]
31
+ )
32
+
33
+ first_name = Fhirpath.compile_as_first("Patient.name.where(use = 'usual')", FHIR::Patient, FHIR::HumanName)
34
+ first_name.call(patient)
35
+ # => #<FHIR::HumanName ...>
36
+
37
+ all_given = Fhirpath.compile_as_array("Patient.name.given", FHIR::Patient, String)
38
+ all_given.call(patient)
39
+ # => ["Peter", "James", "Jim"]
40
+ ```
41
+
42
+ `Fhirpath.evaluate` works directly against a plain resource Hash and returns raw values:
43
+
44
+ ```ruby
23
45
  patient = {
24
46
  "resourceType" => "Patient",
25
47
  "name" => [
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "../../ext/fhir_path_parser/fhir_path_parser"
3
+ require "fhir_path_parser"
4
4
  require_relative "parser/ast_builder"
5
5
 
6
6
  module Fhirpath
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fhirpath
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fhirpath-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - beda.software
@@ -151,6 +151,7 @@ metadata:
151
151
  rdoc_options: []
152
152
  require_paths:
153
153
  - lib
154
+ - ext/fhir_path_parser
154
155
  required_ruby_version: !ruby/object:Gem::Requirement
155
156
  requirements:
156
157
  - - ">="