us_core_test_kit 1.1.0 → 1.1.1
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5dd7f080c0a7bcccec81de3a8b216983f000c5b872ac05f763a64793167a9f38
|
|
4
|
+
data.tar.gz: 26604b5c77f6d2ab3363962c6a0246e8b82693d629702c765dc18c7ed4649a82
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c0fe916f13aaff72dfb8a5b114678e845037e6336bbcef867a5509e8e81685775c4533e993396a6961c5231b7ee397d452bdb20edb5683ce8d30a9d377fd1662
|
|
7
|
+
data.tar.gz: 9dc45374a94cbf2b9f23e594ba52bb6d2ce2ebad2e7eb995b29ef18d38553899d4569db9ac093fcd3dc9c0bd84aa2cb2456351fd06f213fb35dcab93b77f18cc
|
|
@@ -29,7 +29,7 @@ module USCoreTestKit
|
|
|
29
29
|
|
|
30
30
|
if provenances.present?
|
|
31
31
|
has_agent = provenances.any? do |provenance|
|
|
32
|
-
provenance.target.any? { |target| target.reference.end_with?("DocumentReference/#{docref.id}") } &&
|
|
32
|
+
provenance.target.any? { |target| target.reference.present? && target.reference.end_with?("DocumentReference/#{docref.id}") } &&
|
|
33
33
|
provenance.agent.any? { |agent| agent.who.present? || agent.onBehalfOf.present? }
|
|
34
34
|
end
|
|
35
35
|
end
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
module USCoreTestKit
|
|
2
2
|
module GranularScope
|
|
3
|
+
require 'uri'
|
|
3
4
|
|
|
4
5
|
def granular_scopes
|
|
5
6
|
@granular_scopes ||=
|
|
@@ -37,6 +38,25 @@ module USCoreTestKit
|
|
|
37
38
|
end
|
|
38
39
|
end
|
|
39
40
|
|
|
41
|
+
def resolve_url(url_string)
|
|
42
|
+
return nil if url_string.nil?
|
|
43
|
+
|
|
44
|
+
uri = URI.parse(url_string)
|
|
45
|
+
# If already absolute, return as-is
|
|
46
|
+
return url_string if uri.absolute?
|
|
47
|
+
|
|
48
|
+
# If relative, resolve against the configured FHIR base URL
|
|
49
|
+
# Per FHIR spec, relative URLs are interpreted relative to the FHIR base URL
|
|
50
|
+
# Strip leading slash from relative URL if present to prevent URI.join from
|
|
51
|
+
# treating it as absolute path from root, and ensure base has trailing slash
|
|
52
|
+
base_with_slash = url.end_with?('/') ? url : "#{url}/"
|
|
53
|
+
relative_without_leading_slash = url_string.start_with?('/') ? url_string[1..-1] : url_string
|
|
54
|
+
resolved = URI.join(base_with_slash, relative_without_leading_slash)
|
|
55
|
+
resolved.to_s
|
|
56
|
+
rescue URI::InvalidURIError
|
|
57
|
+
url_string
|
|
58
|
+
end
|
|
59
|
+
|
|
40
60
|
def previous_request_resources
|
|
41
61
|
first_request = previous_requests.first
|
|
42
62
|
next_page_url = nil
|
|
@@ -49,10 +69,14 @@ module USCoreTestKit
|
|
|
49
69
|
[]
|
|
50
70
|
end
|
|
51
71
|
|
|
52
|
-
|
|
72
|
+
# Check if current request URL matches the next page URL from the previous request
|
|
73
|
+
# If not, this is a new search, so update first_request
|
|
74
|
+
resolved_next_page_url = resolve_url(next_page_url)
|
|
75
|
+
first_request = request if request.url != resolved_next_page_url
|
|
53
76
|
|
|
54
77
|
request_resource_hash[first_request].concat(request_resources)
|
|
55
78
|
|
|
79
|
+
# Extract the next page URL from the current request's bundle for the next iteration
|
|
56
80
|
next if request.resource&.resourceType != 'Bundle'
|
|
57
81
|
|
|
58
82
|
next_page_url = request.resource&.link&.find { |link| link.relation == 'next' }&.url
|
|
@@ -66,26 +66,22 @@ module USCoreTestKit
|
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
def query_in_scope?(resource_type, params)
|
|
69
|
-
received_scopes.split(' ').
|
|
69
|
+
received_scopes.split(' ').any? do |scope|
|
|
70
70
|
parsed_scope = URI.parse(scope)
|
|
71
71
|
|
|
72
72
|
# check for resource type, search scope, and matched params
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return true
|
|
73
|
+
parsed_scope.path =~ /\/#{resource_type}\./ &&
|
|
74
|
+
parsed_scope.path.split('.')[1].include?('s') &&
|
|
75
|
+
search_is_for_the_granular_values?(parsed_scope.query, params)
|
|
78
76
|
end
|
|
79
|
-
|
|
80
|
-
false
|
|
81
77
|
end
|
|
82
78
|
|
|
83
|
-
def
|
|
84
|
-
|
|
85
|
-
|
|
79
|
+
def search_is_for_the_granular_values?(granular_params, search_params)
|
|
80
|
+
return false if granular_params.blank? # ignore resource-level scopes
|
|
81
|
+
|
|
82
|
+
CGI.parse(granular_params).all? do |param_name, value|
|
|
83
|
+
search_params.key?(param_name) && value.include?(search_params[param_name])
|
|
86
84
|
end
|
|
87
|
-
|
|
88
|
-
true
|
|
89
85
|
end
|
|
90
86
|
|
|
91
87
|
def previous_resources(params)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: us_core_test_kit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stephen MacVicar
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-01-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: inferno_core
|