cancer_pathology_data_sharing_test_kit 0.9.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 (48) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/config/presets/demo_report.json +14 -0
  4. data/config/presets/inferno_reference_server_preset.json.erb +39 -0
  5. data/lib/cancer_pathology_data_sharing_test_kit/bundle_parse.rb +53 -0
  6. data/lib/cancer_pathology_data_sharing_test_kit/docs/data_access_suite_description.md +83 -0
  7. data/lib/cancer_pathology_data_sharing_test_kit/docs/report_generation_suite_description.md +118 -0
  8. data/lib/cancer_pathology_data_sharing_test_kit/fhir_resource_navigation.rb +174 -0
  9. data/lib/cancer_pathology_data_sharing_test_kit/group_metadata.rb +82 -0
  10. data/lib/cancer_pathology_data_sharing_test_kit/igs/.keep +0 -0
  11. data/lib/cancer_pathology_data_sharing_test_kit/igs/README.md +21 -0
  12. data/lib/cancer_pathology_data_sharing_test_kit/metadata.rb +75 -0
  13. data/lib/cancer_pathology_data_sharing_test_kit/must_support_test.rb +239 -0
  14. data/lib/cancer_pathology_data_sharing_test_kit/primitive_type.rb +5 -0
  15. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/data_absent/data_absent_reason_code_system.rb +22 -0
  16. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/data_absent/data_absent_reason_extension.rb +20 -0
  17. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/data_absent/sending_hide_missing.rb +28 -0
  18. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/data_absent_group.rb +27 -0
  19. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/encounter/encounter_must_support_test.rb +53 -0
  20. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/encounter/encounter_validation_test.rb +48 -0
  21. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/encounter/metadata.yml +281 -0
  22. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/patient/metadata.yml +305 -0
  23. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/patient/patient_must_support_test.rb +58 -0
  24. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/patient/patient_validation_test.rb +47 -0
  25. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/practitioner_role/metadata.yml +44 -0
  26. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/practitioner_role/practitioner_role_must_support_test.rb +45 -0
  27. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/practitioner_role/practitioner_role_validation_test.rb +47 -0
  28. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/service_request/metadata.yml +75 -0
  29. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/service_request/service_request_must_support_test.rb +52 -0
  30. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/service_request/service_request_validation_test.rb +47 -0
  31. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/specimen/metadata.yml +51 -0
  32. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/specimen/specimen_must_support_test.rb +53 -0
  33. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/specimen/specimen_validation_test.rb +47 -0
  34. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/us_pathology_diagnostic_report/diagnostic_report_validation_test.rb +47 -0
  35. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/us_pathology_diagnostic_report/metadata.yml +77 -0
  36. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/us_pathology_diagnostic_report/us_pathology_diagnostic_report_must_support_test.rb +51 -0
  37. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/us_pathology_exchange_bundle/exchange_bundle_validation_test.rb +56 -0
  38. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/us_pathology_exchange_bundle/metadata.yml +78 -0
  39. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle/us_pathology_exchange_bundle/us_pathology_exchange_bundle_must_support_test.rb +41 -0
  40. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite/exchange_bundle_group.rb +104 -0
  41. data/lib/cancer_pathology_data_sharing_test_kit/report_generation_suite.rb +73 -0
  42. data/lib/cancer_pathology_data_sharing_test_kit/urls.rb +25 -0
  43. data/lib/cancer_pathology_data_sharing_test_kit/us_core_data_access_suite/us_core_group.rb +72 -0
  44. data/lib/cancer_pathology_data_sharing_test_kit/us_core_data_access_suite.rb +58 -0
  45. data/lib/cancer_pathology_data_sharing_test_kit/validation_test.rb +96 -0
  46. data/lib/cancer_pathology_data_sharing_test_kit/version.rb +4 -0
  47. data/lib/cancer_pathology_data_sharing_test_kit.rb +3 -0
  48. metadata +124 -0
