davinci_crd_test_kit 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/lib/davinci_crd_test_kit/card_responses/propose_alternate_request.json +2 -52
  3. data/lib/davinci_crd_test_kit/card_responses/request_form_completion.json +46 -31
  4. data/lib/davinci_crd_test_kit/cards_validation.rb +8 -4
  5. data/lib/davinci_crd_test_kit/client_hooks_group.rb +22 -660
  6. data/lib/davinci_crd_test_kit/client_tests/appointment_book_receive_request_test.rb +17 -6
  7. data/lib/davinci_crd_test_kit/client_tests/client_appointment_book_group.rb +70 -0
  8. data/lib/davinci_crd_test_kit/client_tests/client_encounter_discharge_group.rb +71 -0
  9. data/lib/davinci_crd_test_kit/client_tests/client_encounter_start_group.rb +70 -0
  10. data/lib/davinci_crd_test_kit/client_tests/client_order_dispatch_group.rb +70 -0
  11. data/lib/davinci_crd_test_kit/client_tests/client_order_select_group.rb +72 -0
  12. data/lib/davinci_crd_test_kit/client_tests/client_order_sign_group.rb +71 -0
  13. data/lib/davinci_crd_test_kit/client_tests/decode_auth_token_test.rb +43 -23
  14. data/lib/davinci_crd_test_kit/client_tests/encounter_discharge_receive_request_test.rb +19 -6
  15. data/lib/davinci_crd_test_kit/client_tests/encounter_start_receive_request_test.rb +18 -6
  16. data/lib/davinci_crd_test_kit/client_tests/hook_request_optional_fields_test.rb +26 -10
  17. data/lib/davinci_crd_test_kit/client_tests/hook_request_required_fields_test.rb +20 -11
  18. data/lib/davinci_crd_test_kit/client_tests/hook_request_valid_context_test.rb +14 -10
  19. data/lib/davinci_crd_test_kit/client_tests/hook_request_valid_prefetch_test.rb +27 -110
  20. data/lib/davinci_crd_test_kit/client_tests/order_dispatch_receive_request_test.rb +18 -6
  21. data/lib/davinci_crd_test_kit/client_tests/order_select_receive_request_test.rb +18 -6
  22. data/lib/davinci_crd_test_kit/client_tests/order_sign_receive_request_test.rb +18 -6
  23. data/lib/davinci_crd_test_kit/client_tests/retrieve_jwks_test.rb +66 -29
  24. data/lib/davinci_crd_test_kit/client_tests/submitted_response_validation.rb +44 -0
  25. data/lib/davinci_crd_test_kit/client_tests/token_header_test.rb +45 -14
  26. data/lib/davinci_crd_test_kit/client_tests/token_payload_test.rb +43 -26
  27. data/lib/davinci_crd_test_kit/crd_client_suite.rb +0 -4
  28. data/lib/davinci_crd_test_kit/hook_request_field_validation.rb +240 -50
  29. data/lib/davinci_crd_test_kit/mock_service_response.rb +134 -120
  30. data/lib/davinci_crd_test_kit/routes/hook_request_endpoint.rb +26 -42
  31. data/lib/davinci_crd_test_kit/server_encounter_discharge_group.rb +24 -0
  32. data/lib/davinci_crd_test_kit/server_encounter_start_group.rb +24 -0
  33. data/lib/davinci_crd_test_kit/server_order_select_group.rb +24 -0
  34. data/lib/davinci_crd_test_kit/server_tests/coverage_information_system_action_received_test.rb +4 -1
  35. data/lib/davinci_crd_test_kit/server_tests/service_request_optional_fields_validation_test.rb +8 -10
  36. data/lib/davinci_crd_test_kit/server_tests/service_request_required_fields_validation_test.rb +5 -10
  37. data/lib/davinci_crd_test_kit/tags.rb +6 -6
  38. data/lib/davinci_crd_test_kit/version.rb +1 -1
  39. metadata +9 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e150fcac95cd36535cfe8a971c0049eabdfd089190ff4333d2133d8bcf0492eb
