hln_ice 0.2.0 → 0.3.0

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: 693ce96464262bed3bdbba9a9d38cc91aaaba9620c270e49994b4c0537c21b4d
4
- data.tar.gz: 74711ef35d3caf83aa5b210ad0665b152275224fbc571349b686432d0fed0e10
3
+ metadata.gz: ad2a04435e36bc2e843e01c674c067f8d552f7b528e95e5540b19cbb11a06ff4
4
+ data.tar.gz: c5a5769cbf8c2d41e7074812a1ff83e0caf489a9a31d3bf4f2486a2160674118
5
5
  SHA512:
6
- metadata.gz: 6f47f5f31184385ebf20e319a415720094a792fe2e91b3e35218771e7ff15f80ecac1956771eab2bbd773c820ae2e54b5df6dc774f1bffc97786ad7814419918
7
- data.tar.gz: ac317607ab177277cba5c32c458d3f5ddb583a6e84f0e98ab70d774128986db2c393d1a2d783f50386d93ae74ad0800967443024f20a93cd5f6e0a9eedaa9405
6
+ metadata.gz: 0ea75c7a3a922fb8fb76388f3d5d3ae568f324afe744861cc79b74c2eb0d83fbcdbed60ff2839391dd0823ba36cb197101494c147cd690036013ad46ea9ffc54
7
+ data.tar.gz: e66a9cd04e3b62d2e47731311dbc1ddc1f57f5a52259f81cc5d3a334fd8f82826ac53ba6e75c3f76630b92b8d54761ae5236127162b2893ec177c7c1469c9f00
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.0] - 2026-09-24
4
+
5
+ - Expose schedule authorities (e.g. `ACIP_CDC`, `AAP`, `AAFP`) on each recommendation under `schedule_authorities` when the ICE server has `outputScheduleAuthorities` enabled. The key is omitted when the server does not return them.
6
+ - Fix recommendations being silently dropped when a proposal's schedule authorities observation precedes its status observation.
7
+
3
8
  ## [0.2.0] - 2026-07-02
4
9
 
5
10
  - Stop logging PHI by default. The ICE input data, generated request XML, and raw service response are no longer logged unless the new `log_payloads:` option is set to `true`. Warnings and errors are still logged.
data/README.md CHANGED
@@ -108,7 +108,12 @@ On success:
108
108
  vaccine: { code: "10", code_system: "...", name: "Polio Vaccine Group" },
109
109
  status: { code: "RECOMMENDED", name: "Recommended" },
110
110
  reasons: [{ code: "DUE_NOW", name: "Due Now" }],
111
- intervals: { proposed: { low: "2020-03-01", high: "2020-04-01" } }
111
+ intervals: { proposed: { low: "2020-03-01", high: "2020-04-01" } },
112
+ # Only present when the ICE server has outputScheduleAuthorities enabled
113
+ schedule_authorities: [
114
+ { code: "ACIP_CDC", name: "Advisory Committee on Immunization Practices / Centers for Disease Control and Prevention" },
115
+ { code: "AAP", name: "American Academy of Pediatrics" }
116
+ ]
112
117
  }
113
118
  ],
114
119
  simplified_status: { ipv_opv: "overdue" }
@@ -306,13 +306,14 @@ module HlnIce
306
306
  vaccine_name = substance_element["displayName"]
307
307
  vaccine_code_system = substance_element["codeSystem"]
308
308
 
309
- # Get the clinical observation result
310
- observation = proposal.xpath(".//observationResult").first
309
+ # Get the clinical observation result carrying the recommendation status.
310
+ # A proposal may contain other observation results (e.g. schedule
311
+ # authorities), in any order, so select the one with a status concept.
312
+ observation = proposal.xpath(".//observationResult[observationValue/concept]").first
311
313
  next unless observation
312
314
 
313
315
  # Get recommendation status
314
316
  status_element = observation.xpath(".//observationValue/concept").first
315
- next unless status_element
316
317
 
