davinci_pdex_test_kit 0.10.6 → 0.12.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.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/config/presets/pdex_payer_client_postman_preset.json +12 -0
  3. data/config/presets/pdex_payer_server_fhir_foundry_ri_preset.json +96 -0
  4. data/config/presets/pdex_payer_server_inferno_ri_preset.json +96 -0
  5. data/lib/davinci_pdex_test_kit/docs/davinci_pdex_test_kit_description_v200.md +33 -0
  6. data/lib/davinci_pdex_test_kit/docs/payer_client_suite_description_v200.md +107 -17
  7. data/lib/davinci_pdex_test_kit/fhir_resource_navigation.rb +5 -1
  8. data/lib/davinci_pdex_test_kit/group_metadata.rb +5 -1
  9. data/lib/davinci_pdex_test_kit/igs/davinci-pdex-2.0.0.tgz +0 -0
  10. data/lib/davinci_pdex_test_kit/igs/us-core-3.1.1.tgz +0 -0
  11. data/lib/davinci_pdex_test_kit/metadata.rb +16 -0
  12. data/lib/davinci_pdex_test_kit/must_support_test.rb +3 -0
  13. data/lib/davinci_pdex_test_kit/pdex_payer_client/client_member_match_tests/client_member_match_validation_test.rb +21 -17
  14. data/lib/davinci_pdex_test_kit/pdex_payer_client/client_validation_test.rb +96 -43
  15. data/lib/davinci_pdex_test_kit/pdex_payer_client/client_workflow_interaction_test.rb +50 -0
  16. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/allergyintolerance_clinical_data_request_test.rb +18 -16
  17. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/careplan_clinical_data_request_test.rb +18 -16
  18. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/careteam_clinical_data_request_test.rb +18 -16
  19. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/clinical_data_request_check_test.rb +24 -0
  20. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/condition_clinical_data_request_test.rb +18 -16
  21. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/device_clinical_data_request_test.rb +19 -17
  22. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/diagnosticreport_clinical_data_request_test.rb +18 -16
  23. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/documentreference_clinical_data_request_test.rb +18 -16
  24. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/encounter_clinical_data_request_test.rb +18 -16
  25. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/explanationofbenefit_clinical_data_request_test.rb +18 -16
  26. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/goal_clinical_data_request_test.rb +18 -16
  27. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/immunization_clinical_data_request_test.rb +18 -16
  28. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/location_clinical_data_request_test.rb +18 -16
  29. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/medicationdispense_clinical_data_request_test.rb +18 -16
  30. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/medicationrequest_clinical_data_request_test.rb +18 -16
  31. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/observation_clinical_data_request_test.rb +18 -16
  32. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/organization_clinical_data_request_test.rb +18 -16
  33. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/patient_clinical_data_request_test.rb +18 -16
  34. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/patient_id_search_request_check_test.rb +21 -0
  35. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/practitioner_clinical_data_request_test.rb +18 -16
  36. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/practitionerrole_clinical_data_request_test.rb +18 -16
  37. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/procedure_clinical_data_request_test.rb +18 -16
  38. data/lib/davinci_pdex_test_kit/pdex_payer_client/collection.rb +46 -44
  39. data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/binary_endpoint.rb +26 -0
  40. data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/export_endpoint.rb +29 -0
  41. data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/export_status_endpoint.rb +38 -0
  42. data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/member_match_endpoint.rb +51 -0
  43. data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/next_page_endpoint.rb +23 -0
  44. data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/patient_endpoint.rb +25 -0
  45. data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/patient_everything_endpoint.rb +34 -0
  46. data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/proxy_endpoint.rb +178 -0
  47. data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/resource_read_endpoint.rb +21 -0
  48. data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/resource_search_endpoint.rb +22 -0
  49. data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/token_endpoint.rb +27 -0
  50. data/lib/davinci_pdex_test_kit/pdex_payer_client/mock_server.rb +53 -0
  51. data/lib/davinci_pdex_test_kit/pdex_payer_client/tags.rb +15 -0
  52. data/lib/davinci_pdex_test_kit/pdex_payer_client/urls.rb +51 -0
  53. data/lib/davinci_pdex_test_kit/pdex_payer_client_suite.rb +99 -144
  54. data/lib/davinci_pdex_test_kit/pdex_payer_server/coverage_to_link_minimal_data_validation.rb +1 -1
  55. data/lib/davinci_pdex_test_kit/pdex_payer_server/coverage_to_link_must_support_validation.rb +1 -1
  56. data/lib/davinci_pdex_test_kit/pdex_payer_server/device/device_must_support_test.rb +50 -0
  57. data/lib/davinci_pdex_test_kit/pdex_payer_server/device/device_patient_search_test.rb +68 -0
  58. data/lib/davinci_pdex_test_kit/pdex_payer_server/device/device_patient_type_search_test.rb +54 -0
  59. data/lib/davinci_pdex_test_kit/pdex_payer_server/{explanation_of_benefit/explanation_of_benefit_provenance_revinclude_search_test.rb → device/device_provenance_revinclude_search_test.rb} +16 -13
  60. data/lib/davinci_pdex_test_kit/pdex_payer_server/device/device_read_test.rb +26 -0
  61. data/lib/davinci_pdex_test_kit/pdex_payer_server/device/device_reference_resolution_test.rb +42 -0
  62. data/lib/davinci_pdex_test_kit/pdex_payer_server/device/device_validation_test.rb +39 -0
  63. data/lib/davinci_pdex_test_kit/pdex_payer_server/device/metadata.yml +154 -0
  64. data/lib/davinci_pdex_test_kit/pdex_payer_server/device_group.rb +88 -0
  65. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_id_search_test.rb +10 -26
  66. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_identifier_search_test.rb +13 -26
  67. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_must_support_test.rb +40 -7
  68. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_patient_lastupdated_search_test.rb +48 -0
  69. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_patient_search_test.rb +62 -0
  70. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_patient_service_date_search_test.rb +13 -28
  71. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_patient_type_search_test.rb +12 -28
  72. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_read_test.rb +1 -1
  73. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_reference_resolution_test.rb +10 -6
  74. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_validation_test.rb +10 -11
  75. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/metadata.yml +285 -273
  76. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit_group.rb +69 -73
  77. data/lib/davinci_pdex_test_kit/pdex_payer_server/export_patient_group.rb +11 -13
  78. data/lib/davinci_pdex_test_kit/pdex_payer_server/export_validation_group.rb +3 -8
  79. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense/medication_dispense_must_support_test.rb +42 -0
  80. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense/medication_dispense_patient_search_test.rb +64 -0
  81. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense/medication_dispense_patient_status_search_test.rb +54 -0
  82. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense/medication_dispense_patient_status_type_search_test.rb +55 -0
  83. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense/medication_dispense_provenance_revinclude_search_test.rb +54 -0
  84. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense/medication_dispense_read_test.rb +26 -0
  85. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense/medication_dispense_reference_resolution_test.rb +42 -0
  86. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense/medication_dispense_validation_test.rb +39 -0
  87. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense/metadata.yml +206 -0
  88. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense_group.rb +69 -0
  89. data/lib/davinci_pdex_test_kit/pdex_payer_server/member_match_request_local_references_validation.rb +1 -1
  90. data/lib/davinci_pdex_test_kit/pdex_payer_server/member_match_request_profile_validation.rb +1 -3
  91. data/lib/davinci_pdex_test_kit/pdex_payer_server/multiple_member_matches_group.rb +36 -37
  92. data/lib/davinci_pdex_test_kit/pdex_payer_server/no_member_matches_group.rb +30 -31
  93. data/lib/davinci_pdex_test_kit/pdex_payer_server/patient_operation_in_capability_statement_validation.rb +16 -16
  94. data/lib/davinci_pdex_test_kit/pdex_payer_server/provenance/metadata.yml +173 -0
  95. data/lib/davinci_pdex_test_kit/pdex_payer_server/provenance/provenance_must_support_test.rb +51 -0
  96. data/lib/davinci_pdex_test_kit/pdex_payer_server/provenance/provenance_read_test.rb +26 -0
  97. data/lib/davinci_pdex_test_kit/pdex_payer_server/provenance/provenance_reference_resolution_test.rb +46 -0
  98. data/lib/davinci_pdex_test_kit/pdex_payer_server/provenance/provenance_validation_test.rb +39 -0
  99. data/lib/davinci_pdex_test_kit/pdex_payer_server/provenance_group.rb +59 -0
  100. data/lib/davinci_pdex_test_kit/pdex_payer_server/workflow_clinical_data_group.rb +25 -16
  101. data/lib/davinci_pdex_test_kit/pdex_payer_server/workflow_everything_group.rb +21 -10
  102. data/lib/davinci_pdex_test_kit/pdex_payer_server/workflow_export_group.rb +24 -20
  103. data/lib/davinci_pdex_test_kit/pdex_payer_server/workflow_member_match_group.rb +56 -38
  104. data/lib/davinci_pdex_test_kit/pdex_payer_server_suite.rb +124 -112
  105. data/lib/davinci_pdex_test_kit/pdex_provider_client_suite.rb +8 -8
  106. data/lib/davinci_pdex_test_kit/requirements/davinci-pdex-test-kit_out_of_scope_requirements.csv +1 -0
  107. data/lib/davinci_pdex_test_kit/requirements/davinci-pdex-test-kit_requirements.csv +64 -0
  108. data/lib/davinci_pdex_test_kit/requirements/generated/davinci-pdex-test-kit_requirements_coverage.csv +64 -0
  109. data/lib/davinci_pdex_test_kit/version.rb +2 -3
  110. data/lib/davinci_pdex_test_kit.rb +2 -2
  111. data/lib/inferno_requirements_tools/ext/inferno_core/runnable.rb +22 -0
  112. data/lib/inferno_requirements_tools/rake/rakefile_template +19 -0
  113. data/lib/inferno_requirements_tools/tasks/requirements_coverage.rb +284 -0
  114. data/lib/requirements_config.yaml +17 -0
  115. metadata +113 -27
  116. data/lib/davinci_pdex_test_kit/ext/inferno_core/record_response_route.rb +0 -98
  117. data/lib/davinci_pdex_test_kit/ext/inferno_core/request.rb +0 -19
  118. data/lib/davinci_pdex_test_kit/ext/inferno_core/runnable.rb +0 -18
  119. data/lib/davinci_pdex_test_kit/mock_server.rb +0 -281
  120. data/lib/davinci_pdex_test_kit/pdex_payer_client/client_member_match_tests/client_member_match_submit_test.rb +0 -24
  121. data/lib/davinci_pdex_test_kit/pdex_payer_client/client_must_support_tests/client_member_match_must_support_submit_test.rb +0 -26
  122. data/lib/davinci_pdex_test_kit/pdex_payer_client/client_must_support_tests/client_member_match_must_support_validation_test.rb +0 -32
  123. data/lib/davinci_pdex_test_kit/pdex_payer_client/client_must_support_tests/metadata.yml +0 -61
  124. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/initial_scratch_storing.rb +0 -32
  125. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/initial_wait_test.rb +0 -31
  126. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_patient_last_updated_search_test.rb +0 -63
  127. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_patient_use_search_test.rb +0 -68
  128. data/lib/davinci_pdex_test_kit/tags.rb +0 -11
  129. data/lib/davinci_pdex_test_kit/urls.rb +0 -77
  130. /data/lib/davinci_pdex_test_kit/{metadata → pdex_payer_client/mock_server/resources}/mock_capability_statement.json +0 -0
  131. /data/lib/davinci_pdex_test_kit/{metadata → pdex_payer_client/mock_server/resources}/mock_operation_outcome_resource.json +0 -0
