Module: IpaTestKit::Generator::Naming

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

Constant Summary collapse

ALLERGY_INTOLERANCE =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-allergyintolerance'
CARE_PLAN =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-careplan'
CARE_TEAM =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-careteam'
CONDITION =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-condition'
IMPLANTABLE_DEVICE =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-implantable-device'
DIAGNOSTIC_REPORT_NOTE =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-note'
DIAGNOSTIC_REPORT_LAB =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-lab'
DOCUMENT_REFERENCE =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-documentreference'
ENCOUNTER =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter'
GOAL =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-goal'
IMMUNIZATION =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-immunization'
LOCATION =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-location'
MEDICATION =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-medication'
MEDICATION_REQUEST =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-medicationrequest'
SMOKING_STATUS =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-smokingstatus'
PEDIATRIC_WEIGHT_FOR_HEIGHT =
'http://hl7.org/fhir/us/core/StructureDefinition/pediatric-weight-for-height'
OBSERVATION_LAB =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab'
PEDIATRIC_BMI_FOR_AGE =
'http://hl7.org/fhir/us/core/StructureDefinition/pediatric-bmi-for-age'
PULSE_OXIMETRY =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-pulse-oximetry'
HEAD_CIRCUMFERENCE =
'http://hl7.org/fhir/us/core/StructureDefinition/head-occipital-frontal-circumference-percentile'
ORGANIZATION =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization'
PATIENT =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient'
PRACTITIONER =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner'
PRACTITIONER_ROLE =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitionerrole'
PROCEDURE =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-procedure'
PROVENANCE =
'http://hl7.org/fhir/us/core/StructureDefinition/us-core-provenance'

Class Method Summary collapse

Class Method Details

.resource_has_multiple_profiles?(resource) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/ipa_test_kit/generator/naming.rb', line 36

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

.resources_with_multiple_profilesObject



32
33
34
# File 'lib/ipa_test_kit/generator/naming.rb', line 32

def resources_with_multiple_profiles
  ['Condition', 'DiagnosticReport', 'Observation']
end

.snake_case_for_profile(group_metadata) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/ipa_test_kit/generator/naming.rb', line 40

def snake_case_for_profile()
  resource = .resource
  return resource.underscore unless resource_has_multiple_profiles?(resource)

  if .profile_url == HEAD_CIRCUMFERENCE
    return .reformatted_version == 'v311' ? 'head_circumference' : 'head_circumference_percentile'
  end

  .name
    .delete_prefix('ipa_')
    .gsub('diagnosticreport', 'diagnostic_report')
    .underscore
end

.upper_camel_case_for_profile(group_metadata) ⇒ Object



54
55
56
# File 'lib/ipa_test_kit/generator/naming.rb', line 54

def upper_camel_case_for_profile()
  snake_case_for_profile().camelize
end