uds_plus_test_kit 0.9.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/lib/uds_plus_test_kit/examples/manifest.json +76 -14
  3. data/lib/uds_plus_test_kit/input_resource_tests/read_immunization_test.rb +54 -0
  4. data/lib/uds_plus_test_kit/input_resource_tests/read_lab_test.rb +54 -0
  5. data/lib/uds_plus_test_kit/input_resource_tests/read_manifest_ind_test.rb +54 -0
  6. data/lib/uds_plus_test_kit/input_resource_tests/read_med_request_test.rb +54 -0
  7. data/lib/uds_plus_test_kit/input_resource_tests/read_med_statement_test.rb +54 -0
  8. data/lib/uds_plus_test_kit/input_resource_tests/read_related_person_test.rb +54 -0
  9. data/lib/uds_plus_test_kit/input_resource_tests/read_service_request_test.rb +54 -0
  10. data/lib/uds_plus_test_kit/input_resource_tests/read_special_observation_test.rb +54 -0
  11. data/lib/uds_plus_test_kit/input_resource_tests/resource_group.rb +32 -4
  12. data/lib/uds_plus_test_kit/manifest_tests/invalid_type_test.rb +4 -1
  13. data/lib/uds_plus_test_kit/manifest_tests/uds_plus_test_group.rb +16 -2
  14. data/lib/uds_plus_test_kit/manifest_tests/validate_manifest_test.rb +2 -0
  15. data/lib/uds_plus_test_kit/post_tests/post_group.rb +59 -0
  16. data/lib/uds_plus_test_kit/post_tests/post_manifest_test.rb +41 -0
  17. data/lib/uds_plus_test_kit/post_tests/read_post_test.rb +32 -0
  18. data/lib/uds_plus_test_kit/uds_plus_test_suite.rb +40 -0
  19. data/lib/uds_plus_test_kit/validate_immunization_test.rb +33 -0
  20. data/lib/uds_plus_test_kit/validate_income_test.rb +7 -10
  21. data/lib/uds_plus_test_kit/validate_lab_test.rb +65 -0
  22. data/lib/uds_plus_test_kit/validate_med_request_test.rb +33 -0
  23. data/lib/uds_plus_test_kit/validate_med_statement_test.rb +33 -0
  24. data/lib/uds_plus_test_kit/validate_related_person_test.rb +33 -0
  25. data/lib/uds_plus_test_kit/validate_service_request_test.rb +33 -0
  26. data/lib/uds_plus_test_kit/validate_sexual_orientation_test.rb +6 -9
  27. data/lib/uds_plus_test_kit/validate_special_observation_test.rb +65 -0
  28. data/lib/uds_plus_test_kit/version.rb +2 -2
  29. metadata +20 -44
  30. data/lib/uds_plus_test_kit/examples/manifest_2.json +0 -101
  31. data/lib/uds_plus_test_kit/examples/manifest_not_deidentified.json +0 -67
  32. data/lib/uds_plus_test_kit/igs/package/CapabilityStatement-uds-plus-data-receiver-server.json +0 -1
  33. data/lib/uds_plus_test_kit/igs/package/CapabilityStatement-uds-plus-data-source.json +0 -1
  34. data/lib/uds_plus_test_kit/igs/package/CapabilityStatement-uds-plus-data-submitter-client.json +0 -1
  35. data/lib/uds_plus_test_kit/igs/package/CapabilityStatement-uds-plus-trust-service-provider.json +0 -1
  36. data/lib/uds_plus_test_kit/igs/package/CodeSystem-udsplus-agriculture-worker-status-codes.json +0 -1
  37. data/lib/uds_plus_test_kit/igs/package/CodeSystem-udsplus-housing-status-codes.json +0 -1
  38. data/lib/uds_plus_test_kit/igs/package/CodeSystem-udsplus-insurance-codes.json +0 -1
  39. data/lib/uds_plus_test_kit/igs/package/ImplementationGuide-udsplus.json +0 -1
  40. data/lib/uds_plus_test_kit/igs/package/OperationDefinition-import.json +0 -1
  41. data/lib/uds_plus_test_kit/igs/package/OperationDefinition-udsplus-de-identify.json +0 -1
  42. data/lib/uds_plus_test_kit/igs/package/StructureDefinition-de-identified-uds-plus-patient.json +0 -1
  43. data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-age-extension.json +0 -1
  44. data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-agriculture-worker-status-extension.json +0 -1
  45. data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-coverage.json +0 -1
  46. data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-deidentify-data.json +0 -1
  47. data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-diagnosis.json +0 -1
  48. data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-encounter.json +0 -1
  49. data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-housing-status-extension.json +0 -1
  50. data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-import-manifest.json +0 -1
  51. data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-income-observation.json +0 -1
  52. data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-procedure.json +0 -1
  53. data/lib/uds_plus_test_kit/igs/package/StructureDefinition-uds-plus-sexual-orientation-observation.json +0 -1
  54. data/lib/uds_plus_test_kit/igs/package/StructureDefinition-udsplus-agriculture-worker-status.json +0 -1
  55. data/lib/uds_plus_test_kit/igs/package/example/Condition-de-identified-example.json +0 -1
  56. data/lib/uds_plus_test_kit/igs/package/example/Condition-example.json +0 -1
  57. data/lib/uds_plus_test_kit/igs/package/example/Encounter-de-identified-example.json +0 -1
  58. data/lib/uds_plus_test_kit/igs/package/example/Encounter-example.json +0 -1
  59. data/lib/uds_plus_test_kit/igs/package/example/Parameters-example.json +0 -1
  60. data/lib/uds_plus_test_kit/igs/package/example/Patient-de-identified-example.json +0 -1
  61. data/lib/uds_plus_test_kit/igs/package/example/Patient-de-identified-smallpop-example.json +0 -1
  62. data/lib/uds_plus_test_kit/igs/package/example/Patient-example.json +0 -1
  63. data/lib/uds_plus_test_kit/igs/package/example/Patient-smallpop-example.json +0 -1
  64. data/lib/uds_plus_test_kit/igs/package/openapi/uds-plus-data-receiver-server.openapi.json +0 -152
  65. data/lib/uds_plus_test_kit/igs/package/openapi/uds-plus-data-source.openapi.json +0 -152
  66. data/lib/uds_plus_test_kit/igs/package/openapi/uds-plus-data-submitter-client.openapi.json +0 -106
  67. data/lib/uds_plus_test_kit/igs/package/openapi/uds-plus-trust-service-provider.openapi.json +0 -152
  68. data/lib/uds_plus_test_kit/igs/package/other/ig-r4.json +0 -1
  69. data/lib/uds_plus_test_kit/igs/package/other/validation-oo.json +0 -1
  70. data/lib/uds_plus_test_kit/igs/package/other/validation-summary.json +0 -1
  71. data/lib/uds_plus_test_kit/igs/package/package.json +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc1b896ba1e5a3861111a6047b7be139b40b6cc5cde8265e1c97ea88b94ec238