4
- data.tar.gz: a9b089cca45e92021ac6f2d45073674884713778275fb52d6e102178d2756271
3
+ metadata.gz: 33d5aca05287041b83a61c18d2874c880d2a4b36dff0c75bf685f4a2255143cf
4
+ data.tar.gz: 9ac83e3c423292fab7d7d55283dc62659a3fb9b8b0f34da9ee0a9d7301503d1f
5
5
  SHA512:
6
- metadata.gz: 73225d0988962c7cdb0cfcd12defc5cb6e82319e151bf87f7c426611c4687228bef32bc3a5d429a72135a244394f906b657714ed4a74447e97ee1e1b22146bf8
7
- data.tar.gz: cc40a88091ae745d6d7e6579e42b47fb6cd262778efcd89a22391f410ffc2b1a450564806c0b45308d8b39e0f8a48fe1e3b4cefb36c56ebddda604eaa489a71e
6
+ metadata.gz: 8812040e78df937da8396ad14de78c1d3d1dcfda6845055c6836134f8bfb685dcd6e22d1375d95499d7809048ace137d51e0be771bb148d5b22e493189fa061f
7
+ data.tar.gz: fbea542ee6bae0754b8cee0c40ce5dbc4cd154503e0fc52396f4a5781ed60cf5e64d0818a1356cfa7a472a1b654aee2cd0f827b92484c01975c4fd23e9794baf
@@ -15,57 +15,7 @@
15
15
  "suggestions": [
16
16
  {
17
17
  "label": "Replace order with a health assessment first",
18
- "actions": [
19
- {
20
- "type": "create",
21
- "description": "Order for patient health assessment",
22
- "resource": {
23
- "resourceType": "ServiceRequest",
24
- "status": "draft",
25
- "intent": "order",
26
- "category": [
27
- {
28
- "coding": [
29
- {
30
- "system": "http://snomed.info/sct",
31
- "code": "409063005",
32
- "display": "Counselling"
33
- }
34
- ]
35
- }
36
- ],
37
- "code": {
38
- "coding": [
39
- {
40
- "system": "http://snomed.info/sct",
41
- "code": "225885004",
42
- "display": "Health assessment (procedure)"
43
- }
44
- ]
45
- },
46
- "subject": {
47
- "reference": "http://example.org/fhir/Patient/123"
48
- },
49
- "occurrenceTiming": {
50
- "repeat": {
51
- "boundsDuration": {
52
- "value": 3,
53
- "unit": "months",
54
- "system": "http://unitsofmeasure.org",
55
- "code": "mo"
56
- },
57
- "frequency": 1,
58
- "period": 1,
59
- "periodUnit": "mo"
60
- }
61
- },
62
- "authoredOn": "2019-02-15",
63
- "requester": {
64
- "reference": "http://example.org/fhir/PractitionerRole/987"
65
- }
66
- }
67
- }
68
- ]
18
+ "actions": []
69
19
  }
70
20
  ]
71
- }
21
+ }
@@ -14,12 +14,12 @@
14
14
  "selectionBehavior": "any",