@@ -0,0 +1,44 @@
1
+ ---
2
+ :name: us_pathology_related_practitioner_role
3
+ :class_name: UsPathologyRelatedPractitionerRoleSequence
4
+ :version: v1.0.1
5
+ :reformatted_version: v101
6
+ :resource: PractitionerRole
7
+ :profile_url: http://hl7.org/fhir/us/cancer-reporting/StructureDefinition/us-pathology-related-practitioner-role
8
+ :profile_name: US Pathology Related Practitioner Roles
9
+ :profile_version: 1.0.1
10
+ :title: US Pathology Related Practitioner Roles
11
+ :short_description: Verify support for the server capabilities required by the US
12
+ Pathology Related Practitioner Roles.
13
+ :must_supports:
14
+ :extensions: []
15
+ :slices: []
16
+ :elements:
17
+ - :path: practitioner
18
+ :types:
19
+ - Reference
20
+ :target_profiles:
21
+ - http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner
22
+ - :path: organization
23
+ :types:
24
+ - Reference
25
+ :target_profiles:
26
+ - http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization
27
+ - :path: code
28
+ - :path: specialty
29
+ - :path: location
30
+ :types:
31
+ - Reference
32
+ - :path: telecom
33
+ - :path: telecom.system
34
+ - :path: telecom.value
35
+ - :path: endpoint
36
+ :types:
37
+ - Reference
38
+ :mandatory_elements:
39
+ - PractitionerRole.telecom.system
40
+ - PractitionerRole.telecom.value
41
+ - PractitionerRole.notAvailable.description
42
+ :tests: []
43
+ :id: v101_practitioner_role
44
+ :file_name: practitioner_role_group.rb
@@ -0,0 +1,45 @@
1
+ require_relative '../../../must_support_test'
2
+ require_relative '../../../group_metadata'
3
+
4
+ module CancerPathologyDataSharingTestKit
5
+ module V101
6
+ class PractitionerRoleMustSupportTest < Inferno::Test
7
+ include CancerPathologyDataSharingTestKit::MustSupportTest
8
+
9
+ title 'All must support elements are provided in the Practitioner Role resources'
10
+ description %(
11
+ Report generators SHALL be capable of populating all must support data elements
12
+ defined in the [US Pathology ExchangeBundle profile](https://hl7.org/fhir/us/cancer-reporting/STU1.0.1/StructureDefinition-us-pathology-exchange-bundle.html)
13
+ and profiles it references. This test will look through the PractitionerRole resources
14
+ found in the provided report Bundles for the following must support elements:
15
+
16
+ * PractitionerRole.code
17
+ * PractitionerRole.endpoint
18
+ * PractitionerRole.location
19
+ * PractitionerRole.organization
20
+ * PractitionerRole.practitioner
21
+ * PractitionerRole.specialty
22
+ * PractitionerRole.telecom
23
+ * PractitionerRole.telecom.system
24
+ * PractitionerRole.telecom.value
25
+ )
26
+
27
+ id :cpds_v101_practitioner_role_must_support_test
28
+
29
+ def resource_type
30
+ 'PractitionerRole'
31
+ end
32
+
33
+ def self.metadata
34
+ @metadata ||= GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'), aliases: true))
35
+ end
36
+
37
+ run do
38
+ all_resources = scratch[:cpds_resources]&.values&.map do |bundle_resources|
39
+ bundle_resources['PractitionerRole'] || []
40
+ end
41
+ perform_must_support_test(all_resources&.flatten)
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,47 @@
1
+ require_relative '../../../bundle_parse'
2
+ require_relative '../../../validation_test'
3
+
4
+ module CancerPathologyDataSharingTestKit
5
+ class PractitionerRoleValidationTest < Inferno::Test
6
+ include CancerPathologyDataSharingTestKit::ValidationTest
7
+ include CancerPathologyDataSharingTestKit::BundleParse
8
+
9
+ title 'PractitionerRole resources in the bundle(s) conforms to the US Pathology PractitionerRole profile'
10
+ description %(
11
+ This test verifies that any PractitionerRole resources from each bundle conforms to
12
+ the [US Pathology Related PractitionerRoles](http://hl7.org/fhir/us/cancer-reporting/StructureDefinition/us-pathology-related-practitioner-role).
13
+
14
+ It verifies the presence of mandatory elements and that elements with
15
+ required bindings contain appropriate values. CodeableConcept element
16
+ bindings will fail if none of their codings have a code/system belonging
17
+ to the bound ValueSet. Quantity, Coding, and code element bindings will
18
+ fail if their code/system are not found in the valueset.
19
+ )
20
+
21
+ id :cpds_practitioner_role_validation_test
22
+
23
+ def resource_type
24
+ 'PractitionerRole'
25
+ end
26
+
27
+ output :dar_code_found, :dar_extension_found
28
+
29
+ run do
30
+ invalid_bundles = []
31
+ total_resources = 0
32
+ scratch[:cpds_resources].each do |bundle_id, bundle_resources|
33
+ resources = bundle_resources['PractitionerRole'] || []
34
+ total_resources += resources.length
35
+
36
+ profile_url = PE_BUNDLE_SLICE_RESOURCES['PractitionerRole']
37
+ invalid_bundles << bundle_id if perform_strict_validation_test('PractitionerRole', bundle_id, resources, profile_url, '1.0.1',
38
+ skip_if_empty: false)
39
+ end
40
+
41
+ skip_if total_resources.zero?,
42
+ "No #{resource_type} resources found in any of the given bundles"
43
+
44
+ check_for_errors(invalid_bundles)
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,75 @@
1
+ ---
2
+ :name: us_pathology_service_request
3
+ :class_name: UsPathologyServiceRequestSequence
4
+ :version: v1.0.1
5
+ :reformatted_version: v101
6
+ :resource: ServiceRequest
7
+ :profile_url: http://hl7.org/fhir/us/cancer-reporting/StructureDefinition/us-pathology-service-request
8
+ :profile_name: US Pathology Service Request
9
+ :profile_version: 1.0.1
10
+ :title: US Pathology Service Request
11
+ :short_description: Verify support for the server capabilities required by the US
12
+ Pathology Service Request.
13
+ :must_supports:
14
+ :extensions: []
15
+ :slices:
16
+ - :slice_id: ServiceRequest.category:us-core
17
+ :slice_name: us-core
18
+ :path: category
19
+ :discriminator:
20
+ :type: requiredBinding
21
+ :path: ''
22
+ :values:
23
+ - :system: http://snomed.info/sct
24
+ :code: '108252007'
25
+ - :system: http://snomed.info/sct
26
+ :code: '363679005'
27
+ - :system: http://snomed.info/sct
28
+ :code: '409063005'
29
+ - :system: http://snomed.info/sct
30
+ :code: '409073007'
31
+ - :system: http://snomed.info/sct
32
+ :code: '387713003'
33
+ - :system: http://snomed.info/sct
34
+ :code: '386053000'
35
+ - :system: http://snomed.info/sct
36
+ :code: '410606002'
37
+ - :system: http://hl7.org/fhir/us/core/CodeSystem/us-core-tags
38
+ :code: 'sdoh'
39
+ :elements:
40
+ - :path: identifier
41
+ - :path: basedOn
42
+ :types:
43
+ - Reference
44
+ - :path: status
45
+ - :path: intent
46
+ - :path: category
47
+ - :path: code
48
+ - :path: subject
49
+ :types:
50
+ - Reference
51
+ :target_profiles:
52
+ - http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient
53
+ - :path: encounter
54
+ :types:
55
+ - Reference
56
+ :target_profiles:
57
+ - http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter
58
+ - :path: occurrencePeriod
59
+ :original_path: occurrence[x]
60
+ - :path: authoredOn
61
+ - :path: requester
62
+ :types:
63
+ - Reference
64
+ :target_profiles:
65
+ - http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner
66
+ :mandatory_elements:
67
+ - ServiceRequest.status
68
+ - ServiceRequest.intent
69
+ - ServiceRequest.category
70
+ - ServiceRequest.code
71
+ - ServiceRequest.code.coding
72
+ - ServiceRequest.subject
73
+ :tests: []
74
+ :id: v101_service_request
75
+ :file_name: service_request_group.rb
@@ -0,0 +1,52 @@
1
+ require_relative '../../../must_support_test'
2
+ require_relative '../../../group_metadata'
3
+
4
+ module CancerPathologyDataSharingTestKit
5
+ module V101
6
+ class ServiceRequestMustSupportTest < Inferno::Test
7
+ include CancerPathologyDataSharingTestKit::MustSupportTest
8
+
9
+ title 'All must support elements are provided in the Service Request resources'
10
+ description %(
11
+ Report generators SHALL be capable of populating all must support data elements
12
+ defined in the [US Pathology ExchangeBundle profile](https://hl7.org/fhir/us/cancer-reporting/STU1.0.1/StructureDefinition-us-pathology-exchange-bundle.html)
13
+ and profiles it references. This test will look through the ServiceRequest resources
14
+ found in the provided report Bundles for the following must support elements:
15
+
16
+ * ServiceRequest.authoredOn
17
+ * ServiceRequest.basedOn
18
+ * ServiceRequest.category
19
+ * ServiceRequest.category:us-core
20
+ * ServiceRequest.code
21
+ * ServiceRequest.encounter
22
+ * ServiceRequest.identifier
23
+ * ServiceRequest.intent
24
+ * ServiceRequest.occurrencePeriod
25
+ * ServiceRequest.requester
26
+ * ServiceRequest.status
27
+ * ServiceRequest.subject
28
+ )
29
+
30
+ id :cpds_v101_service_request_must_support_test
31
+
32
+ def resource_type
33
+ 'ServiceRequest'
34
+ end
35
+
36
+ def self.metadata
37
+ @metadata ||= GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'), aliases: true))
38
+ end
39
+
40
+ def scratch_resources
41
+ scratch[:service_request_resources] ||= {}
42
+ end
43
+
44
+ run do
45
+ all_resources = scratch[:cpds_resources]&.values&.map do |bundle_resources|
46
+ bundle_resources['ServiceRequest'] || []
47
+ end
48
+ perform_must_support_test(all_resources&.flatten)
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,47 @@
1
+ require_relative '../../../bundle_parse'
2
+ require_relative '../../../validation_test'
3
+
4
+ module CancerPathologyDataSharingTestKit
5
+ class ServiceRequestValidationTest < Inferno::Test
6
+ include CancerPathologyDataSharingTestKit::ValidationTest
7
+ include CancerPathologyDataSharingTestKit::BundleParse
8
+
9
+ title 'ServiceRequest resources in the bundle(s) conforms to the US Pathology ServiceRequest profile'
10
+ description %(
11
+ This test verifies that any ServiceRequest resources from each bundle conforms to
12
+ the [US Pathology Service Request](http://hl7.org/fhir/us/cancer-reporting/StructureDefinition/us-pathology-service-request).
13
+
14
+ It verifies the presence of mandatory elements and that elements with
15
+ required bindings contain appropriate values. CodeableConcept element
16
+ bindings will fail if none of their codings have a code/system belonging
17
+ to the bound ValueSet. Quantity, Coding, and code element bindings will
18
+ fail if their code/system are not found in the valueset.
19
+ )
20
+
21
+ id :cpds_service_request_validation_test
22
+
23
+ def resource_type
24
+ 'ServiceRequest'
25
+ end
26
+
27
+ output :dar_code_found, :dar_extension_found
28
+
29
+ run do
30
+ invalid_bundles = []
31
+ total_resources = 0
32
+ scratch[:cpds_resources].each do |bundle_id, bundle_resources|
33
+ resources = bundle_resources['ServiceRequest'] || []
34
+ total_resources += resources.length
35
+
36
+ profile_url = PE_BUNDLE_SLICE_RESOURCES['ServiceRequest']
37
+ invalid_bundles << bundle_id if perform_strict_validation_test('ServiceRequest', bundle_id, resources, profile_url, '1.0.1',
38
+ skip_if_empty: false)
39
+ end
40
+
41
+ skip_if total_resources.zero?,
42
+ "No #{resource_type} resources found in any of the given bundles"
43
+
44
+ check_for_errors(invalid_bundles)
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,51 @@
1
+ ---
2
+ :name: us_pathology_specimen
3
+ :class_name: UsPathologySpecimenSequence
4
+ :version: v1.0.1
5
+ :reformatted_version: v101
6
+ :resource: Specimen
7
+ :profile_url: http://hl7.org/fhir/us/cancer-reporting/StructureDefinition/us-pathology-specimen
8
+ :profile_name: US Pathology Specimen
9
+ :profile_version: 1.0.1
10
+ :title: US Pathology Specimen
11
+ :short_description: Verify support for the server capabilities required by the US
12
+ Pathology Specimen.
13
+ :must_supports:
14
+ :extensions: []
15
+ :slices: []
16
+ :elements:
17
+ - :path: identifier
18
+ - :path: accessionIdentifier
19
+ - :path: status
20
+ - :path: subject
21
+ :types:
22
+ - Reference
23
+ :target_profiles:
24
+ - http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient
25
+ - :path: type
26
+ - :path: receivedTime
27
+ - :path: parent
28
+ :types:
29
+ - Reference
30
+ - :path: collection
31
+ - :path: collection.collector
32
+ :types:
33
+ - Reference
34
+ :target_profiles:
35
+ - http://hl7.org/fhir/us/cancer-reporting/StructureDefinition/us-pathology-related-practitioner-role
36
+ - :path: collection.collected[x]
37
+ - :path: collection.method
38
+ - :path: collection.bodySite
39
+ - :path: container
40
+ - :path: note
41
+ :mandatory_elements:
42
+ - Specimen.identifier
43
+ - Specimen.accessionIdentifier
44
+ - Specimen.type
45
+ - Specimen.collection.collected[x]
46
+ - Specimen.collection.method
47
+ - Specimen.container
48
+ - Specimen.container.identifier
49
+ :tests: []
50
+ :id: v101_specimen
51
+ :file_name: specimen_group.rb
@@ -0,0 +1,53 @@
1
+ require_relative '../../../must_support_test'
2
+ require_relative '../../../group_metadata'
3
+
4
+ module CancerPathologyDataSharingTestKit
5
+ module V101
6
+ class SpecimenMustSupportTest < Inferno::Test
7
+ include CancerPathologyDataSharingTestKit::MustSupportTest
8
+
9
+ title 'All must support elements are provided in the Specimen resources'
10
+ description %(
11
+ Report generators SHALL be capable of populating all must support data elements
12
+ defined in the [US Pathology ExchangeBundle profile](https://hl7.org/fhir/us/cancer-reporting/STU1.0.1/StructureDefinition-us-pathology-exchange-bundle.html)
13
+ and profiles it references. This test will look through the Specimen resources
14
+ found in the provided report Bundles for the following must support elements:
15
+
16
+ * Specimen.accessionIdentifier
17
+ * Specimen.collection
18
+ * Specimen.collection.bodySite
19
+ * Specimen.collection.collected[x]
20
+ * Specimen.collection.collector
21
+ * Specimen.collection.method
22
+ * Specimen.container
23
+ * Specimen.identifier
24
+ * Specimen.note
25
+ * Specimen.parent
26
+ * Specimen.receivedTime
27
+ * Specimen.status
28
+ * Specimen.type
29
+ )
30
+
31
+ id :cpds_v101_specimen_must_support_test
32
+
33
+ def resource_type
34
+ 'Specimen'
35
+ end
36
+
37
+ def self.metadata
38
+ @metadata ||= GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'), aliases: true))
39
+ end
40
+
41
+ def scratch_resources
42
+ scratch[:specimen_resources] ||= {}
43
+ end
44
+
45
+ run do
46
+ all_resources = scratch[:cpds_resources]&.values&.map do |bundle_resources|
47
+ bundle_resources['Specimen'] || []
48
+ end
49
+ perform_must_support_test(all_resources&.flatten)
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,47 @@
1
+ require_relative '../../../bundle_parse'
2
+ require_relative '../../../validation_test'
3
+
4
+ module CancerPathologyDataSharingTestKit
5
+ class SpecimenValidationTest < Inferno::Test
6
+ include CancerPathologyDataSharingTestKit::ValidationTest
7
+ include CancerPathologyDataSharingTestKit::BundleParse
8
+
9
+ title 'Specimen resources in the bundle(s) conforms to the US Pathology Specimen profile'
10
+ description %(
11
+ This test verifies there is at least one of the Specimen resource returned from each bundle and that it conforms to
12
+ the [US Pathology Specimen](http://hl7.org/fhir/us/cancer-reporting/StructureDefinition/us-pathology-specimen).
13
+
14
+ It verifies the presence of mandatory elements and that elements with
15
+ required bindings contain appropriate values. CodeableConcept element
16
+ bindings will fail if none of their codings have a code/system belonging
17
+ to the bound ValueSet. Quantity, Coding, and code element bindings will
18
+ fail if their code/system are not found in the valueset.
19
+ )
20
+
21
+ id :cpds_specimen_validation_test
22
+
23
+ def resource_type
24
+ 'Specimen'
25
+ end
26
+
27
+ output :dar_code_found, :dar_extension_found
28
+
29
+ run do
30
+ invalid_bundles = []
31
+ total_resources = 0
32
+ scratch[:cpds_resources].each do |bundle_id, bundle_resources|
33
+ resources = bundle_resources['Specimen'] || []
34
+ total_resources += resources.length
35
+
36
+ profile_url = PE_BUNDLE_SLICE_RESOURCES['Specimen']
37
+ invalid_bundles << bundle_id if perform_strict_validation_test('Specimen', bundle_id, resources, profile_url, '1.0.1',
38
+ restriction: 'at_least_one')
39
+ end
40
+
41
+ skip_if total_resources.zero?,
42
+ "No #{resource_type} resources found in any of the given bundles"
43
+
44
+ check_for_errors(invalid_bundles)
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,47 @@
1
+ require_relative '../../../bundle_parse'
2
+ require_relative '../../../validation_test'
3
+
4
+ module CancerPathologyDataSharingTestKit
5
+ class DiagnosticReportValidationTest < Inferno::Test
6
+ include CancerPathologyDataSharingTestKit::ValidationTest
7
+ include CancerPathologyDataSharingTestKit::BundleParse
8
+
9
+ title 'DiagnosticReport resource in each bundle conforms to the US Pathology Diagnostic Report profile'
10
+ description %(
11
+ This test verifies that there is exactly one DiagnosticReport resource returned from each bundle and that it conforms to
12
+ the [US Pathology Diagnostic Report](http://hl7.org/fhir/us/cancer-reporting/StructureDefinition/us-pathology-diagnostic-report).
13
+
14
+ It verifies the presence of mandatory elements and that elements with
15
+ required bindings contain appropriate values. CodeableConcept element
16
+ bindings will fail if none of their codings have a code/system belonging
17
+ to the bound ValueSet. Quantity, Coding, and code element bindings will
18
+ fail if their code/system are not found in the valueset.
19
+ )
20
+
21
+ id :cpds_diagnostic_report_validation_test
22
+
23
+ def resource_type
24
+ 'DiagnosticReport'
25
+ end
26
+
27
+ output :dar_code_found, :dar_extension_found
28
+
29
+ run do
30
+ invalid_bundles = []
31
+ total_resources = 0
32
+ scratch[:cpds_resources].each do |bundle_id, bundle_resources|
33
+ resources = bundle_resources['DiagnosticReport'] || []
34
+ total_resources += resources.length
35
+
36
+ profile_url = PE_BUNDLE_SLICE_RESOURCES['DiagnosticReport']
37
+ invalid_bundles << bundle_id if perform_strict_validation_test('DiagnosticReport', bundle_id, resources, profile_url, '1.0.1',
38
+ restriction: 'exactly_one')
39
+ end
40
+
41
+ skip_if total_resources.zero?,
42
+ "No #{resource_type} resources found in any of the given bundles"
43
+
44
+ check_for_errors(invalid_bundles)
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,77 @@
1
+ ---
2
+ :name: us_pathology_diagnostic_report
3
+ :class_name: UsPathologyDiagnosticReportSequence
4
+ :version: v1.0.1
5
+ :reformatted_version: v101
6
+ :resource: DiagnosticReport
7
+ :profile_url: http://hl7.org/fhir/us/cancer-reporting/StructureDefinition/us-pathology-diagnostic-report
8
+ :profile_name: US Pathology Diagnostic Report
9
+ :profile_version: 1.0.1
10
+ :title: DiagnosticReport US Pathology Diagnostic Report
11
+ :short_description: Verify support for the server capabilities required by the US
12
+ Pathology Diagnostic Report.
13
+ :must_supports:
14
+ :extensions: []
15
+ :slices:
16
+ - :slice_id: DiagnosticReport.category:us-core
17
+ :slice_name: us-core
18
+ :path: category
19
+ :discriminator:
20
+ :type: requiredBinding
21
+ :path: ''
22
+ :values:
23
+ - :system: http://loinc.org
24
+ :code: LP29684-5
25
+ - :system: http://loinc.org
26
+ :code: LP29708-2
27
+ - :system: http://loinc.org
28
+ :code: LP7839-6
29
+ :elements:
30
+ - :path: status
31
+ - :path: category
32
+ - :path: code
33
+ - :path: subject
34
+ :types:
35
+ - Reference
36
+ :target_profiles:
37
+ - http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient
38
+ - :path: encounter
39
+ :types:
40
+ - Reference
41
+ :target_profiles:
42
+ - http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter
43
+ - :path: effectiveDateTime
44
+ :original_path: effective[x]
45
+ - :path: issued
46
+ - :path: performer
47
+ :types:
48
+ - Reference
49
+ - :path: resultsInterpreter
50
+ :types:
51
+ - Reference
52
+ - :path: specimen
53
+ :types:
54
+ - Reference
55
+ :target_profiles:
56
+ - http://hl7.org/fhir/us/cancer-reporting/StructureDefinition/us-pathology-specimen
57
+ - :path: result
58
+ :types:
59
+ - Reference
60
+ :target_profiles:
61
+ - http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab
62
+ - http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-clinical-test
63
+ - http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-imaging
64
+ - :path: media
65
+ - :path: media.link
66
+ :types:
67
+ - Reference
68
+ - :path: presentedForm
69
+ :mandatory_elements:
70
+ - DiagnosticReport.status
71
+ - DiagnosticReport.category
72
+ - DiagnosticReport.code
73
+ - DiagnosticReport.subject
74
+ - DiagnosticReport.media.link
75
+ :tests: []
76
+ :id: v101_us_pathology_diagnostic_report
77
+ :file_name: us_pathology_diagnostic_report_group.rb
@@ -0,0 +1,51 @@
1
+ require_relative '../../../must_support_test'
2
+ require_relative '../../../group_metadata'
3
+
4
+ module CancerPathologyDataSharingTestKit
5
+ module V101
6
+ class UsPathologyDiagnosticReportMustSupportTest < Inferno::Test
7
+ include CancerPathologyDataSharingTestKit::MustSupportTest
8
+
9
+ title 'All must support elements are provided in the US Pathology Diagnostic Report resources'
10
+ description %(
11
+ Report generators SHALL be capable of populating all must support data elements
12
+ defined in the [US Pathology ExchangeBundle profile](https://hl7.org/fhir/us/cancer-reporting/STU1.0.1/StructureDefinition-us-pathology-exchange-bundle.html)
13
+ and profiles it references. This test will look through the DiagnosticReport resources
14
+ found in the provided report Bundles for the following must support elements:
15
+
16
+ * DiagnosticReport.category
17
+ * DiagnosticReport.category:us-core
18
+ * DiagnosticReport.code
19
+ * DiagnosticReport.effectiveDateTime
20
+ * DiagnosticReport.encounter
21
+ * DiagnosticReport.issued
22
+ * DiagnosticReport.media
23
+ * DiagnosticReport.media.link
24
+ * DiagnosticReport.performer
25
+ * DiagnosticReport.presentedForm
26
+ * DiagnosticReport.result
27
+ * DiagnosticReport.resultsInterpreter
28
+ * DiagnosticReport.specimen
29
+ * DiagnosticReport.status
30
+ * DiagnosticReport.subject
31
+ )
32
+
33
+ id :cpds_v101_us_pathology_diagnostic_report_must_support_test
34
+
35
+ def resource_type
36
+ 'DiagnosticReport'
37
+ end
38
+
39
+ def self.metadata
40
+ @metadata ||= GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'), aliases: true))
41
+ end
42
+
43
+ run do
44
+ all_resources = scratch[:cpds_resources]&.values&.map do |bundle_resources|
45
+ bundle_resources['DiagnosticReport'] || []
46
+ end
47
+ perform_must_support_test(all_resources&.flatten)
48
+ end
49
+ end
50
+ end
51
+ end