4
- data.tar.gz: 4dea539e8a341d4cbcbe93c8d9d0cad57b86966c8bbbbeace81c41db3d5596b3
3
+ metadata.gz: 833bd32e478f93c36cbe4fb50ea835bc55ec9791cf9d5cb806453cd01d5b7b74
4
+ data.tar.gz: 173bb5badf6417cb8e498a6b9bdc98bee97c4c614e95103628c973c8f6c977d2
5
5
  SHA512:
6
- metadata.gz: 84d2b85fa0c10e81edae24620bdf90140637b92a78b7852c5ea71f2a7296e36dce087dbf1aaeac321332727d058ecb17decba0b223e70e599a96e3fb0268d7b3
7
- data.tar.gz: 1604d3a9ca51eab9f82450a6898f396db42fbc40b5cea3752c5b19b5f8f0852080c8f0c3dd0efcd036beac96ce5227840e2e34000c198de1616c695803266b35
6
+ metadata.gz: 2a566b50713875c32e1336080e98ae0728da57ca4eae05f1d82eb11dc88f3b7e10c85019f98d6aa0c08d37f77e4b5b6cee36070d948fb4f9adc25ef37bc2b340
7
+ data.tar.gz: 6ac89fe76b871556e0e7b74666ace21adfc5b137acf67fa1062f99aed9e4eb8bc32f0751a34123ea069f0eaf68efc31e3a6c9baa668ec957c15622e1d9428603
@@ -16,20 +16,65 @@
16
16
  "http://hl7.org/fhir/us/uds-plus/StructureDefinition/uds-plus-import-manifest"
