Module: DaVinciPlanNetTestKit::Generator::SpecialCases
- Defined in:
- lib/davinci_plan_net_test_kit/generator/special_cases.rb
Constant Summary collapse
- RESOURCES_TO_EXCLUDE =
[].freeze
- PROFILES_TO_EXCLUDE =
[].freeze
- GROUP_SORT_ORDER =
["plannet_Endpoint", "plannet_InsurancePlan", "plannet_OrganizationAffiliation", "plannet_PractitionerRole", "plannet_Practitioner", "plannet_HealthcareService", "plannet_Location", "plannet_Network", "plannet_Organization"].freeze
- PARAMETERLESS_FILTER_DESCRIPTION =
{ "Plan-Net Network" => "In order to gather only Organization instances expected to conform to the Plan-Net Network profile, instances where `type` does not equal `ntwk` will be discarded. ", "Plan-Net Organization" => "In order to gather only Organization instances expected to conform to the Plan-Net Organization profile, instances where `type` equals `ntwk` will be discarded. " }.freeze
Class Method Summary collapse
- .exclude_group?(group) ⇒ Boolean
- .fix_network_must_support(ig_metadata) ⇒ Object
- .fix_revincludes_for_organization(ig_metadata) ⇒ Object
- .group_index(group_name) ⇒ Object
- .has_explicit_group_order ⇒ Object
- .has_parameterless_filter?(profile_name) ⇒ Boolean
- .parameterless_filter_description(profile_name) ⇒ Object
- .run_special_cases(ig_metadata) ⇒ Object
Class Method Details
.exclude_group?(group) ⇒ Boolean
24 25 26 |
# File 'lib/davinci_plan_net_test_kit/generator/special_cases.rb', line 24 def exclude_group?(group) RESOURCES_TO_EXCLUDE.include?(group.resource) end |
.fix_network_must_support(ig_metadata) ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/davinci_plan_net_test_kit/generator/special_cases.rb', line 49 def fix_network_must_support() # The Network profile is based on USCore Organization, since there was no contradiction between the USCore profile # and the Plan-Net requirements. However, the NPI and CLIA identifier types, which are Must-Support, are clearly # intended for provider organizations only and are not expected to be populated for other organization types. network_group = .groups.find { |group| group.name == 'plannet_Network'} adjusted_must_supports = network_group.must_supports[:slices].dup.delete_if {|slice| slice[:name] == 'Organization.identifier:NPI'} network_group.must_supports[:slices] = adjusted_must_supports end |
.fix_revincludes_for_organization(ig_metadata) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/davinci_plan_net_test_kit/generator/special_cases.rb', line 58 def fix_revincludes_for_organization() # Revincludes are listed in the capability statement at the resource level, # but resources that support multiple profiles do not make the distinction of which tests are for which # This separates the revinclude lists for Network and Organization profiles from the Organization resource # For Plan Net PDEX v1.1.0 organization_group = .groups.find { |group| group.name == 'plannet_Organization'} network_group = .groups.find { |group| group.name == 'plannet_Network'} network_revincludes, corrected_revinclude_list = organization_group.revincludes.partition do |revinclude| revinclude.split(/:/)[1] == "network" end organization_group.revincludes = corrected_revinclude_list network_group.revincludes = network_revincludes end |
.group_index(group_name) ⇒ Object
28 29 30 |
# File 'lib/davinci_plan_net_test_kit/generator/special_cases.rb', line 28 def group_index(group_name) GROUP_SORT_ORDER.index(group_name) end |
.has_explicit_group_order ⇒ Object
32 33 34 |
# File 'lib/davinci_plan_net_test_kit/generator/special_cases.rb', line 32 def has_explicit_group_order() GROUP_SORT_ORDER.size > 0 end |
.has_parameterless_filter?(profile_name) ⇒ Boolean
36 37 38 |
# File 'lib/davinci_plan_net_test_kit/generator/special_cases.rb', line 36 def has_parameterless_filter?(profile_name) PARAMETERLESS_FILTER_DESCRIPTION.key?(profile_name) end |
.parameterless_filter_description(profile_name) ⇒ Object
40 41 42 |
# File 'lib/davinci_plan_net_test_kit/generator/special_cases.rb', line 40 def parameterless_filter_description(profile_name) PARAMETERLESS_FILTER_DESCRIPTION[profile_name] end |
.run_special_cases(ig_metadata) ⇒ Object
44 45 46 47 |
# File 'lib/davinci_plan_net_test_kit/generator/special_cases.rb', line 44 def run_special_cases() fix_network_must_support() fix_revincludes_for_organization() end |