317
318
  status_code = status_element["code"]
318
319
  status_name = status_element["displayName"]
@@ -369,6 +370,11 @@ module HlnIce
369
370
  # Only add intervals if they exist
370
371
  recommendation[:intervals] = intervals if present?(intervals)
371
372
 
373
+ # Only add schedule authorities if the service returned them
374
+ # (requires the ICE outputScheduleAuthorities property)
375
+ schedule_authorities = parse_schedule_authorities(proposal)
376
+ recommendation[:schedule_authorities] = schedule_authorities if present?(schedule_authorities)
377
+
372
378
  all_recommendations << recommendation
373
379
  end
374
380
 
@@ -413,6 +419,21 @@ module HlnIce
413
419
  }
414
420
  end
415
421
 
422
+ # Extract the schedule authorities (e.g. ACIP_CDC, AAP) for a proposal.
423
+ # Returns an empty array when the service did not include them.
424
+ def parse_schedule_authorities(proposal)
425
+ authorities = proposal.xpath(
426
+ ".//observationResult[observationFocus/@code='ICE_VACCINE_GROUP_SCHEDULE_AUTHORITIES']/interpretation"
427
+ )
428
+
429
+ authorities.map do |interpretation|
430
+ {
431
+ code: interpretation["code"],
432
+ name: interpretation["displayName"]
433
+ }
434
+ end
435
+ end
436
+
416
437
  def handle_error_response(response)
417
438
  error_message = "ICE service error: #{response.code}"
418
439
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HlnIce
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hln_ice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Sohn
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
10
+ date: 2026-09-24 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: base64
@@ -65,7 +65,6 @@ files:
65
65
  - LICENSE.txt
66
66
  - README.md
67
67
  - Rakefile
68
- - hln_ice.gemspec
69
68
  - lib/hln_ice.rb
70
69
  - lib/hln_ice/client.rb
71
70
  - lib/hln_ice/version.rb
@@ -92,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
91
  - !ruby/object:Gem::Version
93
92
  version: '0'
94
93
  requirements: []
95
- rubygems_version: 4.0.15
94
+ rubygems_version: 3.6.5
96
95
  specification_version: 4
97
96
  summary: Ruby client for the HLN ICE (Immunization Calculation Engine) OpenCDS service.
98
97
  test_files: []
data/hln_ice.gemspec DELETED
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/hln_ice/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "hln_ice"
7
- spec.version = HlnIce::VERSION
8
- spec.authors = ["Sam Sohn"]
9
- spec.email = ["sam@primary.health"]
10
-
11
- spec.summary = "Ruby client for the HLN ICE (Immunization Calculation Engine) OpenCDS service."
12
- spec.description = "Evaluates a patient's immunization history against the HLN ICE forecasting " \
13
- "rules and returns both the raw recommendations and a simplified status mapping."
14
- spec.homepage = "https://github.com/PrimaryDotHealth/hln_ice"
15
- spec.license = "MIT"
16
- spec.required_ruby_version = ">= 3.1.0"
17
-
18
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
19
-
20
- spec.metadata["homepage_uri"] = spec.homepage
21
- spec.metadata["source_code_uri"] = spec.homepage
22
- spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
23
-
24
- # Specify which files should be added to the gem when it is released.
25
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
26
- spec.files = Dir.chdir(__dir__) do
27
- `git ls-files -z`.split("\x0").reject do |f|
28
- (File.expand_path(f) == __FILE__) ||
29
- f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile])
30
- end
31
- end
32
- spec.bindir = "exe"
33
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
34
- spec.require_paths = ["lib"]
35
-
36
- spec.add_dependency "base64", "~> 0.2"
37
- spec.add_dependency "httparty", "~> 0.21"
38
- spec.add_dependency "nokogiri", "~> 1.15"
39
-
40
- # For more information and examples about making a new gem, check out our
41
- # guide at: https://bundler.io/guides/creating_gem.html
42
- end