15
15
  "suggestions": [
16
16
  {
17
- "label" : "Add 'completion of the ABC form' to your task list (possibly for reassignment)",
18
- "actions" : [
17
+ "label": "Add 'completion of the ABC form' to your task list (possibly for reassignment)",
18
+ "actions": [
19
19
  {
20
- "type" : "create",
21
- "description" : "Add version 2 of the XYZ form to the clinical system's repository (if it doesn't already exist)",
22
- "resource" : {
20
+ "type": "create",
21
+ "description": "Add version 2 of the XYZ form to the clinical system's repository (if it doesn't already exist)",
22
+ "resource": {
23
23
  "resourceType": "Questionnaire",
24
24
  "id": "XYZ",
25
25
  "url": "http://example.org/Questionnaire/XYZ",
@@ -178,42 +178,57 @@
178
178
  }
179
179
  },
180
180
  {
181
- "type" : "create",
182
- "description" : "Add 'Complete ABC form' to the task list",
183
- "resource" : {
184
- "resourceType" : "Task",
185
- "status" : "ready",
186
- "intent" : "order",
187
- "code" : {
188
- "coding" : [
181
+ "type": "create",
182
+ "description": "Add 'Complete ABC form' to the task list",
183
+ "resource": {
184
+ "resourceType": "Task",
185
+ "status": "ready",
186
+ "intent": "order",
187
+ "code": {
188
+ "coding": [
189
189
  {
190
- "system" : "http://hl7.org/fhir/uv/sdc/CodeSystem/temp",
191
- "code" : "complete-questionnaire"
190
+ "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/temp",
191
+ "code": "complete-questionnaire"
192
192
  }
193
193
  ]
194
194
  },
195
- "description" : "Complete XYZ form for local retention",
196
- "for" : {
197
- "reference" : "http://example.org/fhir/Patient/123"
195
+ "description": "Complete XYZ form for local retention",
196
+ "for": {
197
+ "reference": "http://example.org/fhir/Patient/123"
198
198
  },
199
- "authoredOn" : "2018-08-09",
200
- "input" : [
199
+ "authoredOn": "2018-08-09",
200
+ "requester": {
201
+ "reference": "http://example.org/fhir/Organization/payer"
202
+ },
203
+ "input": [
201
204
  {
202
- "type" : {
203
- "text" : "questionnaire"
205
+ "type": {
206
+ "text": "questionnaire",
207
+ "coding": [
208
+ {
209
+ "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/temp",
210
+ "code": "questionnaire"
211
+ }
212
+ ]
204
213
  },
205
- "valueCanonical" : "http://example.org/Questionnaire/XYZ|2"
214
+ "valueCanonical": "http://example.org/Questionnaire/XYZ"
206
215
  },
207
216
  {
208
- "type" : {
209
- "text" : "afterCompletion"
217
+ "type": {
218
+ "text": "afterCompletion",
219
+ "coding": [
220
+ {
221
+ "system": "http://hl7.org/fhir/us/davinci-crd/CodeSystem/temp",
222
+ "code": "after-completion-action"
223
+ }
224
+ ]
210
225
  },
211
- "valueCodeableConcept" : {
212
- "coding" : [
226
+ "valueCodeableConcept": {
227
+ "coding": [
213
228
  {
214
- "system" : "http://example.org/fhir/CodeSystem/SomeCodes",
215
- "code" : "987",
216
- "display" : "Local Use"
229
+ "system": "http://hl7.org/fhir/us/davinci-crd/CodeSystem/temp",
230
+ "code": "prior-auth-include",
231
+ "display": "Include in prior authorization"
217
232
  }
218
233
  ]
219
234
  }
@@ -224,4 +239,4 @@
224
239
  ]
225
240
  }
226
241
  ]
227
- }
242
+ }
@@ -191,17 +191,21 @@ module DaVinciCRDTestKit
191
191
  end
192
192
  end
193
193
 
194
+ def response_label(index = nil)
195
+ "Server response #{index}"
196
+ end
197
+
194
198
  def perform_cards_validation(cards, response_index = 0)
195
199
  unless cards
196
- add_message('error', "Server response #{response_index + 1} did not have the `cards` field.")
200
+ add_message('error', "#{response_label(response_index + 1)} did not have the `cards` field.")
197
201
  return
198
202
  end
199
203
  unless cards.is_a?(Array)
200
- add_message('error', "`cards` field of server response #{response_index + 1} is not an array.")
204
+ add_message('error', "`cards` field of #{response_label(response_index + 1).downcase} is not an array.")
201
205
  return
202
206
  end
203
207
  warning do
204
- assert cards.present?, "Server response #{response_index + 1} has no decision support."
208
+ assert cards.present?, "#{response_label(response_index + 1)} has no decision support."
205
209
  end
206
210
  cards_check(cards)
207
211
  end
@@ -219,7 +223,7 @@ module DaVinciCRDTestKit
219
223
  service_response = JSON.parse(request.response_body)
220
224
  perform_cards_validation(service_response['cards'], index)
221
225
  rescue JSON::ParserError
222
- add_message('error', "Invalid JSON: server response #{index + 1} is not a valid JSON.")
226
+ add_message('error', "Invalid JSON: #{response_label(response_index + 1).downcase} is not a valid JSON.")
223
227
  end
224
228
  end
225
229