us_core_test_kit 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +201 -0
- data/lib/us_core_test_kit/custom_groups/capability_statement/conformance_support_test.rb +41 -0
- data/lib/us_core_test_kit/custom_groups/capability_statement/fhir_version_test.rb +15 -0
- data/lib/us_core_test_kit/custom_groups/capability_statement/json_support_test.rb +40 -0
- data/lib/us_core_test_kit/custom_groups/capability_statement/profile_support_test.rb +90 -0
- data/lib/us_core_test_kit/custom_groups/capability_statement_group.rb +64 -0
- data/lib/us_core_test_kit/custom_groups/clinical_notes_guidance_group.rb +208 -0
- data/lib/us_core_test_kit/custom_groups/data_absent_reason_group.rb +59 -0
- data/lib/us_core_test_kit/date_search_validation.rb +101 -0
- data/lib/us_core_test_kit/ext/fhir_models.rb +59 -0
- data/lib/us_core_test_kit/fhir_resource_navigation.rb +63 -0
- data/lib/us_core_test_kit/generated/allergy_intolerance/allergy_intolerance_must_support_test.rb +40 -0
- data/lib/us_core_test_kit/generated/allergy_intolerance/allergy_intolerance_patient_clinical_status_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/allergy_intolerance/allergy_intolerance_patient_search_test.rb +60 -0
- data/lib/us_core_test_kit/generated/allergy_intolerance/allergy_intolerance_provenance_revinclude_search_test.rb +49 -0
- data/lib/us_core_test_kit/generated/allergy_intolerance/allergy_intolerance_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/allergy_intolerance/allergy_intolerance_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/allergy_intolerance/allergy_intolerance_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/allergy_intolerance_group.rb +85 -0
- data/lib/us_core_test_kit/generated/bodyheight/bodyheight_must_support_test.rb +49 -0
- data/lib/us_core_test_kit/generated/bodyheight/bodyheight_patient_category_date_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/bodyheight/bodyheight_patient_category_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/bodyheight/bodyheight_patient_category_status_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/bodyheight/bodyheight_patient_code_date_search_test.rb +48 -0
- data/lib/us_core_test_kit/generated/bodyheight/bodyheight_patient_code_search_test.rb +62 -0
- data/lib/us_core_test_kit/generated/bodyheight/bodyheight_provenance_revinclude_search_test.rb +51 -0
- data/lib/us_core_test_kit/generated/bodyheight/bodyheight_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/bodyheight/bodyheight_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/bodyheight/bodyheight_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/bodyheight_group.rb +93 -0
- data/lib/us_core_test_kit/generated/bodytemp/bodytemp_must_support_test.rb +49 -0
- data/lib/us_core_test_kit/generated/bodytemp/bodytemp_patient_category_date_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/bodytemp/bodytemp_patient_category_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/bodytemp/bodytemp_patient_category_status_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/bodytemp/bodytemp_patient_code_date_search_test.rb +48 -0
- data/lib/us_core_test_kit/generated/bodytemp/bodytemp_patient_code_search_test.rb +62 -0
- data/lib/us_core_test_kit/generated/bodytemp/bodytemp_provenance_revinclude_search_test.rb +51 -0
- data/lib/us_core_test_kit/generated/bodytemp/bodytemp_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/bodytemp/bodytemp_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/bodytemp/bodytemp_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/bodytemp_group.rb +93 -0
- data/lib/us_core_test_kit/generated/bodyweight/bodyweight_must_support_test.rb +49 -0
- data/lib/us_core_test_kit/generated/bodyweight/bodyweight_patient_category_date_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/bodyweight/bodyweight_patient_category_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/bodyweight/bodyweight_patient_category_status_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/bodyweight/bodyweight_patient_code_date_search_test.rb +48 -0
- data/lib/us_core_test_kit/generated/bodyweight/bodyweight_patient_code_search_test.rb +62 -0
- data/lib/us_core_test_kit/generated/bodyweight/bodyweight_provenance_revinclude_search_test.rb +51 -0
- data/lib/us_core_test_kit/generated/bodyweight/bodyweight_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/bodyweight/bodyweight_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/bodyweight/bodyweight_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/bodyweight_group.rb +93 -0
- data/lib/us_core_test_kit/generated/bp/bp_must_support_test.rb +52 -0
- data/lib/us_core_test_kit/generated/bp/bp_patient_category_date_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/bp/bp_patient_category_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/bp/bp_patient_category_status_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/bp/bp_patient_code_date_search_test.rb +48 -0
- data/lib/us_core_test_kit/generated/bp/bp_patient_code_search_test.rb +62 -0
- data/lib/us_core_test_kit/generated/bp/bp_provenance_revinclude_search_test.rb +51 -0
- data/lib/us_core_test_kit/generated/bp/bp_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/bp/bp_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/bp/bp_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/bp_group.rb +93 -0
- data/lib/us_core_test_kit/generated/care_plan/care_plan_must_support_test.rb +41 -0
- data/lib/us_core_test_kit/generated/care_plan/care_plan_patient_category_date_search_test.rb +48 -0
- data/lib/us_core_test_kit/generated/care_plan/care_plan_patient_category_search_test.rb +62 -0
- data/lib/us_core_test_kit/generated/care_plan/care_plan_patient_category_status_date_search_test.rb +48 -0
- data/lib/us_core_test_kit/generated/care_plan/care_plan_patient_category_status_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/care_plan/care_plan_provenance_revinclude_search_test.rb +51 -0
- data/lib/us_core_test_kit/generated/care_plan/care_plan_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/care_plan/care_plan_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/care_plan/care_plan_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/care_plan_group.rb +89 -0
- data/lib/us_core_test_kit/generated/care_team/care_team_must_support_test.rb +39 -0
- data/lib/us_core_test_kit/generated/care_team/care_team_patient_status_search_test.rb +62 -0
- data/lib/us_core_test_kit/generated/care_team/care_team_provenance_revinclude_search_test.rb +50 -0
- data/lib/us_core_test_kit/generated/care_team/care_team_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/care_team/care_team_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/care_team/care_team_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/care_team_group.rb +83 -0
- data/lib/us_core_test_kit/generated/condition/condition_must_support_test.rb +39 -0
- data/lib/us_core_test_kit/generated/condition/condition_patient_category_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/condition/condition_patient_clinical_status_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/condition/condition_patient_code_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/condition/condition_patient_onset_date_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/condition/condition_patient_search_test.rb +60 -0
- data/lib/us_core_test_kit/generated/condition/condition_provenance_revinclude_search_test.rb +49 -0
- data/lib/us_core_test_kit/generated/condition/condition_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/condition/condition_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/condition/condition_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/condition_group.rb +91 -0
- data/lib/us_core_test_kit/generated/device/device_must_support_test.rb +43 -0
- data/lib/us_core_test_kit/generated/device/device_patient_search_test.rb +65 -0
- data/lib/us_core_test_kit/generated/device/device_patient_type_search_test.rb +52 -0
- data/lib/us_core_test_kit/generated/device/device_provenance_revinclude_search_test.rb +49 -0
- data/lib/us_core_test_kit/generated/device/device_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/device/device_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/device/device_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/device_group.rb +85 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_lab/diagnostic_report_lab_must_support_test.rb +43 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_lab/diagnostic_report_lab_patient_category_date_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_lab/diagnostic_report_lab_patient_category_search_test.rb +63 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_lab/diagnostic_report_lab_patient_code_date_search_test.rb +48 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_lab/diagnostic_report_lab_patient_code_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_lab/diagnostic_report_lab_patient_search_test.rb +44 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_lab/diagnostic_report_lab_patient_status_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_lab/diagnostic_report_lab_provenance_revinclude_search_test.rb +51 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_lab/diagnostic_report_lab_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_lab/diagnostic_report_lab_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_lab/diagnostic_report_lab_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_lab_group.rb +96 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_note/diagnostic_report_note_must_support_test.rb +43 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_note/diagnostic_report_note_patient_category_date_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_note/diagnostic_report_note_patient_category_search_test.rb +63 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_note/diagnostic_report_note_patient_code_date_search_test.rb +48 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_note/diagnostic_report_note_patient_code_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_note/diagnostic_report_note_patient_search_test.rb +44 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_note/diagnostic_report_note_patient_status_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_note/diagnostic_report_note_provenance_revinclude_search_test.rb +51 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_note/diagnostic_report_note_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_note/diagnostic_report_note_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_note/diagnostic_report_note_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/diagnostic_report_note_group.rb +96 -0
- data/lib/us_core_test_kit/generated/document_reference/document_reference_id_search_test.rb +40 -0
- data/lib/us_core_test_kit/generated/document_reference/document_reference_must_support_test.rb +49 -0
- data/lib/us_core_test_kit/generated/document_reference/document_reference_patient_category_date_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/document_reference/document_reference_patient_category_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/document_reference/document_reference_patient_search_test.rb +61 -0
- data/lib/us_core_test_kit/generated/document_reference/document_reference_patient_status_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/document_reference/document_reference_patient_type_period_search_test.rb +48 -0
- data/lib/us_core_test_kit/generated/document_reference/document_reference_patient_type_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/document_reference/document_reference_provenance_revinclude_search_test.rb +50 -0
- data/lib/us_core_test_kit/generated/document_reference/document_reference_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/document_reference/document_reference_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/document_reference/document_reference_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/document_reference_group.rb +99 -0
- data/lib/us_core_test_kit/generated/encounter/encounter_class_patient_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/encounter/encounter_date_patient_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/encounter/encounter_id_search_test.rb +40 -0
- data/lib/us_core_test_kit/generated/encounter/encounter_identifier_search_test.rb +43 -0
- data/lib/us_core_test_kit/generated/encounter/encounter_must_support_test.rb +51 -0
- data/lib/us_core_test_kit/generated/encounter/encounter_patient_search_test.rb +61 -0
- data/lib/us_core_test_kit/generated/encounter/encounter_patient_status_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/encounter/encounter_patient_type_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/encounter/encounter_provenance_revinclude_search_test.rb +50 -0
- data/lib/us_core_test_kit/generated/encounter/encounter_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/encounter/encounter_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/encounter/encounter_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/encounter_group.rb +97 -0
- data/lib/us_core_test_kit/generated/goal/goal_must_support_test.rb +39 -0
- data/lib/us_core_test_kit/generated/goal/goal_patient_lifecycle_status_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/goal/goal_patient_search_test.rb +60 -0
- data/lib/us_core_test_kit/generated/goal/goal_patient_target_date_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/goal/goal_provenance_revinclude_search_test.rb +49 -0
- data/lib/us_core_test_kit/generated/goal/goal_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/goal/goal_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/goal/goal_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/goal_group.rb +87 -0
- data/lib/us_core_test_kit/generated/head_circumference/head_circumference_must_support_test.rb +49 -0
- data/lib/us_core_test_kit/generated/head_circumference/head_circumference_patient_category_date_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/head_circumference/head_circumference_patient_category_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/head_circumference/head_circumference_patient_category_status_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/head_circumference/head_circumference_patient_code_date_search_test.rb +48 -0
- data/lib/us_core_test_kit/generated/head_circumference/head_circumference_patient_code_search_test.rb +62 -0
- data/lib/us_core_test_kit/generated/head_circumference/head_circumference_provenance_revinclude_search_test.rb +51 -0
- data/lib/us_core_test_kit/generated/head_circumference/head_circumference_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/head_circumference/head_circumference_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/head_circumference/head_circumference_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/head_circumference_group.rb +93 -0
- data/lib/us_core_test_kit/generated/heartrate/heartrate_must_support_test.rb +49 -0
- data/lib/us_core_test_kit/generated/heartrate/heartrate_patient_category_date_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/heartrate/heartrate_patient_category_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/heartrate/heartrate_patient_category_status_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/heartrate/heartrate_patient_code_date_search_test.rb +48 -0
- data/lib/us_core_test_kit/generated/heartrate/heartrate_patient_code_search_test.rb +62 -0
- data/lib/us_core_test_kit/generated/heartrate/heartrate_provenance_revinclude_search_test.rb +51 -0
- data/lib/us_core_test_kit/generated/heartrate/heartrate_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/heartrate/heartrate_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/heartrate/heartrate_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/heartrate_group.rb +93 -0
- data/lib/us_core_test_kit/generated/immunization/immunization_must_support_test.rb +40 -0
- data/lib/us_core_test_kit/generated/immunization/immunization_patient_date_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/immunization/immunization_patient_search_test.rb +60 -0
- data/lib/us_core_test_kit/generated/immunization/immunization_patient_status_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/immunization/immunization_provenance_revinclude_search_test.rb +50 -0
- data/lib/us_core_test_kit/generated/immunization/immunization_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/immunization/immunization_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/immunization/immunization_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/immunization_group.rb +87 -0
- data/lib/us_core_test_kit/generated/medication_request/medication_request_must_support_test.rb +44 -0
- data/lib/us_core_test_kit/generated/medication_request/medication_request_patient_intent_authoredon_search_test.rb +53 -0
- data/lib/us_core_test_kit/generated/medication_request/medication_request_patient_intent_encounter_search_test.rb +52 -0
- data/lib/us_core_test_kit/generated/medication_request/medication_request_patient_intent_search_test.rb +68 -0
- data/lib/us_core_test_kit/generated/medication_request/medication_request_patient_intent_status_search_test.rb +49 -0
- data/lib/us_core_test_kit/generated/medication_request/medication_request_provenance_revinclude_search_test.rb +51 -0
- data/lib/us_core_test_kit/generated/medication_request/medication_request_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/medication_request/medication_request_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/medication_request/medication_request_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/medication_request/medication_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/medication_request_group.rb +92 -0
- data/lib/us_core_test_kit/generated/observation_lab/observation_lab_must_support_test.rb +41 -0
- data/lib/us_core_test_kit/generated/observation_lab/observation_lab_patient_category_date_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/observation_lab/observation_lab_patient_category_search_test.rb +62 -0
- data/lib/us_core_test_kit/generated/observation_lab/observation_lab_patient_category_status_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/observation_lab/observation_lab_patient_code_date_search_test.rb +48 -0
- data/lib/us_core_test_kit/generated/observation_lab/observation_lab_patient_code_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/observation_lab/observation_lab_provenance_revinclude_search_test.rb +51 -0
- data/lib/us_core_test_kit/generated/observation_lab/observation_lab_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/observation_lab/observation_lab_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/observation_lab/observation_lab_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/observation_lab_group.rb +93 -0
- data/lib/us_core_test_kit/generated/organization/organization_address_search_test.rb +39 -0
- data/lib/us_core_test_kit/generated/organization/organization_must_support_test.rb +47 -0
- data/lib/us_core_test_kit/generated/organization/organization_name_search_test.rb +49 -0
- data/lib/us_core_test_kit/generated/organization/organization_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/organization/organization_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/organization/organization_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/organization_group.rb +84 -0
- data/lib/us_core_test_kit/generated/patient/patient_birthdate_family_search_test.rb +41 -0
- data/lib/us_core_test_kit/generated/patient/patient_birthdate_name_search_test.rb +39 -0
- data/lib/us_core_test_kit/generated/patient/patient_family_gender_search_test.rb +41 -0
- data/lib/us_core_test_kit/generated/patient/patient_gender_name_search_test.rb +39 -0
- data/lib/us_core_test_kit/generated/patient/patient_id_search_test.rb +53 -0
- data/lib/us_core_test_kit/generated/patient/patient_identifier_search_test.rb +40 -0
- data/lib/us_core_test_kit/generated/patient/patient_must_support_test.rb +57 -0
- data/lib/us_core_test_kit/generated/patient/patient_name_search_test.rb +39 -0
- data/lib/us_core_test_kit/generated/patient/patient_provenance_revinclude_search_test.rb +49 -0
- data/lib/us_core_test_kit/generated/patient/patient_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/patient/patient_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/patient/patient_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/patient_group.rb +99 -0
- data/lib/us_core_test_kit/generated/pediatric_bmi_for_age/pediatric_bmi_for_age_must_support_test.rb +49 -0
- data/lib/us_core_test_kit/generated/pediatric_bmi_for_age/pediatric_bmi_for_age_patient_category_date_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/pediatric_bmi_for_age/pediatric_bmi_for_age_patient_category_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/pediatric_bmi_for_age/pediatric_bmi_for_age_patient_category_status_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/pediatric_bmi_for_age/pediatric_bmi_for_age_patient_code_date_search_test.rb +48 -0
- data/lib/us_core_test_kit/generated/pediatric_bmi_for_age/pediatric_bmi_for_age_patient_code_search_test.rb +62 -0
- data/lib/us_core_test_kit/generated/pediatric_bmi_for_age/pediatric_bmi_for_age_provenance_revinclude_search_test.rb +51 -0
- data/lib/us_core_test_kit/generated/pediatric_bmi_for_age/pediatric_bmi_for_age_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/pediatric_bmi_for_age/pediatric_bmi_for_age_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/pediatric_bmi_for_age/pediatric_bmi_for_age_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/pediatric_bmi_for_age_group.rb +93 -0
- data/lib/us_core_test_kit/generated/pediatric_weight_for_height/pediatric_weight_for_height_must_support_test.rb +49 -0
- data/lib/us_core_test_kit/generated/pediatric_weight_for_height/pediatric_weight_for_height_patient_category_date_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/pediatric_weight_for_height/pediatric_weight_for_height_patient_category_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/pediatric_weight_for_height/pediatric_weight_for_height_patient_category_status_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/pediatric_weight_for_height/pediatric_weight_for_height_patient_code_date_search_test.rb +48 -0
- data/lib/us_core_test_kit/generated/pediatric_weight_for_height/pediatric_weight_for_height_patient_code_search_test.rb +62 -0
- data/lib/us_core_test_kit/generated/pediatric_weight_for_height/pediatric_weight_for_height_provenance_revinclude_search_test.rb +51 -0
- data/lib/us_core_test_kit/generated/pediatric_weight_for_height/pediatric_weight_for_height_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/pediatric_weight_for_height/pediatric_weight_for_height_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/pediatric_weight_for_height/pediatric_weight_for_height_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/pediatric_weight_for_height_group.rb +93 -0
- data/lib/us_core_test_kit/generated/practitioner/practitioner_identifier_search_test.rb +40 -0
- data/lib/us_core_test_kit/generated/practitioner/practitioner_must_support_test.rb +40 -0
- data/lib/us_core_test_kit/generated/practitioner/practitioner_name_search_test.rb +49 -0
- data/lib/us_core_test_kit/generated/practitioner/practitioner_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/practitioner/practitioner_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/practitioner/practitioner_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/practitioner_group.rb +84 -0
- data/lib/us_core_test_kit/generated/procedure/procedure_must_support_test.rb +38 -0
- data/lib/us_core_test_kit/generated/procedure/procedure_patient_code_date_search_test.rb +48 -0
- data/lib/us_core_test_kit/generated/procedure/procedure_patient_date_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/procedure/procedure_patient_search_test.rb +60 -0
- data/lib/us_core_test_kit/generated/procedure/procedure_patient_status_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/procedure/procedure_provenance_revinclude_search_test.rb +50 -0
- data/lib/us_core_test_kit/generated/procedure/procedure_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/procedure/procedure_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/procedure/procedure_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/procedure_group.rb +90 -0
- data/lib/us_core_test_kit/generated/provenance/provenance_must_support_test.rb +44 -0
- data/lib/us_core_test_kit/generated/provenance/provenance_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/provenance/provenance_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/provenance/provenance_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/provenance_group.rb +56 -0
- data/lib/us_core_test_kit/generated/pulse_oximetry/pulse_oximetry_must_support_test.rb +65 -0
- data/lib/us_core_test_kit/generated/pulse_oximetry/pulse_oximetry_patient_category_date_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/pulse_oximetry/pulse_oximetry_patient_category_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/pulse_oximetry/pulse_oximetry_patient_category_status_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/pulse_oximetry/pulse_oximetry_patient_code_date_search_test.rb +48 -0
- data/lib/us_core_test_kit/generated/pulse_oximetry/pulse_oximetry_patient_code_search_test.rb +62 -0
- data/lib/us_core_test_kit/generated/pulse_oximetry/pulse_oximetry_provenance_revinclude_search_test.rb +51 -0
- data/lib/us_core_test_kit/generated/pulse_oximetry/pulse_oximetry_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/pulse_oximetry/pulse_oximetry_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/pulse_oximetry/pulse_oximetry_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/pulse_oximetry_group.rb +93 -0
- data/lib/us_core_test_kit/generated/resource_list.rb +26 -0
- data/lib/us_core_test_kit/generated/resprate/resprate_must_support_test.rb +49 -0
- data/lib/us_core_test_kit/generated/resprate/resprate_patient_category_date_search_test.rb +46 -0
- data/lib/us_core_test_kit/generated/resprate/resprate_patient_category_search_test.rb +45 -0
- data/lib/us_core_test_kit/generated/resprate/resprate_patient_category_status_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/resprate/resprate_patient_code_date_search_test.rb +48 -0
- data/lib/us_core_test_kit/generated/resprate/resprate_patient_code_search_test.rb +62 -0
- data/lib/us_core_test_kit/generated/resprate/resprate_provenance_revinclude_search_test.rb +51 -0
- data/lib/us_core_test_kit/generated/resprate/resprate_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/resprate/resprate_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/resprate/resprate_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/resprate_group.rb +93 -0
- data/lib/us_core_test_kit/generated/smokingstatus/smokingstatus_must_support_test.rb +39 -0
- data/lib/us_core_test_kit/generated/smokingstatus/smokingstatus_patient_category_date_search_test.rb +48 -0
- data/lib/us_core_test_kit/generated/smokingstatus/smokingstatus_patient_category_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/smokingstatus/smokingstatus_patient_category_status_search_test.rb +47 -0
- data/lib/us_core_test_kit/generated/smokingstatus/smokingstatus_patient_code_date_search_test.rb +48 -0
- data/lib/us_core_test_kit/generated/smokingstatus/smokingstatus_patient_code_search_test.rb +62 -0
- data/lib/us_core_test_kit/generated/smokingstatus/smokingstatus_provenance_revinclude_search_test.rb +51 -0
- data/lib/us_core_test_kit/generated/smokingstatus/smokingstatus_read_test.rb +24 -0
- data/lib/us_core_test_kit/generated/smokingstatus/smokingstatus_reference_resolution_test.rb +28 -0
- data/lib/us_core_test_kit/generated/smokingstatus/smokingstatus_validation_test.rb +34 -0
- data/lib/us_core_test_kit/generated/smokingstatus_group.rb +93 -0
- data/lib/us_core_test_kit/generated/us_core_test_suite.rb +110 -0
- data/lib/us_core_test_kit/generator/group_generator.rb +171 -0
- data/lib/us_core_test_kit/generator/group_metadata.rb +98 -0
- data/lib/us_core_test_kit/generator/group_metadata_extractor.rb +281 -0
- data/lib/us_core_test_kit/generator/ig_loader.rb +63 -0
- data/lib/us_core_test_kit/generator/ig_metadata.rb +49 -0
- data/lib/us_core_test_kit/generator/ig_metadata_extractor.rb +56 -0
- data/lib/us_core_test_kit/generator/ig_resources.rb +48 -0
- data/lib/us_core_test_kit/generator/must_support_metadata_extractor.rb +221 -0
- data/lib/us_core_test_kit/generator/must_support_test_generator.rb +86 -0
- data/lib/us_core_test_kit/generator/naming.rb +58 -0
- data/lib/us_core_test_kit/generator/provenance_revinclude_search_test_generator.rb +186 -0
- data/lib/us_core_test_kit/generator/read_test_generator.rb +89 -0
- data/lib/us_core_test_kit/generator/reference_resolution_test_generator.rb +72 -0
- data/lib/us_core_test_kit/generator/resource_list_generator.rb +46 -0
- data/lib/us_core_test_kit/generator/search_definition_metadata_extractor.rb +181 -0
- data/lib/us_core_test_kit/generator/search_metadata_extractor.rb +74 -0
- data/lib/us_core_test_kit/generator/search_test_generator.rb +280 -0
- data/lib/us_core_test_kit/generator/special_cases.rb +17 -0
- data/lib/us_core_test_kit/generator/suite_generator.rb +67 -0
- data/lib/us_core_test_kit/generator/terminology_binding_metadata_extractor.rb +105 -0
- data/lib/us_core_test_kit/generator/validation_test_generator.rb +124 -0
- data/lib/us_core_test_kit/generator.rb +86 -0
- data/lib/us_core_test_kit/igs/StructureDefinition-bodyheight.json +3772 -0
- data/lib/us_core_test_kit/igs/StructureDefinition-bodytemp.json +3772 -0
- data/lib/us_core_test_kit/igs/StructureDefinition-bodyweight.json +3772 -0
- data/lib/us_core_test_kit/igs/StructureDefinition-bp.json +6034 -0
- data/lib/us_core_test_kit/igs/StructureDefinition-heartrate.json +3756 -0
- data/lib/us_core_test_kit/igs/StructureDefinition-resprate.json +3756 -0
- data/lib/us_core_test_kit/igs/package.tgz +0 -0
- data/lib/us_core_test_kit/must_support_test.rb +146 -0
- data/lib/us_core_test_kit/read_test.rb +62 -0
- data/lib/us_core_test_kit/reference_resolution_test.rb +111 -0
- data/lib/us_core_test_kit/request_logger.rb +46 -0
- data/lib/us_core_test_kit/search_test.rb +686 -0
- data/lib/us_core_test_kit/search_test_properties.rb +56 -0
- data/lib/us_core_test_kit/validation_test.rb +48 -0
- data/lib/us_core_test_kit/version.rb +3 -0
- data/lib/us_core_test_kit.rb +2 -0
- metadata +477 -0
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'active_support/all'
|
2
|
+
require 'fhir_models'
|
3
|
+
require 'rubygems/package'
|
4
|
+
require 'zlib'
|
5
|
+
require_relative 'ig_resources'
|
6
|
+
|
7
|
+
module USCoreTestKit
|
8
|
+
class Generator
|
9
|
+
class IGLoader
|
10
|
+
def ig_resources
|
11
|
+
@ig_resources ||= IGResources.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def load
|
15
|
+
load_ig
|
16
|
+
load_standalone_resources
|
17
|
+
end
|
18
|
+
|
19
|
+
def load_ig
|
20
|
+
tar = Gem::Package::TarReader.new(Zlib::GzipReader.open(File.join(__dir__, '..', 'igs', 'package.tgz')))
|
21
|
+
|
22
|
+
tar.each do |entry|
|
23
|
+
next if entry.directory?
|
24
|
+
|
25
|
+
file_name = entry.full_name.split('/').last
|
26
|
+
|
27
|
+
next unless file_name.end_with? '.json'
|
28
|
+
|
29
|
+
next unless entry.full_name.start_with? 'package/'
|
30
|
+
|
31
|
+
begin
|
32
|
+
resource = FHIR.from_contents(entry.read)
|
33
|
+
next if resource.nil?
|
34
|
+
rescue StandardError
|
35
|
+
puts "#{file_name} does not appear to be a FHIR resource."
|
36
|
+
next
|
37
|
+
end
|
38
|
+
|
39
|
+
ig_resources.add(resource)
|
40
|
+
end
|
41
|
+
|
42
|
+
ig_resources
|
43
|
+
end
|
44
|
+
|
45
|
+
def load_standalone_resources
|
46
|
+
Dir.glob(File.join(__dir__, '..', 'igs', '*.json')).each do |file_path|
|
47
|
+
begin
|
48
|
+
resource = FHIR.from_contents(File.read(file_path))
|
49
|
+
next if resource.nil?
|
50
|
+
rescue StandardError
|
51
|
+
file_name = file_path.split('/').last
|
52
|
+
puts "#{file_name} does not appear to be a FHIR resource."
|
53
|
+
next
|
54
|
+
end
|
55
|
+
|
56
|
+
ig_resources.add(resource)
|
57
|
+
end
|
58
|
+
|
59
|
+
ig_resources
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module USCoreTestKit
|
2
|
+
class Generator
|
3
|
+
class IGMetadata
|
4
|
+
attr_accessor :ig_version, :groups
|
5
|
+
|
6
|
+
def reformatted_version
|
7
|
+
@reformatted_version ||= ig_version.delete('.')
|
8
|
+
end
|
9
|
+
|
10
|
+
def ordered_groups
|
11
|
+
@ordered_groups ||=
|
12
|
+
[patient_group] + non_delayed_groups + delayed_groups
|
13
|
+
end
|
14
|
+
|
15
|
+
def patient_group
|
16
|
+
@patient_group ||=
|
17
|
+
groups.find { |group| group.resource == 'Patient' }
|
18
|
+
end
|
19
|
+
|
20
|
+
def delayed_groups
|
21
|
+
@delayed_groups ||=
|
22
|
+
groups.select { |group| group.delayed? }
|
23
|
+
end
|
24
|
+
|
25
|
+
def non_delayed_groups
|
26
|
+
@non_delayed_groups ||=
|
27
|
+
groups.reject { |group| group.delayed? } - [patient_group]
|
28
|
+
end
|
29
|
+
|
30
|
+
def delayed_profiles
|
31
|
+
@delayed_profiles ||=
|
32
|
+
delayed_groups.map(&:profile_url)
|
33
|
+
end
|
34
|
+
|
35
|
+
def postprocess_groups(ig_resources)
|
36
|
+
groups.each do |group|
|
37
|
+
group.add_delayed_references(delayed_profiles, ig_resources)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def to_hash
|
42
|
+
{
|
43
|
+
ig_version: ig_version,
|
44
|
+
groups: groups.map(&:to_hash)
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require_relative 'ig_metadata'
|
2
|
+
require_relative 'group_metadata_extractor'
|
3
|
+
|
4
|
+
module USCoreTestKit
|
5
|
+
class Generator
|
6
|
+
class IGMetadataExtractor
|
7
|
+
attr_accessor :ig_resources, :metadata
|
8
|
+
|
9
|
+
def initialize(ig_resources)
|
10
|
+
self.ig_resources = ig_resources
|
11
|
+
add_vital_signs_profiles
|
12
|
+
self.metadata = IGMetadata.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def extract
|
16
|
+
add_metadata_from_ig
|
17
|
+
add_metadata_from_resources
|
18
|
+
metadata
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_metadata_from_ig
|
22
|
+
metadata.ig_version = "v#{ig_resources.ig.version}"
|
23
|
+
end
|
24
|
+
|
25
|
+
def resources_in_capability_statement
|
26
|
+
ig_resources.capability_statement.rest.first.resource
|
27
|
+
end
|
28
|
+
|
29
|
+
# The US Core Server Capability Statement does not list support for the
|
30
|
+
# required vital signs profiles, so they need to be added
|
31
|
+
def add_vital_signs_profiles
|
32
|
+
ig_resources.capability_statement.rest.first.resource
|
33
|
+
.find { |resource| resource.type == 'Observation' }
|
34
|
+
.supportedProfile.concat [
|
35
|
+
'http://hl7.org/fhir/StructureDefinition/bodyheight',
|
36
|
+
'http://hl7.org/fhir/StructureDefinition/bodytemp',
|
37
|
+
'http://hl7.org/fhir/StructureDefinition/bp',
|
38
|
+
'http://hl7.org/fhir/StructureDefinition/bodyweight',
|
39
|
+
'http://hl7.org/fhir/StructureDefinition/heartrate',
|
40
|
+
'http://hl7.org/fhir/StructureDefinition/resprate'
|
41
|
+
]
|
42
|
+
end
|
43
|
+
|
44
|
+
def add_metadata_from_resources
|
45
|
+
metadata.groups =
|
46
|
+
resources_in_capability_statement.flat_map do |resource|
|
47
|
+
resource.supportedProfile&.map do |supported_profile|
|
48
|
+
GroupMetadataExtractor.new(resource, supported_profile, metadata, ig_resources).group_metadata
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
metadata.postprocess_groups(ig_resources)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module USCoreTestKit
|
2
|
+
class Generator
|
3
|
+
class IGResources
|
4
|
+
def add(resource)
|
5
|
+
resources_by_type[resource.resourceType] << resource
|
6
|
+
end
|
7
|
+
|
8
|
+
def capability_statement(mode = 'server')
|
9
|
+
resources_by_type['CapabilityStatement'].find do |capability_statement_resource|
|
10
|
+
capability_statement_resource.rest.any? { |r| r.mode == mode }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def ig
|
15
|
+
resources_by_type['ImplementationGuide'].first
|
16
|
+
end
|
17
|
+
|
18
|
+
def inspect
|
19
|
+
'IGResources'
|
20
|
+
end
|
21
|
+
|
22
|
+
def profile_by_url(url)
|
23
|
+
resources_by_type['StructureDefinition'].find { |profile| profile.url == url }
|
24
|
+
end
|
25
|
+
|
26
|
+
def resource_for_profile(url)
|
27
|
+
resources_by_type['StructureDefinition'].find { |profile| profile.url == url }.type
|
28
|
+
end
|
29
|
+
|
30
|
+
def value_set_by_url(url)
|
31
|
+
resources_by_type['ValueSet'].find { |profile| profile.url == url }
|
32
|
+
end
|
33
|
+
|
34
|
+
def search_param_by_resource_and_name(resource, name)
|
35
|
+
normalized_name = name.to_s == '_id' ? 'id' : name.to_s
|
36
|
+
|
37
|
+
resources_by_type['SearchParameter']
|
38
|
+
.find { |param| param.id == "us-core-#{resource.downcase}-#{normalized_name}" }
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def resources_by_type
|
44
|
+
@resources_by_type ||= Hash.new { |hash, key| hash[key] = [] }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,221 @@
|
|
1
|
+
module USCoreTestKit
|
2
|
+
class Generator
|
3
|
+
class MustSupportMetadataExtractor
|
4
|
+
attr_accessor :profile_elements, :profile, :resource
|
5
|
+
|
6
|
+
def initialize(profile_elements, profile, resource)
|
7
|
+
self.profile_elements = profile_elements
|
8
|
+
self.profile = profile
|
9
|
+
self.resource = resource
|
10
|
+
end
|
11
|
+
|
12
|
+
def must_supports
|
13
|
+
{
|
14
|
+
extensions: must_support_extensions,
|
15
|
+
slices: must_support_slices,
|
16
|
+
elements: must_support_elements
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
# exclude component from vital sign profiles except observation-bp and observation-pulse-ox
|
21
|
+
# observation-bp is excluded by profile.name != 'observation-bp'
|
22
|
+
# observation-plux-ox is excluded by profile.baseDefinition == 'http://hl7.org/fhir/StructureDefinition/vitalsigns'
|
23
|
+
def vital_signs_component?(element)
|
24
|
+
profile.baseDefinition == 'http://hl7.org/fhir/StructureDefinition/vitalsigns' &&
|
25
|
+
profile.name != 'observation-bp' &&
|
26
|
+
element.path.include?('component')
|
27
|
+
end
|
28
|
+
|
29
|
+
def blood_pressure_value?(element)
|
30
|
+
profile.name == 'observation-bp' && element.path.include?('Observation.value[x]')
|
31
|
+
end
|
32
|
+
|
33
|
+
# ONC clarified that health IT developers that always provide HL7 FHIR "observation" values
|
34
|
+
# are not required to demonstrate Health IT Module support for "dataAbsentReason" elements.
|
35
|
+
# Remove MS check for dataAbsentReason and component.dataAbsentReason from vital sign profiles
|
36
|
+
def data_absent_reason?(element)
|
37
|
+
profile.type == 'Observation' && ['Observation.dataAbsentReason', 'Observation.component.dataAbsentReason'].include?(element.path)
|
38
|
+
end
|
39
|
+
|
40
|
+
def all_must_support_elements
|
41
|
+
profile_elements
|
42
|
+
.select { |element| element.mustSupport }
|
43
|
+
.reject do |element|
|
44
|
+
# TODO: Can special cases be moved out of here?
|
45
|
+
vital_signs_component?(element) || blood_pressure_value?(element) || data_absent_reason?(element)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def must_support_extension_elements
|
50
|
+
all_must_support_elements.select { |element| element.path.end_with? 'extension' }
|
51
|
+
end
|
52
|
+
|
53
|
+
def must_support_extensions
|
54
|
+
must_support_extension_elements.map do |element|
|
55
|
+
{
|
56
|
+
id: element.id,
|
57
|
+
url: element.type.first.profile.first
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def must_support_slice_elements
|
63
|
+
all_must_support_elements.select { |element| !element.path.end_with?('extension') && element.sliceName.present? }
|
64
|
+
end
|
65
|
+
|
66
|
+
def sliced_element(slice)
|
67
|
+
profile_elements.find { |element| element.id == slice.path }
|
68
|
+
end
|
69
|
+
|
70
|
+
def discriminators(slice)
|
71
|
+
slice.slicing.discriminator
|
72
|
+
end
|
73
|
+
|
74
|
+
def must_support_pattern_slice_elements
|
75
|
+
must_support_slice_elements.select do |element|
|
76
|
+
discriminators(sliced_element(element)).first.type == 'pattern'
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def pattern_slices
|
81
|
+
must_support_pattern_slice_elements.map do |current_element|
|
82
|
+
{
|
83
|
+
name: current_element.id,
|
84
|
+
path: current_element.path.gsub("#{resource}.", '')
|
85
|
+
}.tap do |metadata|
|
86
|
+
discriminator = discriminators(sliced_element(current_element)).first
|
87
|
+
discriminator_path = discriminator.path
|
88
|
+
discriminator_path = '' if discriminator_path == '$this'
|
89
|
+
pattern_element =
|
90
|
+
if discriminator_path.present?
|
91
|
+
profile_elements.find { |element| element.id == "#{current_element.id}.#{discriminator_path}" }
|
92
|
+
else
|
93
|
+
current_element
|
94
|
+
end
|
95
|
+
|
96
|
+
metadata[:discriminator] =
|
97
|
+
if pattern_element.patternCodeableConcept.present?
|
98
|
+
{
|
99
|
+
type: 'patternCodeableConcept',
|
100
|
+
path: discriminator_path,
|
101
|
+
code: pattern_element.patternCodeableConcept.coding.first.code,
|
102
|
+
system: pattern_element.patternCodeableConcept.coding.first.system
|
103
|
+
}
|
104
|
+
elsif pattern_element.patternIdentifier.present?
|
105
|
+
{
|
106
|
+
type: 'patternIdentifier',
|
107
|
+
path: discriminator_path,
|
108
|
+
system: pattern_element.patternIdentifier.system
|
109
|
+
}
|
110
|
+
else
|
111
|
+
raise StandardError, 'Unsupported discriminator pattern type'
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def must_support_type_slice_elements
|
118
|
+
must_support_slice_elements.select do |element|
|
119
|
+
discriminators(sliced_element(element)).first.type == 'type'
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def type_slices
|
124
|
+
must_support_type_slice_elements.map do |current_element|
|
125
|
+
discriminator = discriminators(sliced_element(current_element)).first
|
126
|
+
type_path = discriminator.path
|
127
|
+
type_path = '' if type_path == '$this'
|
128
|
+
type_element =
|
129
|
+
if type_path.present?
|
130
|
+
elements.find { |element| element.id == "#{current_element.id}.#{type_path}" }
|
131
|
+
else
|
132
|
+
current_element
|
133
|
+
end
|
134
|
+
|
135
|
+
type_code = type_element.type.first.code
|
136
|
+
|
137
|
+
{
|
138
|
+
name: current_element.id,
|
139
|
+
path: current_element.path.gsub("#{resource}.", ''),
|
140
|
+
discriminator: {
|
141
|
+
type: 'type',
|
142
|
+
code: type_code.upcase_first
|
143
|
+
}
|
144
|
+
}
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def must_support_value_slice_elements
|
149
|
+
must_support_slice_elements.select do |element|
|
150
|
+
discriminators(sliced_element(element)).first.type == 'value'
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
def value_slices
|
155
|
+
must_support_value_slice_elements.map do |current_element|
|
156
|
+
{
|
157
|
+
name: current_element.id,
|
158
|
+
path: current_element.path.gsub("#{resource}.", ''),
|
159
|
+
discriminator: {
|
160
|
+
type: 'value'
|
161
|
+
}
|
162
|
+
}.tap do |metadata|
|
163
|
+
metadata[:discriminator][:values] = discriminators(sliced_element(current_element)).map do |discriminator|
|
164
|
+
fixed_element = profile_elements.find do |element|
|
165
|
+
element.id.starts_with?(current_element.id) &&
|
166
|
+
element.path == "#{current_element.path}.#{discriminator.path}"
|
167
|
+
end
|
168
|
+
|
169
|
+
binding.pry if fixed_element.nil?
|
170
|
+
{
|
171
|
+
path: discriminator.path,
|
172
|
+
value: fixed_element.fixedUri || fixed_element.fixedCode
|
173
|
+
}
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
def must_support_slices
|
180
|
+
pattern_slices + type_slices + value_slices
|
181
|
+
end
|
182
|
+
|
183
|
+
def plain_must_support_elements
|
184
|
+
all_must_support_elements - must_support_extension_elements - must_support_slice_elements
|
185
|
+
end
|
186
|
+
|
187
|
+
def handle_fixed_values(metadata, element)
|
188
|
+
if element.fixedUri.present?
|
189
|
+
metadata[:fixed_value] = element.fixedUri
|
190
|
+
elsif element.patternCodeableConcept.present?
|
191
|
+
metadata[:fixed_value] = element.patternCodeableConcept.coding.first.code
|
192
|
+
metadata[:path] += '.coding.code'
|
193
|
+
elsif element.fixedCode.present?
|
194
|
+
metadata[:fixed_value] = element.fixedCode
|
195
|
+
elsif element.patternIdentifier.present?
|
196
|
+
metadata[:fixed_value] = element.patternIdentifier.system
|
197
|
+
metadata[:path] += '.system'
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
def must_support_elements
|
202
|
+
plain_must_support_elements.each_with_object([]) do |current_element, must_support_elements_metadata|
|
203
|
+
{
|
204
|
+
path: current_element.path.gsub("#{resource}.", '')
|
205
|
+
}.tap do |current_metadata|
|
206
|
+
path = current_element.path.gsub("#{resource}.", '')
|
207
|
+
current_metadata[:path] = path
|
208
|
+
|
209
|
+
handle_fixed_values(current_metadata, current_element)
|
210
|
+
|
211
|
+
must_support_elements_metadata.delete_if do |metadata|
|
212
|
+
metadata[:path] == current_metadata[:path] && metadata[:fixed_value].blank?
|
213
|
+
end
|
214
|
+
|
215
|
+
must_support_elements_metadata << current_metadata
|
216
|
+
end
|
217
|
+
end.uniq
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require_relative 'naming'
|
2
|
+
require_relative 'special_cases'
|
3
|
+
|
4
|
+
module USCoreTestKit
|
5
|
+
class Generator
|
6
|
+
class MustSupportTestGenerator
|
7
|
+
class << self
|
8
|
+
def generate(ig_metadata)
|
9
|
+
ig_metadata.groups
|
10
|
+
.reject { |group| SpecialCases.exclude_resource? group.resource }
|
11
|
+
.each { |group| new(group).generate }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
attr_accessor :group_metadata
|
16
|
+
|
17
|
+
def initialize(group_metadata)
|
18
|
+
self.group_metadata = group_metadata
|
19
|
+
end
|
20
|
+
|
21
|
+
def template
|
22
|
+
@template ||= File.read(File.join(__dir__, 'templates', 'must_support.rb.erb'))
|
23
|
+
end
|
24
|
+
|
25
|
+
def output
|
26
|
+
@output ||= ERB.new(template).result(binding)
|
27
|
+
end
|
28
|
+
|
29
|
+
def base_output_file_name
|
30
|
+
"#{class_name.underscore}.rb"
|
31
|
+
end
|
32
|
+
|
33
|
+
def output_file_directory
|
34
|
+
File.join(__dir__, '..', 'generated', profile_identifier)
|
35
|
+
end
|
36
|
+
|
37
|
+
def output_file_name
|
38
|
+
File.join(output_file_directory, base_output_file_name)
|
39
|
+
end
|
40
|
+
|
41
|
+
def read_interaction
|
42
|
+
self.class.read_interaction(group_metadata)
|
43
|
+
end
|
44
|
+
|
45
|
+
def profile_identifier
|
46
|
+
Naming.snake_case_for_profile(group_metadata)
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_id
|
50
|
+
"us_core_311_#{profile_identifier}_must_support_test"
|
51
|
+
end
|
52
|
+
|
53
|
+
def class_name
|
54
|
+
"#{Naming.upper_camel_case_for_profile(group_metadata)}MustSupportTest"
|
55
|
+
end
|
56
|
+
|
57
|
+
def resource_type
|
58
|
+
group_metadata.resource
|
59
|
+
end
|
60
|
+
|
61
|
+
def resource_collection_string
|
62
|
+
'all_scratch_resources'
|
63
|
+
end
|
64
|
+
|
65
|
+
def must_support_list_string
|
66
|
+
slice_names = group_metadata.must_supports[:slices].map { |slice| slice[:name] }
|
67
|
+
element_names = group_metadata.must_supports[:elements].map { |slice| "#{resource_type}.#{slice[:path]}" }
|
68
|
+
extension_names = group_metadata.must_supports[:extensions].map { |slice| slice[:id] }
|
69
|
+
(slice_names + element_names + extension_names)
|
70
|
+
.sort
|
71
|
+
.map { |name| " * #{name}" }
|
72
|
+
.join("\n")
|
73
|
+
end
|
74
|
+
|
75
|
+
def generate
|
76
|
+
FileUtils.mkdir_p(output_file_directory)
|
77
|
+
File.open(output_file_name, 'w') { |f| f.write(output) }
|
78
|
+
|
79
|
+
group_metadata.add_test(
|
80
|
+
id: test_id,
|
81
|
+
file_name: base_output_file_name
|
82
|
+
)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module USCoreTestKit
|
2
|
+
class Generator
|
3
|
+
module Naming
|
4
|
+
ALLERGY_INTOLERANCE = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-allergyintolerance'
|
5
|
+
CARE_PLAN = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-careplan'
|
6
|
+
CARE_TEAM = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-careteam'
|
7
|
+
CONDITION = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-condition'
|
8
|
+
IMPLANTABLE_DEVICE = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-implantable-device'
|
9
|
+
DIAGNOSTIC_REPORT_NOTE = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-note'
|
10
|
+
DIAGNOSTIC_REPORT_LAB = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-lab'
|
11
|
+
DOCUMENT_REFERENCE = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-documentreference'
|
12
|
+
ENCOUNTER = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter'
|
13
|
+
GOAL = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-goal'
|
14
|
+
IMMUNIZATION = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-immunization'
|
15
|
+
LOCATION = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-location'
|
16
|
+
MEDICATION = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-medication'
|
17
|
+
MEDICATION_REQUEST = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-medicationrequest'
|
18
|
+
SMOKING_STATUS = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-smokingstatus'
|
19
|
+
PEDIATRIC_WEIGHT_FOR_HEIGHT = 'http://hl7.org/fhir/us/core/StructureDefinition/pediatric-weight-for-height'
|
20
|
+
OBSERVATION_LAB = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab'
|
21
|
+
PEDIATRIC_BMI_FOR_AGE = 'http://hl7.org/fhir/us/core/StructureDefinition/pediatric-bmi-for-age'
|
22
|
+
PULSE_OXIMETRY = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-pulse-oximetry'
|
23
|
+
HEAD_CIRCUMFERENCE = 'http://hl7.org/fhir/us/core/StructureDefinition/head-occipital-frontal-circumference-percentile'
|
24
|
+
ORGANIZATION = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization'
|
25
|
+
PATIENT = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient'
|
26
|
+
PRACTITIONER = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner'
|
27
|
+
PRACTITIONER_ROLE = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitionerrole'
|
28
|
+
PROCEDURE = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-procedure'
|
29
|
+
PROVENANCE = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-provenance'
|
30
|
+
|
31
|
+
class << self
|
32
|
+
def resources_with_multiple_profiles
|
33
|
+
['Observation', 'DiagnosticReport']
|
34
|
+
end
|
35
|
+
|
36
|
+
def resource_has_multiple_profiles?(resource)
|
37
|
+
resources_with_multiple_profiles.include? resource
|
38
|
+
end
|
39
|
+
|
40
|
+
def snake_case_for_profile(group_metadata)
|
41
|
+
resource = group_metadata.resource
|
42
|
+
return resource.underscore unless resource_has_multiple_profiles?(resource)
|
43
|
+
|
44
|
+
return 'head_circumference' if group_metadata.profile_url == HEAD_CIRCUMFERENCE
|
45
|
+
|
46
|
+
group_metadata.name
|
47
|
+
.delete_prefix('us_core_')
|
48
|
+
.gsub('diagnosticreport', 'diagnostic_report')
|
49
|
+
.underscore
|
50
|
+
end
|
51
|
+
|
52
|
+
def upper_camel_case_for_profile(group_metadata)
|
53
|
+
snake_case_for_profile(group_metadata).camelize
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|