@@ -0,0 +1,64 @@
1
+ Req Set,ID,URL,Requirement,Conformance,Actor,Sub-Requirement(s),Conditionality,Da Vinci PDex Payer Server Test Suite Short ID(s),Da Vinci PDex Payer Server Test Suite Full ID(s),Da Vinci PDex Payer Client Test Suite Short ID(s),Da Vinci PDex Payer Client Test Suite Full ID(s)
2
+ hl7.fhir.us.davinci-pdex_2.0.0,1,https://hl7.org/fhir/us/davinci-pdex/STU2/#intellectual-property,Implementers ... of this specification SHALL abide by the license requirements for each terminology content artifact utilized within a functioning implementation.,SHALL,Server,,false,,,NA,NA
3
+ hl7.fhir.us.davinci-pdex_2.0.0,2,https://hl7.org/fhir/us/davinci-pdex/STU2/#intellectual-property,Terminology licenses SHALL be obtained from the Third-Party IP owner for each code system and/or other specified artifact used.,SHALL,Server,,false,,,NA,NA
4
+ hl7.fhir.us.davinci-pdex_2.0.0,3,https://hl7.org/fhir/us/davinci-pdex/STU2/index.html#must-support,"For profiles defined in [US Core and referenced by PDex], the meaning of Must Support [for Servers] is established in [the US Core IG].",SHALL,Server,"hl7.fhir.us.core_3.1.1@75,77,78,80",false,2.2,pdex_payer_server-api_and_ms_coverage-pdex_fhir_api_coverage,NA,NA
5
+ hl7.fhir.us.davinci-pdex_2.0.0,4,https://hl7.org/fhir/us/davinci-pdex/STU2/index.html#must-support,"For profiles defined in [US Core and referenced by PDex], the meaning of Must Support [for Clients] is established in [the US Core IG].",SHALL,Client,"hl7.fhir.us.core_3.1.1@76,79",false,NA,NA,,
6
+ hl7.fhir.us.davinci-pdex_2.0.0,5,https://hl7.org/fhir/us/davinci-pdex/STU2/index.html#must-support,"For profiles defined in [DaVinci HRex and referenced by PDex], the meaning of Must Support [for Servers] is established in [the HRex IG].",SHALL,Server,"hl7.fhir.us.davinci-hrex_1.0.0@21,22,24,25,27",false,,,NA,NA
7
+ hl7.fhir.us.davinci-pdex_2.0.0,6,https://hl7.org/fhir/us/davinci-pdex/STU2/index.html#must-support,"For profiles defined in [DaVinci HRex and referenced by PDex], the meaning of Must Support [for Clients] is established in [the HRex IG].",SHALL,Client,"hl7.fhir.us.davinci-hrex_1.0.0@23,26,28",false,NA,NA,,
8
+ hl7.fhir.us.davinci-pdex_2.0.0,7,https://hl7.org/fhir/us/davinci-pdex/STU2/index.html#must-support,"[For profiles defined in the PDex IG, Servers SHALL follow] Must Support requirements … [from] the US Core Implementation Guide.",SHALL,Server,"hl7.fhir.us.core_3.1.1@75,77,78,80",false,2.2,pdex_payer_server-api_and_ms_coverage-pdex_fhir_api_coverage,NA,NA
9
+ hl7.fhir.us.davinci-pdex_2.0.0,8,https://hl7.org/fhir/us/davinci-pdex/STU2/index.html#must-support,"[For profiles defined in the PDex IG, Clients SHALL follow] Must Support requirements … [from] the US Core Implementation Guide.",SHALL,Client,"hl7.fhir.us.core_3.1.1@76,79",false,NA,NA,,
10
+ hl7.fhir.us.davinci-pdex_2.0.0,9,https://hl7.org/fhir/us/davinci-pdex/STU2/overview.html#overview,All data exchanged by Health Plans using the interactions covered in this IG SHALL be transformed to FHIR R4 resources.,SHALL,Server,,false,,,NA,NA
11
+ hl7.fhir.us.davinci-pdex_2.0.0,10,"https://hl7.org/fhir/us/davinci-pdex/STU2/overview.html#oauth20-or-smart-on-fhir-member-authorized-exchange,https://hl7.org/fhir/us/davinci-pdex/STU2/member-authorizedoauth2exchange.html,https://hl7.org/fhir/us/davinci-pdex/STU2/pdeximplementationactorsinteractionsdatapayloadsandmethods.html#oauth20-and-fhir-api",The member SHALL authenticate using [and the server SHALL accept only] credentials that have been issued by or are recognized and accepted by the Health Plan. These are typically the member’s customer portal credentials for accessing the health plan.,SHALL,Client,,false,NA,NA,,
12
+ hl7.fhir.us.davinci-pdex_2.0.0,11,https://hl7.org/fhir/us/davinci-pdex/STU2/overview.html#patient-everything-exchange-via-alternate-secure-transport,The use of the Bulk FHIR specification for transmission of member data SHALL honor jurisdictional and personal privacy restrictions that are relevant to a member’s health record.,SHALL,Server,,false,,,NA,NA
13
+ hl7.fhir.us.davinci-pdex_2.0.0,12,https://hl7.org/fhir/us/davinci-pdex/STU2/overview.html#provenance,Health Plans SHALL incorporate provenance records that they receive as part of any exchange of FHIR data.,SHALL,Server,,false,,,NA,NA
14
+ hl7.fhir.us.davinci-pdex_2.0.0,13,https://hl7.org/fhir/us/davinci-pdex/STU2/overview.html#provenance,"Health Plans SHALL provide Provenance records [for each non-Provenance instance] that, at a minimum, indicate that they are playing the role of Transmitter of the data in any PDex information exchange.",SHALL,Server,,false,,,NA,NA
15
+ hl7.fhir.us.davinci-pdex_2.0.0,14,https://hl7.org/fhir/us/davinci-pdex/STU2/introduction.html#implementation-hierarchy-and-priorities,"[F]or profiles and APIs identified in this IG, the FHIR R4 version SHALL be used.",SHALL,Server,,false,,,NA,NA
16
+ hl7.fhir.us.davinci-pdex_2.0.0,15,https://hl7.org/fhir/us/davinci-pdex/STU2/introduction.html#pdex-data-payloads,All resources available via a FHIR API endpoint SHALL be declared in a FHIR CapabilityStatement.,SHALL,Server,,false,,,NA,NA
17
+ hl7.fhir.us.davinci-pdex_2.0.0,16,https://hl7.org/fhir/us/davinci-pdex/STU2/introduction.html#pdex-data-payloads,The Read and Search Operations SHALL be supported for the FHIR Profiles [that are part of the member health history].,SHALL,Server,,false,2.2,pdex_payer_server-api_and_ms_coverage-pdex_fhir_api_coverage,NA,NA
18
+ hl7.fhir.us.davinci-pdex_2.0.0,17,https://hl7.org/fhir/us/davinci-pdex/STU2/introduction.html#capabilitystatement,The Read ... Operation... SHALL be supported for … Resource Type … Coverage [using the [HRex Coverage](https://hl7.org/fhir/us/davinci-hrex/STU1/StructureDefinition-hrex-coverage.html) profile].,SHALL,Server,,false,,,NA,NA
19
+ hl7.fhir.us.davinci-pdex_2.0.0,18,https://hl7.org/fhir/us/davinci-pdex/STU2/introduction.html#capabilitystatement,The ... Search Operation... SHALL be supported for … Resource Type … Coverage [using the [HRex Coverage](https://hl7.org/fhir/us/davinci-hrex/STU1/StructureDefinition-hrex-coverage.html) profile].,SHALL,Server,,false,,,NA,NA
20
+ hl7.fhir.us.davinci-pdex_2.0.0,19,https://hl7.org/fhir/us/davinci-pdex/STU2/pdeximplementationactorsinteractionsdatapayloadsandmethods.html#data-payloads,All resources and operations available via a FHIR API endpoint SHALL be declared in a FHIR CapabilityStatement.,SHALL,Server,,false,,,NA,NA
21
+ hl7.fhir.us.davinci-pdex_2.0.0,20,"https://hl7.org/fhir/us/davinci-pdex/STU2/overview.html#oauth20-or-smart-on-fhir-member-authorized-exchange,https://hl7.org/fhir/us/davinci-pdex/STU2/member-authorizedoauth2exchange.html,https://hl7.org/fhir/us/davinci-pdex/STU2/pdeximplementationactorsinteractionsdatapayloadsandmethods.html#oauth20-and-fhir-api","[When a payer allows their member to authorize information sharing, a]fter authenticating to the (source) Health Plan’s authorization server, the Member SHALL be presented with an Authorization screen that enables them to approve the sharing of information with their intended application, service or (target) Health Plan.",SHALL,Server,,false,,,NA,NA
22
+ hl7.fhir.us.davinci-pdex_2.0.0,21,https://hl7.org/fhir/us/davinci-pdex/STU2/pdeximplementationactorsinteractionsdatapayloadsandmethods.html#oauth20-and-fhir-api,"For this authorization [of data sharing by a member] to occur the Application, service or (target) Health Plan will require OAuth 2.0 client application credentials, which ... the (source) Health Plan [SHALL issue during client] register[ation]",SHALL,Server,,false,,,NA,NA
23
+ hl7.fhir.us.davinci-pdex_2.0.0,22,"https://hl7.org/fhir/us/davinci-pdex/STU2/pdeximplementationactorsinteractionsdatapayloadsandmethods.html#oauth20-and-fhir-api,https://hl7.org/fhir/us/davinci-pdex/STU2/member-authorizedoauth2exchange.htm","The Authorization process [of data sharing by a member], in accordance with applicable privacy policy, SHALL provide a mechanism to support current regulations allowing members the right to decide what information is permitted to be exchanged.",SHALL,Server,,false,,,NA,NA
24
+ hl7.fhir.us.davinci-pdex_2.0.0,23,"https://hl7.org/fhir/us/davinci-pdex/STU2/pdeximplementationactorsinteractionsdatapayloadsandmethods.html#oauth20-and-fhir-api,https://hl7.org/fhir/us/davinci-pdex/STU2/member-authorizedoauth2exchange.htm","After successfully authorizing [data sharing with] an application [on behalf of the Member,] an Access Token ... SHALL be returned to the requesting application.",SHALL,Server,,false,,,NA,NA
25
+ hl7.fhir.us.davinci-pdex_2.0.0,24,"https://hl7.org/fhir/us/davinci-pdex/STU2/pdeximplementationactorsinteractionsdatapayloadsandmethods.html#oauth20-and-fhir-api,https://hl7.org/fhir/us/davinci-pdex/STU2/member-authorizedoauth2exchange.htm","After successfully authorizing [data sharing with] an application [on behalf of the Member,] an … Optional Refresh Token ... [MAY] be returned to the requesting application.",MAY,Server,,false,,,NA,NA
26
+ hl7.fhir.us.davinci-pdex_2.0.0,25,https://hl7.org/fhir/us/davinci-pdex/STU2/pdeximplementationactorsinteractionsdatapayloadsandmethods.html#oauth20-and-fhir-api,The scopes of the access token [returned by the server for data sharing on behalf of a member] SHALL be restricted to the authorizing Member’s information and the scopes approved.,SHALL,Server,,false,,,NA,NA
27
+ hl7.fhir.us.davinci-pdex_2.0.0,26,https://hl7.org/fhir/us/davinci-pdex/STU2/pdeximplementationactorsinteractionsdatapayloadsandmethods.html#oauth20-and-fhir-api,Any subsequent Access Token [returned by the server for data sharing on behalf of the member] issued based on the Refresh Token SHALL be restricted (at least) to the same restrictions.,SHALL,Server,,false,,,NA,NA
28
+ hl7.fhir.us.davinci-pdex_2.0.0,27,"https://hl7.org/fhir/us/davinci-pdex/STU2/pdeximplementationactorsinteractionsdatapayloadsandmethods.html#oauth20-and-fhir-api,https://hl7.org/fhir/us/davinci-pdex/STU2/member-authorizedoauth2exchange.htm",The requesting application [authorized to access member information] SHALL use the access token to access the Health Plan’s secure FHIR API to download the information that the Application is allowed to access.,SHALL,Client,,false,NA,NA,1.1.01,pdex_payer_client-payer_to_payer_workflow-client_workflow_interaction-pdex_client_workflow_interaction
29
+ hl7.fhir.us.davinci-pdex_2.0.0,28,https://hl7.org/fhir/us/davinci-pdex/STU2/handlingdataprovenance.html#handling-data-provenance,Health Plans SHALL accept and retain Provenance records received with data based on Member-authorized Payer-to-Payer exchange.,SHALL,Client,,false,NA,NA,,
30
+ hl7.fhir.us.davinci-pdex_2.0.0,29,https://hl7.org/fhir/us/davinci-pdex/STU2/payertopayerexchange.html#member-match-with-consent,Each [data] retrieval ... SHALL be preceded by the use of the ... [HRex [$member-match](https://hl7.org/fhir/us/davinci-hrex/STU1/OperationDefinition-member-match.html)] interaction to match a member and provide consent.,SHALL,Client,"hl7.fhir.us.davinci-hrex_1.0.0@34,37,38,40,46,47",false,NA,NA,1.2.01,pdex_payer_client-payer_to_payer_workflow-member_match_validation-pdex_initial_member_match_validation
31
+ hl7.fhir.us.davinci-pdex_2.0.0,30,https://hl7.org/fhir/us/davinci-pdex/STU2/payertopayerexchange.html#member-match-with-consent,Health Plans SHALL support the $member-match operation.,SHALL,Server,"hl7.fhir.us.davinci-hrex_1.0.0@35,36,39,41-45,48",false,"1.1.01, 1.3.01","pdex_payer_server-payer_to_payer_workflow-pdex_workflow_member_match-pdex_member_match_operation_in_cap_stmt, pdex_payer_server-payer_to_payer_workflow-pdex_workflow_everything-pdex_patient_operation_in_cap_stmt_validation",NA,NA
32
+ hl7.fhir.us.davinci-pdex_2.0.0,31,https://hl7.org/fhir/us/davinci-pdex/STU2/payertopayerexchange.html#member-match-with-consent,"[Before allowing a $member-match operation, Servers SHALL e]stablish a secure connection [with the client payer] via mTLS.",SHALL,Server,,false,,,NA,NA
33
+ hl7.fhir.us.davinci-pdex_2.0.0,32,https://hl7.org/fhir/us/davinci-pdex/STU2/payertopayerexchange.html#member-match-with-consent,[Servers SHALL allow clients to u]se mTLS secure connection to perform OAuth2.0 Dynamic Client Registration to acquire OAuth2.0 client credentials,SHALL,Server,,false,,,NA,NA
34
+ hl7.fhir.us.davinci-pdex_2.0.0,33,https://hl7.org/fhir/us/davinci-pdex/STU2/payertopayerexchange.html#member-match-with-consent,[Servers SHALL allow clients to u]se Client Credentials to acquire OAuth2.0 token to perform $member-match operation,SHALL,Server,,false,,,NA,NA
35
+ hl7.fhir.us.davinci-pdex_2.0.0,34,https://hl7.org/fhir/us/davinci-pdex/STU2/payertopayerexchange.html#member-match-with-consent,"If a Patient ID is returned from $member-match, [Servers SHALL allow clients to make] a request for an OAuth2.0 Access Token that is scoped to the identified shared member",SHALL,Server,,false,,,NA,NA
36
+ hl7.fhir.us.davinci-pdex_2.0.0,35,https://hl7.org/fhir/us/davinci-pdex/STU2/payertopayerexchange.html#the-member-match-operation,In the case where a [member] match is confirmed the receiving payer will: … [r]eturn a Unique Patient Identifier (Patient FHIR ID) in the $member-match Operation Response.,SHALL,Server,,true,1.1.08,pdex_payer_server-payer_to_payer_workflow-pdex_workflow_member_match-pdex_member_match_identifier_to_id,NA,NA
37
+ hl7.fhir.us.davinci-pdex_2.0.0,36,https://hl7.org/fhir/us/davinci-pdex/STU2/payertopayerexchange.html#the-member-match-operation,When no [member] match is found ... a 422 Unprocessable entity status code will be returned [by the receiving payer].,SHALL,Server,,true,2.1.1.05,pdex_payer_server-api_and_ms_coverage-member_match_failure_cases-pdex_no_member_matches-pdex_member_match_has_no_matches,NA,NA
38
+ hl7.fhir.us.davinci-pdex_2.0.0,37,https://hl7.org/fhir/us/davinci-pdex/STU2/payertopayerexchange.html#the-member-match-operation,"When … multiple matches are found, a 422 Unprocessable entity status code will be returned [by the receiving payer].",SHALL,Server,,true,2.1.2.05,pdex_payer_server-api_and_ms_coverage-member_match_failure_cases-pdex_multiple_member_matches-pdex_member_match_has_multiple_matches,NA,NA
39
+ hl7.fhir.us.davinci-pdex_2.0.0,38,https://hl7.org/fhir/us/davinci-pdex/STU2/payertopayerexchange.html#the-member-match-operation,"If the receiving payer matches to a unique member but is unable to comply with the consent request, a Patient ID SHALL NOT be returned in the $member-match response",SHALL NOT,Server,,true,,,NA,NA
40
+ hl7.fhir.us.davinci-pdex_2.0.0,39,https://hl7.org/fhir/us/davinci-pdex/STU2/payertopayerexchange.html#the-member-match-operation,"If the receiving payer matches to a unique member but is unable to comply with the consent request [e.g., because they do not support the requested data segmentation policy], … a 422 status code SHALL be returned with an Operation Outcome that indicates that the consent request could not be complied with.",SHALL,Server,,true,,,NA,NA
41
+ hl7.fhir.us.davinci-pdex_2.0.0,40,https://hl7.org/fhir/us/davinci-pdex/STU2/payertopayerexchange.html#evaluation-of-consent,"[Servers SHALL consider consent requirements to be met only if]
42
+ - Member Identity is matched
43
+ - Consent Policy (Everything or only Non-Sensitive data) matches the data release segmentation capabilities of the receiving payer
44
+ - Date period for consent is valid
45
+ - Payer requesting retrieval of data is matched.",SHALL,Server,,false,,,NA,NA
46
+ hl7.fhir.us.davinci-pdex_2.0.0,41,https://hl7.org/fhir/us/davinci-pdex/STU2/payertopayerexchange.html#data-retrieval-methods,"Once Health Plans have completed the Member Access stage of the Exchange the requesting Health Plan SHALL utilize the access token returned from the Member Access step to request/retrieve data using one of the following three methods:
47
+ - Query all clinical resource individually
48
+ - $patient-everything operation
49
+ - Bulk FHIR Asynchronous protocols.",SHALL,Client,,false,NA,NA,1.1.01,pdex_payer_client-payer_to_payer_workflow-client_workflow_interaction-pdex_client_workflow_interaction
50
+ hl7.fhir.us.davinci-pdex_2.0.0,42,https://hl7.org/fhir/us/davinci-pdex/STU2/payertopayerexchange.html#data-retrieval-methods,"Each of the above methods[, query all clinical resource individually, $everything, and $export,] SHALL support the retrieval of the profiles and resources [in the scope of the member health history, defined in the Server CapabilityStatement]",SHALL,Server,,false,"1.2, 1.3, 1.4.1","pdex_payer_server-payer_to_payer_workflow-pdex_workflow_clinical_data, pdex_payer_server-payer_to_payer_workflow-pdex_workflow_everything, pdex_payer_server-payer_to_payer_workflow-pdex_workflow_export-pdex_patient_export",NA,NA
51
+ hl7.fhir.us.davinci-pdex_2.0.0,43,https://hl7.org/fhir/us/davinci-pdex/STU2/payertopayerexchange.html#query-all-clinical-resources-individually,Health Plans SHALL support search of a member’s clinical data.,SHALL,Server,,false,2.2,pdex_payer_server-api_and_ms_coverage-pdex_fhir_api_coverage,NA,NA
52
+ hl7.fhir.us.davinci-pdex_2.0.0,44,,[Servers SHALL support] the _revInclude and _include parameters to ... retrieve the associated Provenance and supporting records.,SHALL,Server,,false,2.2.1.08,pdex_payer_server-api_and_ms_coverage-pdex_fhir_api_coverage-pdex_eob-pdex_eob_provenance_revinclude_search,NA,NA
53
+ hl7.fhir.us.davinci-pdex_2.0.0,45,https://hl7.org/fhir/us/davinci-pdex/STU2/payertopayerexchange.html#constraining-data-based-upon-permissions-of-the-requestor,The FHIR Server SHALL constrain the data returned from the server to a requester based upon the access permissions of the requester.,SHALL,Server,,false,,,NA,NA
54
+ hl7.fhir.us.davinci-pdex_2.0.0,46,https://hl7.org/fhir/us/davinci-pdex/STU2/payertopayerexchange.html#everything-operation,Health Plans SHOULD support the use of the $everything operation… defined in the FHIR R4 specification here: https://www.hl7.org/fhir/operation-patient-everything.html,SHOULD,Server,fhir_4.0.1,false,1.3.02,pdex_payer_server-payer_to_payer_workflow-pdex_workflow_everything-Test02,NA,NA
55
+ hl7.fhir.us.davinci-pdex_2.0.0,47,https://hl7.org/fhir/us/davinci-pdex/STU2/payertopayerexchange.html#bulk-fhir-asynchronous-protocols,"Payer-to-Payer Data Exchange SHOULD support the use of Bulk FHIR methods, as defined in the HL7 FHIR [Bulk Data Access Implementation Guide](https://hl7.org/fhir/uv/bulkdata/authorization/).",SHOULD,Server,hl7.fhir.uv.bulkdata_2.0.0,false,1.4.1.01,pdex_payer_server-payer_to_payer_workflow-pdex_workflow_export-pdex_patient_export-pdex_patient_export_in_cap_stmt,NA,NA
56
+ hl7.fhir.us.davinci-pdex_2.0.0,48,https://hl7.org/fhir/us/davinci-pdex/STU2/datamapping.html#data-mapping,Health Plans SHALL map claims and clinical information for a member to US Core v3.1.1 FHIR Resources based on R4.,SHALL,Server,hl7.fhir.us.core_3.1.1,false,2.2,pdex_payer_server-api_and_ms_coverage-pdex_fhir_api_coverage,NA,NA
57
+ hl7.fhir.us.davinci-pdex_2.0.0,49,https://hl7.org/fhir/us/davinci-pdex/STU2/datamapping.html#data-mapping,"Where a US Core FHIR R4 Resource is not defined Health Plans SHALL map claims and clinical information to FHIR Profiles defined in this IG, or the Da Vinci HRex IG.",SHALL,Server,hl7.fhir.us.davinci-hrex_1.0.0,true,2.2,pdex_payer_server-api_and_ms_coverage-pdex_fhir_api_coverage,NA,NA
58
+ hl7.fhir.us.davinci-pdex_2.0.0,50,https://hl7.org/fhir/us/davinci-pdex/STU2/datamapping.html#providing-data-in-sub-element-fields,"If a field is marked as required (cardinality n.., where n>0) the Health Plan SHALL populate the field.",SHALL,Server,,true,2.2,pdex_payer_server-api_and_ms_coverage-pdex_fhir_api_coverage,NA,NA
59
+ hl7.fhir.us.davinci-pdex_2.0.0,51,https://hl7.org/fhir/us/davinci-pdex/STU2/datamapping.html#providing-data-in-sub-element-fields,"For a field specified as MUST SUPPORT and the cardinality is 0.., the Health Plan SHALL be capable of populating the field and do so if the relevant data exists.",SHALL,Server,,true,2.2,pdex_payer_server-api_and_ms_coverage-pdex_fhir_api_coverage,NA,NA
60
+ hl7.fhir.us.davinci-pdex_2.0.0,52,https://hl7.org/fhir/us/davinci-pdex/STU2/datamapping.html#providing-data-in-sub-element-fields,"For a field specified as MUST SUPPORT and the cardinality is 0.., the Health Plan SHALL … [populate] the field ... if the relevant data exists.",SHALL,Server,,true,2.2,pdex_payer_server-api_and_ms_coverage-pdex_fhir_api_coverage,NA,NA
61
+ hl7.fhir.us.davinci-pdex_2.0.0,53,https://hl7.org/fhir/us/davinci-pdex/STU2/datamapping.html#providing-data-in-sub-element-fields,"If a field is marked as MUST SUPPORT the receiver must be able to consume it without generating an error, unless the field is a sub-element of another field where that parent field does NOT have a minimum cardinality of 1 [or a Must Support Flag]. For example, if the parent field has a cardinality of “0..1” or “0..*” the sub-element field does not need to be populated.",SHALL,Client,,true,NA,NA,,
62
+ hl7.fhir.us.davinci-pdex_2.0.0,54,https://hl7.org/fhir/us/davinci-pdex/STU2/usecasescenarios.html#versioning-of-fhir-data,"If a payer chooses to support FHIR resource data versioning of related resource references, the referring resource **SHALL** use the vread format of reference: `[type]/[id]/_history/[vid]`",SHALL,Server,,true,,,NA,NA
63
+ hl7.fhir.us.davinci-pdex_2.0.0,55,https://hl7.org/fhir/us/davinci-pdex/STU2/usecasescenarios.html#versioning-of-fhir-data,Supporting versioning of FHIR data implies supporting the [vread](https://www.hl7.org/fhir/http.html#vread) and [history](https://www.hl7.org/fhir/http.html#history) interactions in the FHIR specification.,SHALL,Server,,true,,,NA,NA
64
+ hl7.fhir.us.davinci-pdex_2.0.0,56,https://hl7.org/fhir/us/davinci-pdex/STU2/StructureDefinition-pdex-priorauthorization.html,"Payers SHALL make available pending and active prior authorization decisions and related clinical documentation and forms for items and services, not including prescription drugs, including the date the prior authorization was approved, the date the authorization ends, as well as the units and services approved and those used to date, no later than one (1) business day after a provider initiates a prior authorization for the beneficiary or there is a change of status for the prior authorization.",SHALL,Server,,false,,,NA,NA
@@ -1,5 +1,4 @@
1
- # frozen_string_literal: true
2
-
3
1
  module DaVinciPDexTestKit