17
17
  ]
18
18
  },
19
- "parameter": [
20
- {
21
- "name": "inputFormat",
22
- "valueCode": "application/ndjson"
23
- },
24
- {
25
- "name": "inputSource",
26
- "valueUrl": "http://localhost:4567/"
27
- },
28
- {
29
- "name": "storageDetail",
30
- "valueCode": "https"
31
- },
32
- {
19
+ "parameter" : [
20
+ {
21
+ "name" : "inputFormat",
22
+ "valueCode" : "fhir+ndjson"
23
+ },
24
+ {
25
+ "name" : "submissionId",
26
+ "valueString" : "234343-aaa-32432"
27
+ },
28
+ {
29
+ "name" : "hcInformation",
30
+ "part" : [
31
+ {
32
+ "name" : "uei",
33
+ "valueString" : "12343434"
34
+ },
35
+ {
36
+ "name" : "grantNumber",
37
+ "valueString" : "H80CS34333"
38
+ },
39
+ {
40
+ "name" : "hcName",
41
+ "valueString" : "Example FQHC"
42
+ },
43
+ {
44
+ "name" : "hcAddress",
45
+ "valueAddress" : {
46
+ "line": [
47
+ "123 Rocky point place"
48
+ ],
49
+ "city": "Atlanta",
50
+ "state": "GA",
51
+ "postalCode": "23434",
52
+ "country": "US"
53
+ }
54
+ },
55
+ {
56
+ "name" : "hcContactPerson",
57
+ "valueHumanName" : {
58
+ "family": "Taylor",
59
+ "given": [
60
+ "Elizabeth"
61
+ ]
62
+ }
63
+ },
64
+ {
65
+ "name" : "hcContactPhone",
66
+ "valueContactPoint" : {
67
+ "system": "phone",
68
+ "value": "234-234-5648"
69
+ }
70
+ }
71
+ ]
72
+ },
73
+ {
74
+ "name" : "importProtocol",
75
+ "valueCode" : "https"
76
+ },
77
+ {
33
78
  "name": "udsData",
34
79
  "part": [
35
80
  {
@@ -63,6 +108,23 @@
63
108
  }
64
109
  ]
65
110
  },
111
+ {
112
+ "name": "udsData",
113
+ "part": [
114
+ {
115
+ "name": "type",
116
+ "valueCode": "Observation"
117
+ },
118
+ {
119
+ "name": "url",
120
+ "valueUrl": "http://localhost:4567/custom/uds_plus/examples/observation"
121
+ },
122
+ {
123
+ "name": "expirationTime",
124
+ "valueDateTime": "2022-12-14T07:15:07-08:00"
125
+ }
126
+ ]
127
+ },
66
128
  {
67
129
  "name": "udsData",
68
130
  "part": [
@@ -0,0 +1,54 @@
1
+ require 'json'
2
+
3
+ module UDSPlusTestKit
4
+ class ReadImmunizationTest < Inferno::Test
5
+ id :uds_plus_read_immunization_test
6
+ title 'Receive UDS+ Immunization Data'
7
+ description %(
8
+ Test takes from the user either: the http location of immunization data
9
+ or the raw JSON of the data itself.
10
+ It attempts to GET the data stored at the given location if a link is provided,
11
+ then validates whether a FHIR resource can be generated from the input data.
12
+ )
13
+
14
+ input :immunization_data,
15
+ title: 'Immunization Data',
16
+ optional: true,
17
+ description: %q(
18
+ User can input the data as:
19
+ a URL link to the location of the data (ex: http://www.example.com/immunization_data.json)
20
+ OR a JSON string that composes the data. Leaving this blank will skip the test.
21
+ )
22
+
23
+ def data_scratch
24
+ scratch[:data_resources] ||= {}
25
+ end
26
+
27
+ def data_to_test
28
+ data_scratch['Immunization'] ||= []
29
+ end
30
+
31
+ run do
32
+ omit_if !immunization_data.present?, "No data provided; skipping test."
33
+
34
+ # if the input is a url, else it is a json
35
+ if immunization_data.strip[0] != '{'
36
+ assert_valid_http_uri(immunization_data, "Location provided is not a valid http uri.")
37
+ get immunization_data
38
+ assert_response_status(200)
39
+ assert_valid_json(request.response_body, "Data received from request is not a valid JSON")
40
+ data = request.response_body
41
+ else
42
+ assert_valid_json(immunization_data, "JSON inputted was not in a valid format")
43
+ data = immunization_data
44
+ end
45
+
46
+ resource = FHIR::Json.from_json(data)
47
+ assert resource.is_a?(FHIR::Model), "Could not generate a valid resource from the input provided"
48
+
49
+ if resource.is_a?(FHIR::Model)
50
+ data_to_test << resource
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,54 @@
1
+ require 'json'
2
+
3
+ module UDSPlusTestKit
4
+ class ReadLabTest < Inferno::Test
5
+ id :uds_plus_read_lab_test
6
+ title 'Receive UDS+ Lab Observation Data'
7
+ description %(
8
+ Test takes from the user either: the http location of lab observation data
9
+ or the raw JSON of the data itself.
10
+ It attempts to GET the data stored at the given location if a link is provided,
11
+ then validates whether a FHIR resource can be generated from the input data.
12
+ )
13
+
14
+ input :lab_data,
15
+ title: 'Lab Observation Data',
16
+ optional: true,
17
+ description: %q(
18
+ User can input the data as:
19
+ a URL link to the location of the data (ex: http://www.example.com/lab_data.json)
20
+ OR a JSON string that composes the data. Leaving this blank will skip the test.
21
+ )
22
+
23
+ def data_scratch
24
+ scratch[:data_resources] ||= {}
25
+ end
26
+
27
+ def data_to_test
28
+ data_scratch['Observation'] ||= []
29
+ end
30
+
31
+ run do
32
+ omit_if !lab_data.present?, "No data provided; skipping test."
33
+
34
+ # if the input is a url, else it is a json
35
+ if lab_data.strip[0] != '{'
36
+ assert_valid_http_uri(lab_data, "Location provided is not a valid http uri.")
37
+ get lab_data
38
+ assert_response_status(200)
39
+ assert_valid_json(request.response_body, "Data received from request is not a valid JSON")
40
+ data = request.response_body
41
+ else
42
+ assert_valid_json(lab_data, "JSON inputted was not in a valid format")
43
+ data = lab_data
44
+ end
45
+
46
+ resource = FHIR::Json.from_json(data)
47
+ assert resource.is_a?(FHIR::Model), "Could not generate a valid resource from the input provided"
48
+
49
+ if resource.is_a?(FHIR::Model)
50
+ data_to_test << resource
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,54 @@
1
+ require 'json'
2
+
3
+ module UDSPlusTestKit
4
+ class ReadManifestIndTest < Inferno::Test
5
+ id :uds_plus_read_manifest_ind_test
6
+ title 'Receive UDS+ Import Manifest'
7
+ description %(
8
+ Test takes from the user either: the http location of the import manifest
9
+ or the raw JSON of the import manifest itself.
10
+ It attempts to GET the data stored at the given location if a link is provided,
11
+ then validates whether a FHIR resource can be generated from the input data.
12
+ )
13
+
14
+ input :import_manifest,
15
+ title: 'Import Manifest',
16
+ optional: true,
17
+ description: %q(
18
+ User can input the Import manifest as:
19
+ a URL link to the location of the manifest (ex: http://www.example.com/import_manifest.json) OR
20
+ a JSON string that composes the manifest (ex: {manifest_contents})
21
+ )
22
+
23
+ def manifest_scratch
24
+ scratch[:manifest_resources] ||= {}
25
+ end
26
+
27
+ def manifest_resources
28
+ manifest_scratch[:all] ||= []
29
+ end
30
+
31
+ run do
32
+ omit_if !import_manifest.present?, "No data provided; skipping test."
33
+
34
+ # if the input is a url, else it is a json
35
+ if import_manifest.strip[0] != '{'
36
+ assert_valid_http_uri(import_manifest, "Import manifest uri location is not a valid http uri.")
37
+ get import_manifest
38
+ assert_response_status(200)
39
+ assert_valid_json(request.response_body, "Data received from request is not a valid JSON")
40
+ manifest = request.response_body
41
+ else
42
+ assert_valid_json(import_manifest, "JSON inputted was not in a valid format")
43
+ manifest = import_manifest
44
+ end
45
+
46
+ resource = FHIR::Json.from_json(manifest)
47
+ assert resource.is_a?(FHIR::Model), "Could not generate a valid resource from the input provided"
48
+
49
+ if resource.is_a?(FHIR::Model)
50
+ manifest_resources << resource
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,54 @@
1
+ require 'json'
2
+
3
+ module UDSPlusTestKit
4
+ class ReadMedicationRequestTest < Inferno::Test
5
+ id :uds_plus_read_medication_request_test
6
+ title 'Receive UDS+ Medication Request Data'
7
+ description %(
8
+ Test takes from the user either: the http location of medication request data
9
+ or the raw JSON of the data itself.
10
+ It attempts to GET the data stored at the given location if a link is provided,
11
+ then validates whether a FHIR resource can be generated from the input data.
12
+ )
13
+
14
+ input :medication_request_data,
15
+ title: 'Medication Request Data',
16
+ optional: true,
17
+ description: %q(
18
+ User can input the data as:
19
+ a URL link to the location of the data (ex: http://www.example.com/medication_request_data.json)
20
+ OR a JSON string that composes the data. Leaving this blank will skip the test.
21
+ )
22
+
23
+ def data_scratch
24
+ scratch[:data_resources] ||= {}
25
+ end
26
+
27
+ def data_to_test
28
+ data_scratch['MedicationRequest'] ||= []
29
+ end
30
+
31
+ run do
32
+ omit_if !medication_request_data.present?, "No data provided; skipping test."
33
+
34
+ # if the input is a url, else it is a json
35
+ if medication_request_data.strip[0] != '{'
36
+ assert_valid_http_uri(medication_request_data, "Location provided is not a valid http uri.")
37
+ get medication_request_data
38
+ assert_response_status(200)
39
+ assert_valid_json(request.response_body, "Data received from request is not a valid JSON")
40
+ data = request.response_body
41
+ else
42
+ assert_valid_json(medication_request_data, "JSON inputted was not in a valid format")
43
+ data = medication_request_data
44
+ end
45
+
46
+ resource = FHIR::Json.from_json(data)
47
+ assert resource.is_a?(FHIR::Model), "Could not generate a valid resource from the input provided"
48
+
49
+ if resource.is_a?(FHIR::Model)
50
+ data_to_test << resource
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,54 @@
1
+ require 'json'
2
+
3
+ module UDSPlusTestKit
4
+ class ReadMedicationStatementTest < Inferno::Test
5
+ id :uds_plus_read_medication_statement_test
6
+ title 'Receive UDS+ Medication Statement Data'
7
+ description %(
8
+ Test takes from the user either: the http location of medication statement data
9
+ or the raw JSON of the data itself.
10
+ It attempts to GET the data stored at the given location if a link is provided,
11
+ then validates whether a FHIR resource can be generated from the input data.
12
+ )
13
+
14
+ input :medication_statement_data,
15
+ title: 'Medication Statement Data',
16
+ optional: true,
17
+ description: %q(
18
+ User can input the data as:
19
+ a URL link to the location of the data (ex: http://www.example.com/medication_statement_data.json)
20
+ OR a JSON string that composes the data. Leaving this blank will skip the test.
21
+ )
22
+
23
+ def data_scratch
24
+ scratch[:data_resources] ||= {}
25
+ end
26
+
27
+ def data_to_test
28
+ data_scratch['MedicationStatement'] ||= []
29
+ end
30
+
31
+ run do
32
+ omit_if !medication_statement_data.present?, "No data provided; skipping test."
33
+
34
+ # if the input is a url, else it is a json
35
+ if medication_statement_data.strip[0] != '{'
36
+ assert_valid_http_uri(medication_statement_data, "Location provided is not a valid http uri.")
37
+ get medication_statement_data
38
+ assert_response_status(200)
39
+ assert_valid_json(request.response_body, "Data received from request is not a valid JSON")
40
+ data = request.response_body
41
+ else
42
+ assert_valid_json(medication_statement_data, "JSON inputted was not in a valid format")
43
+ data = medication_statement_data
44
+ end
45
+
46
+ resource = FHIR::Json.from_json(data)
47
+ assert resource.is_a?(FHIR::Model), "Could not generate a valid resource from the input provided"
48
+
49
+ if resource.is_a?(FHIR::Model)
50
+ data_to_test << resource
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,54 @@
1
+ require 'json'
2
+
3
+ module UDSPlusTestKit
4
+ class ReadRelatedPersonTest < Inferno::Test
5
+ id :uds_plus_read_related_person_test
6
+ title 'Receive UDS+ Related Person Data'
7
+ description %(
8
+ Test takes from the user either: the http location of related person data
9
+ or the raw JSON of the data itself.
10
+ It attempts to GET the data stored at the given location if a link is provided,
11
+ then validates whether a FHIR resource can be generated from the input data.
12
+ )
13
+
14
+ input :related_person_data,
15
+ title: 'Related Person Data',
16
+ optional: true,
17
+ description: %q(
18
+ User can input the data as:
19
+ a URL link to the location of the data (ex: http://www.example.com/related_person_data.json)
20
+ OR a JSON string that composes the data. Leaving this blank will skip the test.
21
+ )
22
+
23
+ def data_scratch
24
+ scratch[:data_resources] ||= {}
25
+ end
26
+
27
+ def data_to_test
28
+ data_scratch['RelatedPerson'] ||= []
29
+ end
30
+
31
+ run do
32
+ omit_if !related_person_data.present?, "No data provided; skipping test."
33
+
34
+ # if the input is a url, else it is a json
35
+ if related_person_data.strip[0] != '{'
36
+ assert_valid_http_uri(related_person_data, "Location provided is not a valid http uri.")
37
+ get related_person_data
38
+ assert_response_status(200)
39
+ assert_valid_json(request.response_body, "Data received from request is not a valid JSON")
40
+ data = request.response_body
41
+ else
42
+ assert_valid_json(related_person_data, "JSON inputted was not in a valid format")
43
+ data = related_person_data
44
+ end
45
+
46
+ resource = FHIR::Json.from_json(data)
47
+ assert resource.is_a?(FHIR::Model), "Could not generate a valid resource from the input provided"
48
+
49
+ if resource.is_a?(FHIR::Model)
50
+ data_to_test << resource
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,54 @@
1
+ require 'json'
2
+
3
+ module UDSPlusTestKit
4
+ class ReadServiceRequestTest < Inferno::Test
5
+ id :uds_plus_read_service_request_test
6
+ title 'Receive UDS+ Service Request Data'
7
+ description %(
8
+ Test takes from the user either: the http location of service request data
9
+ or the raw JSON of the data itself.
10
+ It attempts to GET the data stored at the given location if a link is provided,
11
+ then validates whether a FHIR resource can be generated from the input data.
12
+ )
13
+
14
+ input :service_request_data,
15
+ title: 'Service Request Data',
16
+ optional: true,
17
+ description: %q(
18
+ User can input the data as:
19
+ a URL link to the location of the data (ex: http://www.example.com/service_request_data.json)
20
+ OR a JSON string that composes the data. Leaving this blank will skip the test.
21
+ )
22
+
23
+ def data_scratch
24
+ scratch[:data_resources] ||= {}
25
+ end
26
+
27
+ def data_to_test
28
+ data_scratch['ServiceRequest'] ||= []
29
+ end
30
+
31
+ run do
32
+ omit_if !service_request_data.present?, "No data provided; skipping test."
33
+
34
+ # if the input is a url, else it is a json
35
+ if service_request_data.strip[0] != '{'
36
+ assert_valid_http_uri(service_request_data, "Location provided is not a valid http uri.")
37
+ get service_request_data
38
+ assert_response_status(200)
39
+ assert_valid_json(request.response_body, "Data received from request is not a valid JSON")
40
+ data = request.response_body
41
+ else
42
+ assert_valid_json(service_request_data, "JSON inputted was not in a valid format")
43
+ data = service_request_data
44
+ end
45
+
46
+ resource = FHIR::Json.from_json(data)
47
+ assert resource.is_a?(FHIR::Model), "Could not generate a valid resource from the input provided"
48
+
49
+ if resource.is_a?(FHIR::Model)
50
+ data_to_test << resource
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,54 @@
1
+ require 'json'
2
+
3
+ module UDSPlusTestKit
4
+ class ReadSpecialObservationTest < Inferno::Test
5
+ id :uds_plus_read_special_observation_test
6
+ title 'Receive UDS+ Special Observation Data'
7
+ description %(
8
+ Test takes from the user either: the http location of special observation data
9
+ (such as uds-special-population-observation) or the raw JSON of the data itself.
10
+ It attempts to GET the data stored at the given location if a link is provided,
11
+ then validates whether a FHIR resource can be generated from the input data.
12
+ )
13
+
14
+ input :special_observation_data,
15
+ title: 'Special Observation Data',
16
+ optional: true,
17
+ description: %q(
18
+ User can input the data as:
19
+ a URL link to the location of the data (ex: http://www.example.com/special_observation_data.json)
20
+ OR a JSON string that composes the data. Leaving this blank will skip the test.
21
+ )
22
+
23
+ def data_scratch
24
+ scratch[:data_resources] ||= {}
25
+ end
26
+
27
+ def data_to_test
28
+ data_scratch['Observation'] ||= []
29
+ end
30
+
31
+ run do
32
+ omit_if !special_observation_data.present?, "No data provided; skipping test."
33
+
34
+ # if the input is a url, else it is a json
35
+ if special_observation_data.strip[0] != '{'
36
+ assert_valid_http_uri(special_observation_data, "Location provided is not a valid http uri.")
37
+ get special_observation_data
38
+ assert_response_status(200)
39
+ assert_valid_json(request.response_body, "Data received from request is not a valid JSON")
40
+ data = request.response_body
41
+ else
42
+ assert_valid_json(special_observation_data, "JSON inputted was not in a valid format")
43
+ data = special_observation_data
44
+ end
45
+
46
+ resource = FHIR::Json.from_json(data)
47
+ assert resource.is_a?(FHIR::Model), "Could not generate a valid resource from the input provided"
48
+
49
+ if resource.is_a?(FHIR::Model)
50
+ data_to_test << resource
51
+ end
52
+ end
53
+ end
54
+ end
@@ -13,8 +13,22 @@ require_relative '../validate_income_test'
13
13
  require_relative '../validate_patient_test'
14
14
  require_relative '../validate_procedure_test'
15
15
  require_relative '../validate_sexual_orientation_test'
16
- require_relative '../manifest_tests/read_manifest_test'
16
+ require_relative './read_manifest_ind_test'
17
17
  require_relative '../manifest_tests/validate_manifest_test'
18
+ require_relative './read_special_observation_test'
19
+ require_relative '../validate_special_observation_test'
20
+ require_relative './read_related_person_test'
21
+ require_relative '../validate_related_person_test'
22
+ require_relative './read_immunization_test'
23
+ require_relative '../validate_immunization_test'
24
+ require_relative './read_lab_test'
25
+ require_relative '../validate_lab_test'
26
+ require_relative './read_med_request_test'
27
+ require_relative '../validate_med_request_test'
28
+ require_relative './read_med_statement_test'
29
+ require_relative '../validate_med_statement_test'
30
+ require_relative './read_service_request_test'
31
+ require_relative '../validate_service_request_test'
18
32
 
19
33
  module UDSPlusTestKit
20
34
  class UDSPlusResourceTestGroup < Inferno::TestGroup
@@ -31,7 +45,7 @@ module UDSPlusTestKit
31
45
 
32
46
  run_as_group
33
47
 
34
- test from: :uds_plus_read_manifest_test
48
+ test from: :uds_plus_read_manifest_ind_test
35
49
  test from: :uds_plus_validate_manifest_test
36
50
  test from: :uds_plus_read_coverage_test
37
51
  test from: :uds_plus_validate_coverage_test
@@ -39,13 +53,27 @@ module UDSPlusTestKit
39
53
  test from: :uds_plus_validate_diagnosis_test
40
54
  test from: :uds_plus_read_encounter_test
41
55
  test from: :uds_plus_validate_encounter_test
42
- test from: :uds_plus_read_income_test
43
- test from: :uds_plus_validate_income_test
44
56
  test from: :uds_plus_read_patient_test
45
57
  test from: :uds_plus_validate_patient_test
46
58
  test from: :uds_plus_read_procedure_test
47
59
  test from: :uds_plus_validate_procedure_test
60
+ test from: :uds_plus_read_related_person_test
61
+ test from: :uds_plus_validate_related_person_test
62
+ test from: :uds_plus_read_immunization_test
63
+ test from: :uds_plus_validate_immunization_test
64
+ test from: :uds_plus_read_income_test
65
+ test from: :uds_plus_validate_income_test
48
66
  test from: :uds_plus_read_sexual_orientation_test
49
67
  test from: :uds_plus_validate_sexual_orientation_test
68
+ test from: :uds_plus_read_lab_test
69
+ test from: :uds_plus_validate_lab_test
70
+ test from: :uds_plus_read_special_observation_test
71
+ test from: :uds_plus_read_medication_request_test
72
+ test from: :uds_plus_validate_medication_request_test
73
+ test from: :uds_plus_read_medication_statement_test
74
+ test from: :uds_plus_validate_medication_statement_test
75
+ test from: :uds_plus_read_service_request_test
76
+ test from: :uds_plus_validate_service_request_test
77
+ test from: :uds_plus_validate_special_observation_test
50
78
  end
51
79
  end
@@ -17,7 +17,10 @@ module UDSPlusTestKit
17
17
  def valid_data_types
18
18
  [
19
19
  'Coverage', 'Condition', 'Encounter',
20
- 'Observation', 'Patient', 'Procedure'
20
+ 'Observation', 'Patient', 'Procedure',
21
+ 'RelatedPerson', 'Immunization',
22
+ 'ServiceRequest', 'MedicationRequest',
23
+ 'MedicationStatement'
21
24
  ]
22
25
  end
23
26
 
@@ -10,10 +10,17 @@ require_relative './validate_manifest_test'
10
10
  require_relative '../validate_patient_test'
11
11
  require_relative '../validate_procedure_test'
12
12
  require_relative '../validate_sexual_orientation_test'
13
+ require_relative '../validate_special_observation_test'
14
+ require_relative '../validate_related_person_test'
15
+ require_relative '../validate_immunization_test'
16
+ require_relative '../validate_lab_test'
17
+ require_relative '../validate_med_request_test'
18
+ require_relative '../validate_med_statement_test'
19
+ require_relative '../validate_service_request_test'
13
20
 
14
21
  module UDSPlusTestKit
15
22
  class UDSPlusTestGroup < Inferno::TestGroup
16
- title 'Data Submitter Tests'
23
+ title 'Import Manifest Tests'
17
24
  id :uds_plus_test_group
18
25
  description %(
19
26
  The tests below validate the import manifest produced by a UDS+ Data Submitter.
@@ -30,10 +37,17 @@ module UDSPlusTestKit
30
37
  test from: :uds_plus_validate_coverage_test
31
38
  test from: :uds_plus_validate_diagnosis_test
32
39
  test from: :uds_plus_validate_encounter_test
33
- test from: :uds_plus_validate_income_test
34
40
  test from: :uds_plus_validate_patient_test
35
41
  test from: :uds_plus_validate_procedure_test
42
+ test from: :uds_plus_validate_related_person_test
43
+ test from: :uds_plus_validate_immunization_test
44
+ test from: :uds_plus_validate_income_test
36
45
  test from: :uds_plus_validate_sexual_orientation_test
46
+ test from: :uds_plus_validate_lab_test
47
+ test from: :uds_plus_validate_special_observation_test
48
+ test from: :uds_plus_validate_medication_request_test
49
+ test from: :uds_plus_validate_medication_statement_test
50
+ test from: :uds_plus_validate_service_request_test
37
51
  test from: :uds_plus_invalid_type_test
38
52
  end
39
53
  end