Module: CarinForBlueButtonTestKit::Generator::Naming

Defined in:
lib/carin_for_blue_button_test_kit/generator/naming.rb

Constant Summary collapse

COVERAGE =
'http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Coverage'
EXPLANATION_OF_BENEFIT =
'http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-ExplanationOfBenefit'
ORGANIZATION =
'http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Organization'
PATIENT =
'http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient'
PRACTITIONER =
'http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Practitioner'
'http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-RelatedPerson'

Class Method Summary collapse

Class Method Details

.abbreviate_name(group_metadata) ⇒ Object



20
21
22
23
24
25
# File 'lib/carin_for_blue_button_test_kit/generator/naming.rb', line 20

def abbreviate_name()
  name = .name
  resource = name.split('_').second
  abbreviated_name = resources_with_abbreviated_name[resource.to_sym] || resource
  abbreviated_name ? name.sub(resource, abbreviated_name) : name
end

.resource_has_multiple_profiles?(resource) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/carin_for_blue_button_test_kit/generator/naming.rb', line 27

def resource_has_multiple_profiles?(resource)
  resources_with_multiple_profiles.include? resource
end

.resources_with_abbreviated_nameObject



16
17
18
# File 'lib/carin_for_blue_button_test_kit/generator/naming.rb', line 16

def resources_with_abbreviated_name
  {"ExplanationOfBenefit": 'EOB'}
end

.resources_with_multiple_profilesObject



12
13
14
# File 'lib/carin_for_blue_button_test_kit/generator/naming.rb', line 12

def resources_with_multiple_profiles
  ['ExplanationOfBenefit']
end

.snake_case_for_profile(group_metadata) ⇒ Object



31
32
33
34
35
36
37
38
39
# File 'lib/carin_for_blue_button_test_kit/generator/naming.rb', line 31

def snake_case_for_profile()
  resource = .resource
  return resource.underscore unless resource_has_multiple_profiles?(resource)
  
  .name = abbreviate_name()
  .name
    .delete_prefix('C4BB_')
    .underscore
end

.upper_camel_case_for_profile(group_metadata) ⇒ Object



41
42
43
# File 'lib/carin_for_blue_button_test_kit/generator/naming.rb', line 41

def upper_camel_case_for_profile()
  snake_case_for_profile().camelize
end