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 +4 -4
- data/README.md +25 -3
- data/lib/fhirpath/parser.rb +1 -1
- data/lib/fhirpath/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 386fdadfc9286fb53c26e7b958d24b794931720c5f289e846290def5f85d032d
|
|
4
|
+
data.tar.gz: e3f288571780f12833b512ad1ca730fd9783534eb93898192d431f21102bb152
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
##
|
|
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" => [
|
data/lib/fhirpath/parser.rb
CHANGED
data/lib/fhirpath/version.rb
CHANGED
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.
|
|
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
|
- - ">="
|