4
- VERSION = '0.10.6'
2
+ VERSION = '0.12.0'.freeze
3
+ LAST_UPDATED = '2025-04-03'.freeze
5
4
  end
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
-
1
+ require_relative 'inferno_requirements_tools/ext/inferno_core/runnable'
2
+ require_relative 'davinci_pdex_test_kit/metadata'
3
3
  require_relative 'davinci_pdex_test_kit/pdex_payer_server_suite'
4
4
  require_relative 'davinci_pdex_test_kit/pdex_payer_client_suite'
5
5
  # require_relative 'davinci_pdex_test_kit/pdex_provider_client_suite'
@@ -0,0 +1,22 @@
1
+ module Inferno
2
+ module DSL
3
+ # This module contains the DSL for defining child entities in the test
4
+ # definition framework.
5
+ module Runnable
6
+ # Set/Get the IDs of requirements verifed by this runnable
7
+ # Set with [] to clear the list
8
+ #
9
+ # @param requirements [Array<String>]
10
+ # @return [Array<String>] the requirement IDs
11
+ def verifies_requirements(*requirement_ids)
12
+ if requirement_ids.empty?
13
+ @requirement_ids || []
14
+ elsif requirement_ids == [[]]
15
+ @requirement_ids = []
16
+ else
17
+ @requirement_ids = requirement_ids
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,19 @@
1
+ namespace :requirements do
2
+ desc 'Generate requirements coverage CSV'
3
+ task :generate_coverage do
4
+ require 'inferno'
5
+ Inferno::Application.start(:suites)
6
+
7
+ require_relative 'lib/inferno_requirements_tools/tasks/requirements_coverage'
8
+ InfernoRequirementsTools::Tasks::RequirementsCoverage.new.run
9
+ end
10
+
11
+ desc 'Check if requirements coverage CSV is up-to-date'
12
+ task :check_coverage do
13
+ require 'inferno'
14
+ Inferno::Application.start(:suites)
15
+
16
+ require_relative 'lib/inferno_requirements_tools/tasks/requirements_coverage'
17
+ InfernoRequirementsTools::Tasks::RequirementsCoverage.new.run_check
18
+ end
19
+ end
@@ -0,0 +1,284 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'csv'
4
+ require 'yaml'
5
+ require_relative '../ext/inferno_core/runnable'
6
+
7
+ module InfernoRequirementsTools
8
+ module Tasks
9
+ # This class manages the mapping of test kit tests to requirements that they verify
10
+ # and creates a CSV file with the tests that cover each requirement.
11
+ # It expects a CSV file in the repo at `lib/[test kit id]/requirements/[test kit id]_requirements.csv`
12
+ # that serves as the source of the requirement set for the test kit. The requirements in
13
+ # this files are identified by a requirement set and an id and tests, groups, and suites
14
+ # within in the test kit can claim that they verify a requirement by including a reference
15
+ # to that requirementin the form <requirement set>@<id> in their `verifies_requirements` field.
16
+ # Requirements that are out of scope can be listed in a companion file
17
+ # `lib/[test kit id]/requirements/[test kit id]_out_of_scope_requirements.csv`.
18
+ #
19
+ # The `run` method generates a CSV file at
20
+ # `lib/[test kit id]/requirements/generated/[test kit id]_requirements_coverage.csv``.
21
+ # This file will be identical to the input spreadsheet, plus an additional column which holds a comma separated
22
+ # list of inferno test IDs that test each requirement. These test IDs are Inferno short form IDs that represent the
23
+ # position of the test within its group and suite. For example, the fifth test in the second group will have an ID
24
+ # of 2.05. This ID is also shown in the Inferno web UI.
25
+ #
26
+ # The `run_check` method will check whether the previously generated file is up-to-date.
27
+ class RequirementsCoverage
28
+ VERSION = '0.2.0' # update when making meaningful changes to this method for tracking used versions
29
+ CONFIG = YAML.load_file(File.join('lib', 'requirements_config.yaml'))
30
+
31
+ TEST_KIT_ID = CONFIG['test_kit_id']
32
+ TEST_SUITES = CONFIG['suites'].map do |test_suite|
33
+ Object.const_get(test_suite['class_name'])
34
+ end
35
+
36
+ SUITE_ID_TO_ACTOR_MAP = CONFIG['suites'].each_with_object({}) do |test_suite, hash|
37
+ hash[test_suite['id']] = test_suite['suite_actor']
38
+ end
39
+
40
+ # Derivative constants
41
+ TEST_KIT_CODE_FOLDER = TEST_KIT_ID
42
+ DASHERIZED_TEST_KIT_ID = TEST_KIT_ID.gsub('_', '-')
43
+ INPUT_HEADERS = [
44
+ 'Req Set',
45
+ 'ID',
46
+ 'URL',
47
+ 'Requirement',
48
+ 'Conformance',
49
+ 'Actor',
50
+ 'Sub-Requirement(s)',
51
+ 'Conditionality'
52
+ ].freeze
53
+ SHORT_ID_HEADER = 'Short ID(s)'
54
+ FULL_ID_HEADER = 'Full ID(s)'
55
+ INPUT_FILE_NAME = "#{DASHERIZED_TEST_KIT_ID}_requirements.csv".freeze
56
+ INPUT_FILE = File.join('lib', TEST_KIT_CODE_FOLDER, 'requirements', INPUT_FILE_NAME).freeze
57
+ NOT_TESTED_FILE_NAME = "#{DASHERIZED_TEST_KIT_ID}_out_of_scope_requirements.csv".freeze
58
+ NOT_TESTED_FILE = File.join('lib', TEST_KIT_CODE_FOLDER, 'requirements', NOT_TESTED_FILE_NAME).freeze
59
+ OUTPUT_HEADERS = INPUT_HEADERS + TEST_SUITES.flat_map do |suite|
60
+ ["#{suite.title} #{SHORT_ID_HEADER}", "#{suite.title} #{FULL_ID_HEADER}"]
61
+ end
62
+ OUTPUT_FILE_NAME = "#{DASHERIZED_TEST_KIT_ID}_requirements_coverage.csv".freeze
63
+ OUTPUT_FILE_DIRECTORY = File.join('lib', TEST_KIT_CODE_FOLDER, 'requirements', 'generated')
64
+ OUTPUT_FILE = File.join(OUTPUT_FILE_DIRECTORY, OUTPUT_FILE_NAME).freeze
65
+
66
+ def input_rows
67
+ @input_rows ||=
68
+ CSV.parse(File.open(INPUT_FILE, 'r:bom|utf-8'), headers: true).map do |row|
69
+ row.to_h.slice(*INPUT_HEADERS)
70
+ end
71
+ end
72
+
73
+ def not_tested_requirements_map
74
+ @not_tested_requirements_map ||= load_not_tested_requirements
75
+ end
76
+
77
+ def load_not_tested_requirements
78
+ return {} unless File.exist?(NOT_TESTED_FILE)
79
+
80
+ not_tested_requirements = {}
81
+ CSV.parse(File.open(NOT_TESTED_FILE, 'r:bom|utf-8'), headers: true).each do |row|
82
+ row_hash = row.to_h
83
+ not_tested_requirements["#{row_hash['Req Set']}@#{row_hash['ID']}"] = row_hash
84
+ end
85
+
86
+ not_tested_requirements
87
+ end
88
+
89
+ # Of the form:
90
+ # {
91
+ # 'req-id-1': [
92
+ # { short_id: 'short-id-1', full_id: 'long-id-1', suite_id: 'suite-id-1' },
93
+ # { short_id: 'short-id-2', full_id: 'long-id-2', suite_id: 'suite-id-2' }
94
+ # ],
95
+ # 'req-id-2': [{ short_id: 'short-id-3', full_id: 'long-id-3', suite_id: 'suite-id-3' }],
96
+ # ...
97
+ # }
98
+ def inferno_requirements_map
99
+ @inferno_requirements_map ||= TEST_SUITES.each_with_object({}) do |suite, requirements_map|
100
+ serialize_requirements(suite, 'suite', suite.id, requirements_map)
101
+ suite.groups.each do |group|
102
+ map_group_requirements(group, suite.id, requirements_map)
103
+ end
104
+ end
105
+ end
106
+
107
+ def new_csv
108
+ @new_csv ||=
109
+ CSV.generate(+"\xEF\xBB\xBF") do |csv|
110
+ csv << OUTPUT_HEADERS
111
+ input_rows.each do |row| # NOTE: use row order from source file
112
+ next if row['Conformance'] == 'DEPRECATED' # filter out deprecated rows
113
+
114
+ TEST_SUITES.each do |suite|
115
+ suite_actor = SUITE_ID_TO_ACTOR_MAP[suite.id]
116
+ if row['Actor']&.include?(suite_actor)
117
+ add_suite_tests_for_row(row, suite)
118
+ else
119
+ row["#{suite.title} #{SHORT_ID_HEADER}"] = 'NA'
120
+ row["#{suite.title} #{FULL_ID_HEADER}"] = 'NA'
121
+ end
122
+ end
123
+ csv << row.values
124
+ end
125
+ end
126
+ end
127
+
128
+ def add_suite_tests_for_row(row, suite)
129
+ set_and_req_id = "#{row['Req Set']}@#{row['ID']}"
130
+ items = get_items_for_requirement(set_and_req_id, suite)
131
+ short_ids = items[0]
132
+ full_ids = items[1]
133
+ if short_ids.blank? && not_tested_requirements_map.key?(set_and_req_id)
134
+ row["#{suite.title} #{SHORT_ID_HEADER}"] = 'Not Tested'
135
+ row["#{suite.title} #{FULL_ID_HEADER}"] = 'Not Tested'
136
+ else
137
+ row["#{suite.title} #{SHORT_ID_HEADER}"] = short_ids&.join(', ')
138
+ row["#{suite.title} #{FULL_ID_HEADER}"] = full_ids&.join(', ')
139
+ end
140
+ end
141
+
142
+ def get_items_for_requirement(set_and_req_id, suite)
143
+ suite_requirement_items = inferno_requirements_map[set_and_req_id]&.filter do |item|
144
+ item[:suite_id] == suite.id
145
+ end
146
+ [
147
+ suite_requirement_items&.map { |item| item[:short_id] },
148
+ suite_requirement_items&.map { |item| item[:full_id] }
149
+ ]
150
+ end
151
+
152
+ def input_requirement_ids
153
+ @input_requirement_ids ||= input_rows.map { |row| "#{row['Req Set']}@#{row['ID']}" }
154
+ end
155
+
156
+ # The requirements present in Inferno that aren't in the input spreadsheet
157
+ def unmatched_requirements_map
158
+ @unmatched_requirements_map ||= inferno_requirements_map.except(*input_requirement_ids)
159
+ end
160
+
161
+ def old_csv
162
+ @old_csv ||= File.read(OUTPUT_FILE)
163
+ end
164
+
165
+ def run
166
+ unless File.exist?(INPUT_FILE)
167
+ puts "Could not find input file: #{INPUT_FILE}. Aborting requirements coverage generation..."
168
+ exit(1)
169
+ end
170
+
171
+ if unmatched_requirements_map.any?
172
+ puts "WARNING: The following requirements indicated in the test kit are not present in #{INPUT_FILE_NAME}"
173
+ output_requirements_map_table(unmatched_requirements_map)
174
+ end
175
+
176
+ if File.exist?(OUTPUT_FILE)
177
+ if old_csv == new_csv
178
+ puts "'#{OUTPUT_FILE_NAME}' file is up to date."
179
+ return
180
+ else
181
+ puts 'Requirements coverage has changed.'
182
+ end
183
+ else
184
+ puts "No existing #{OUTPUT_FILE_NAME}."
185
+ end
186
+
187
+ puts "Writing to file #{OUTPUT_FILE}..."
188
+ FileUtils.mkdir_p(OUTPUT_FILE_DIRECTORY)
189
+ File.write(OUTPUT_FILE, new_csv)
190
+ puts 'Done.'
191
+ end
192
+
193
+ def run_check
194
+ unless File.exist?(INPUT_FILE)
195
+ puts "Could not find input file: #{INPUT_FILE}. Aborting requirements coverage check..."
196
+ exit(1)
197
+ end
198
+
199
+ if unmatched_requirements_map.any?
200
+ puts "The following requirements indicated in the test kit are not present in #{INPUT_FILE_NAME}"
201
+ output_requirements_map_table(unmatched_requirements_map)
202
+ end
203
+
204
+ if File.exist?(OUTPUT_FILE)
205
+ if old_csv == new_csv
206
+ puts "'#{OUTPUT_FILE_NAME}' file is up to date."
207
+ return unless unmatched_requirements_map.any?
208
+ else
209
+ puts <<~MESSAGE
210
+ #{OUTPUT_FILE_NAME} file is out of date.
211
+ To regenerate the file, run:
212
+
213
+ bundle exec rake requirements:generate_coverage
214
+
215
+ MESSAGE
216
+ end
217
+ else
218
+ puts <<~MESSAGE
219
+ No existing #{OUTPUT_FILE_NAME} file.
220
+ To generate the file, run:
221
+
222
+ bundle exec rake requirements:generate_coverage
223
+
224
+ MESSAGE
225
+ end
226
+
227
+ puts 'Check failed.'
228
+ exit(1)
229
+ end
230
+
231
+ def map_group_requirements(group, suite_id, requirements_map)
232
+ serialize_requirements(group, group.short_id, suite_id, requirements_map)
233
+ group.tests&.each { |test| serialize_requirements(test, test.short_id, suite_id, requirements_map) }
234
+ group.groups&.each { |subgroup| map_group_requirements(subgroup, suite_id, requirements_map) }
235
+ end
236
+
237
+ def serialize_requirements(runnable, short_id, suite_id, requirements_map)
238
+ runnable.verifies_requirements&.each do |requirement_id|
239
+ requirement_id_string = requirement_id.to_s
240
+
241
+ requirements_map[requirement_id_string] ||= []
242
+ requirements_map[requirement_id_string] << { short_id:, full_id: runnable.id, suite_id: }
243
+ end
244
+ end
245
+
246
+ # Output the requirements in the map like so:
247
+ #
248
+ # requirement_id | short_id | full_id
249
+ # ---------------+------------+----------
250
+ # req-id-1 | short-id-1 | full-id-1
251
+ # req-id-2 | short-id-2 | full-id-2
252
+ #
253
+ def output_requirements_map_table(requirements_map)
254
+ headers = %w[requirement_id short_id full_id]
255
+ col_widths = headers.map(&:length)
256
+ col_widths[0] = [col_widths[0], requirements_map.keys.map(&:length).max].max
257
+ col_widths[1] = ([col_widths[1]] + requirements_map.values.flatten.map { |item| item[:short_id].length }).max
258
+ col_widths[2] = ([col_widths[2]] + requirements_map.values.flatten.map { |item| item[:full_id].length }).max
259
+ col_widths.map { |width| width + 3 }
260
+
261
+ puts [
262
+ headers[0].ljust(col_widths[0]),
263
+ headers[1].ljust(col_widths[1]),
264
+ headers[2].ljust(col_widths[2])
265
+ ].join(' | ')
266
+ puts col_widths.map { |width| '-' * width }.join('-+-')
267
+ output_requirements_map_table_contents(requirements_map, col_widths)
268
+ puts
269
+ end
270
+
271
+ def output_requirements_map_table_contents(requirements_map, col_widths)
272
+ requirements_map.each do |requirement_id, runnables|
273
+ runnables.each do |runnable|
274
+ puts [
275
+ requirement_id.ljust(col_widths[0]),
276
+ runnable[:short_id].ljust(col_widths[1]),
277
+ runnable[:full_id].ljust(col_widths[2])
278
+ ].join(' | ')
279
+ end
280
+ end
281
+ end
282
+ end
283
+ end
284
+ end
@@ -0,0 +1,17 @@
1
+ test_kit_id: davinci_pdex_test_kit
2
+
3
+ suites:
4
+ - id: pdex_payer_server
5
+ class_name: DaVinciPDexTestKit::PDexPayerServerSuite
6
+ suite_actor: Server
7
+ - id: pdex_payer_client
8
+ class_name: DaVinciPDexTestKit::PDexPayerClientSuite
9
+ suite_actor: Client
10
+
11
+ requirement_sets:
12
+ - id: hl7.fhir.us.davinci-pdex_2.0.0
13
+ folder: PDex
14
+ requirements: All
15
+ actor_map:
16
+ - {spec: Server, test_kit: Server}
17
+ - {spec: Client, test_kit: Client}