Module: AUCoreTestKit::ValidationTest
- Includes:
- AssertHelpers, ValidatorHelpers
- Included in:
- AUCoreV100::AllergyIntoleranceValidationTest, AUCoreV100::BloodpressureValidationTest, AUCoreV100::BodyheightValidationTest, AUCoreV100::BodytempValidationTest, AUCoreV100::BodyweightValidationTest, AUCoreV100::ConditionValidationTest, AUCoreV100::DiagnosticresultPathValidationTest, AUCoreV100::DiagnosticresultValidationTest, AUCoreV100::EncounterValidationTest, AUCoreV100::HeartrateValidationTest, AUCoreV100::ImmunizationValidationTest, AUCoreV100::LocationValidationTest, AUCoreV100::MedicationRequestValidationTest, AUCoreV100::MedicationValidationTest, AUCoreV100::OrganizationValidationTest, AUCoreV100::PatientValidationTest, AUCoreV100::PractitionerRoleValidationTest, AUCoreV100::PractitionerValidationTest, AUCoreV100::ProcedureValidationTest, AUCoreV100::ResprateValidationTest, AUCoreV100::SmokingstatusValidationTest, AUCoreV100::WaistcircumValidationTest, AUCoreV110_PREVIEW::AllergyIntoleranceValidationTest, AUCoreV110_PREVIEW::BloodpressureValidationTest, AUCoreV110_PREVIEW::BodyheightValidationTest, AUCoreV110_PREVIEW::BodytempValidationTest, AUCoreV110_PREVIEW::BodyweightValidationTest, AUCoreV110_PREVIEW::ConditionValidationTest, AUCoreV110_PREVIEW::DiagnosticresultPathValidationTest, AUCoreV110_PREVIEW::DiagnosticresultValidationTest, AUCoreV110_PREVIEW::EncounterValidationTest, AUCoreV110_PREVIEW::HeartrateValidationTest, AUCoreV110_PREVIEW::ImmunizationValidationTest, AUCoreV110_PREVIEW::LocationValidationTest, AUCoreV110_PREVIEW::MedicationRequestValidationTest, AUCoreV110_PREVIEW::MedicationStatementValidationTest, AUCoreV110_PREVIEW::MedicationValidationTest, AUCoreV110_PREVIEW::OrganizationValidationTest, AUCoreV110_PREVIEW::PatientValidationTest, AUCoreV110_PREVIEW::PractitionerRoleValidationTest, AUCoreV110_PREVIEW::PractitionerValidationTest, AUCoreV110_PREVIEW::ProcedureValidationTest, AUCoreV110_PREVIEW::RelatedPersonValidationTest, AUCoreV110_PREVIEW::ResprateValidationTest, AUCoreV110_PREVIEW::SmokingstatusValidationTest, AUCoreV110_PREVIEW::WaistcircumValidationTest, AUCoreV200_BALLOT::AllergyIntoleranceValidationTest, AUCoreV200_BALLOT::BloodpressureValidationTest, AUCoreV200_BALLOT::BodyheightValidationTest, AUCoreV200_BALLOT::BodytempValidationTest, AUCoreV200_BALLOT::BodyweightValidationTest, AUCoreV200_BALLOT::ConditionValidationTest, AUCoreV200_BALLOT::DiagnosticresultPathValidationTest, AUCoreV200_BALLOT::DiagnosticresultValidationTest, AUCoreV200_BALLOT::EncounterValidationTest, AUCoreV200_BALLOT::HealthcareServiceValidationTest, AUCoreV200_BALLOT::HeartrateValidationTest, AUCoreV200_BALLOT::ImmunizationValidationTest, AUCoreV200_BALLOT::LocationValidationTest, AUCoreV200_BALLOT::MedicationRequestValidationTest, AUCoreV200_BALLOT::MedicationStatementValidationTest, AUCoreV200_BALLOT::MedicationValidationTest, AUCoreV200_BALLOT::OrganizationValidationTest, AUCoreV200_BALLOT::PatientValidationTest, AUCoreV200_BALLOT::PractitionerRoleValidationTest, AUCoreV200_BALLOT::PractitionerValidationTest, AUCoreV200_BALLOT::ProcedureValidationTest, AUCoreV200_BALLOT::RelatedPersonValidationTest, AUCoreV200_BALLOT::ResprateValidationTest, AUCoreV200_BALLOT::SmokingstatusValidationTest, AUCoreV200_BALLOT::WaistcircumValidationTest, AUCoreV200_DRAFT::AllergyIntoleranceValidationTest, AUCoreV200_DRAFT::BloodpressureValidationTest, AUCoreV200_DRAFT::BodyheightValidationTest, AUCoreV200_DRAFT::BodytempValidationTest, AUCoreV200_DRAFT::BodyweightValidationTest, AUCoreV200_DRAFT::ConditionValidationTest, AUCoreV200_DRAFT::DiagnosticresultPathValidationTest, AUCoreV200_DRAFT::DiagnosticresultValidationTest, AUCoreV200_DRAFT::EncounterValidationTest, AUCoreV200_DRAFT::HealthcareServiceValidationTest, AUCoreV200_DRAFT::HeartrateValidationTest, AUCoreV200_DRAFT::ImmunizationValidationTest, AUCoreV200_DRAFT::LocationValidationTest, AUCoreV200_DRAFT::MedicationRequestValidationTest, AUCoreV200_DRAFT::MedicationStatementValidationTest, AUCoreV200_DRAFT::MedicationValidationTest, AUCoreV200_DRAFT::OrganizationValidationTest, AUCoreV200_DRAFT::PatientValidationTest, AUCoreV200_DRAFT::PractitionerRoleValidationTest, AUCoreV200_DRAFT::PractitionerValidationTest, AUCoreV200_DRAFT::ProcedureValidationTest, AUCoreV200_DRAFT::RelatedPersonValidationTest, AUCoreV200_DRAFT::ResprateValidationTest, AUCoreV200_DRAFT::SmokingstatusValidationTest, AUCoreV200_DRAFT::WaistcircumValidationTest, AUCoreV200_PREVIEW::AllergyIntoleranceValidationTest, AUCoreV200_PREVIEW::BloodpressureValidationTest, AUCoreV200_PREVIEW::BodyheightValidationTest, AUCoreV200_PREVIEW::BodytempValidationTest, AUCoreV200_PREVIEW::BodyweightValidationTest, AUCoreV200_PREVIEW::ConditionValidationTest, AUCoreV200_PREVIEW::DiagnosticresultPathValidationTest, AUCoreV200_PREVIEW::DiagnosticresultValidationTest, AUCoreV200_PREVIEW::EncounterValidationTest, AUCoreV200_PREVIEW::HealthcareServiceValidationTest, AUCoreV200_PREVIEW::HeartrateValidationTest, AUCoreV200_PREVIEW::ImmunizationValidationTest, AUCoreV200_PREVIEW::LocationValidationTest, AUCoreV200_PREVIEW::MedicationRequestValidationTest, AUCoreV200_PREVIEW::MedicationStatementValidationTest, AUCoreV200_PREVIEW::MedicationValidationTest, AUCoreV200_PREVIEW::OrganizationValidationTest, AUCoreV200_PREVIEW::PatientValidationTest, AUCoreV200_PREVIEW::PractitionerRoleValidationTest, AUCoreV200_PREVIEW::PractitionerValidationTest, AUCoreV200_PREVIEW::ProcedureValidationTest, AUCoreV200_PREVIEW::RelatedPersonValidationTest, AUCoreV200_PREVIEW::ResprateValidationTest, AUCoreV200_PREVIEW::SmokingstatusValidationTest, AUCoreV200_PREVIEW::WaistcircumValidationTest
- Defined in:
- lib/au_core_test_kit/validation_test.rb
Constant Summary collapse
- DAR_CODE_SYSTEM_URL =
'http://terminology.hl7.org/CodeSystem/data-absent-reason'- DAR_EXTENSION_URL =
'http://hl7.org/fhir/StructureDefinition/data-absent-reason'
Constants included from ValidatorHelpers
ValidatorHelpers::DEFAULT_VALUE, ValidatorHelpers::RESPONSE_KEYS, ValidatorHelpers::RESPONSE_VALIDATOR_KEY, ValidatorHelpers::RESPONSE_WRAPPER_KEY, ValidatorHelpers::VALIDATOR_KEY, ValidatorHelpers::WRAPPER_KEY
Instance Method Summary collapse
- #check_for_dar(resource) ⇒ Object
- #check_for_dar_code(coding) ⇒ Object
- #check_for_dar_extension(resource) ⇒ Object
- #perform_validation_test(resources, profile_url, profile_version, skip_if_empty: true) ⇒ Object
Methods included from ValidatorHelpers
Methods included from AssertHelpers
#act_if_with_message, #act_with_message, #conditional_skip_with_msg, #skip_with_msg
Instance Method Details
#check_for_dar(resource) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/au_core_test_kit/validation_test.rb', line 37 def check_for_dar(resource) unless scratch[:dar_code_found] resource.each_element do |element, , _path| next unless element.is_a?(FHIR::Coding) check_for_dar_code(element) end end return if scratch[:dar_extension_found] check_for_dar_extension(resource) end |
#check_for_dar_code(coding) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/au_core_test_kit/validation_test.rb', line 51 def check_for_dar_code(coding) return unless coding.code == 'unknown' && coding.system == DAR_CODE_SYSTEM_URL scratch[:dar_code_found] = true output dar_code_found: 'true' end |
#check_for_dar_extension(resource) ⇒ Object
58 59 60 61 62 63 |
# File 'lib/au_core_test_kit/validation_test.rb', line 58 def check_for_dar_extension(resource) return unless resource.source_contents&.include? DAR_EXTENSION_URL scratch[:dar_extension_found] = true output dar_extension_found: 'true' end |
#perform_validation_test(resources, profile_url, profile_version, skip_if_empty: true) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/au_core_test_kit/validation_test.rb', line 14 def perform_validation_test(resources, profile_url, profile_version, skip_if_empty: true) conditional_skip_with_msg skip_if_empty && resources.blank?, "No #{resource_type} resources conforming to the #{profile_url} profile were returned" omit_if resources.blank?, "No #{resource_type} resources provided so the #{profile_url} profile does not apply" show_validator_version profile_with_version = "#{profile_url}|#{profile_version}" resources.each do |resource| resource_is_valid?(resource:, profile_url: profile_with_version) check_for_dar(resource) end errors_found = .any? { || [:type] == 'error' } assert !errors_found, "Resource does not conform to the profile #{profile_with_version}" end |