Class: Crucible::Generator::Resources

Inherits:
Object
  • Object
show all
Defined in:
lib/data/resources.rb

Constant Summary collapse

FIXTURE_DIR =
File.join(File.expand_path(File.join('..','..','..'),File.absolute_path(__FILE__)), 'fixtures')

Instance Method Summary collapse

Instance Method Details

#average_claimObject



92
93
94
# File 'lib/data/resources.rb', line 92

def average_claim
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'financial', 'claim-example-oral-average.xml'))
end

#codesystem_simpleObject

—————————— TERMINOLOGY TRACK TESTS ——————————



134
135
136
# File 'lib/data/resources.rb', line 134

def codesystem_simple
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'terminology', 'codesystem-simple.xml'))
end

#complex_claimObject



96
97
98
# File 'lib/data/resources.rb', line 96

def complex_claim
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'financial', 'claim-example-oral-orthoplan.xml'))
end

#conceptmap_simpleObject



142
143
144
# File 'lib/data/resources.rb', line 142

def conceptmap_simple
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'terminology', 'conceptmap-example.xml'))
end

#daf_conformanceObject

—————————— DAF TESTS ——————————



128
129
130
# File 'lib/data/resources.rb', line 128

def daf_conformance
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'daf', 'conformance-daf-query-responder.xml'))
end

#example_patientObject



16
17
18
# File 'lib/data/resources.rb', line 16

def example_patient
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'patient', 'patient-example.xml'))
end

#example_patient_record_201Object



28
29
30
# File 'lib/data/resources.rb', line 28

def example_patient_record_201
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'patient-example-f201-roel.xml'))
end

#example_patient_record_condition_201Object



32
33
34
# File 'lib/data/resources.rb', line 32

def example_patient_record_condition_201
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'condition-example-f201-fever.xml'))
end

#example_patient_record_condition_205Object



36
37
38
# File 'lib/data/resources.rb', line 36

def example_patient_record_condition_205
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'condition-example-f205-infection.xml'))
end

#example_patient_record_diagnosticreport_201Object



40
41
42
# File 'lib/data/resources.rb', line 40

def example_patient_record_diagnosticreport_201
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'diagnosticreport-example-f201-brainct.xml'))
end

#example_patient_record_encounter_201Object



44
45
46
# File 'lib/data/resources.rb', line 44

def example_patient_record_encounter_201
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'encounter-example-f201-20130404.xml'))
end

#example_patient_record_encounter_202Object



48
49
50
# File 'lib/data/resources.rb', line 48

def example_patient_record_encounter_202
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'encounter-example-f202-20130128.xml'))
end

#example_patient_record_observation_202Object



52
53
54
# File 'lib/data/resources.rb', line 52

def example_patient_record_observation_202
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'observation-example-f202-temperature.xml'))
end

#example_patient_record_organization_201Object



56
57
58
# File 'lib/data/resources.rb', line 56

def example_patient_record_organization_201
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'organization-example-f201-aumc.xml'))
end

#example_patient_record_organization_203Object



60
61
62
# File 'lib/data/resources.rb', line 60

def example_patient_record_organization_203
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'organization-example-f203-bumc.xml'))
end

#example_patient_record_practitioner_201Object



64
65
66
# File 'lib/data/resources.rb', line 64

def example_patient_record_practitioner_201
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'practitioner-example-f201-ab.xml'))
end

#example_patient_record_procedure_201Object



68
69
70
# File 'lib/data/resources.rb', line 68

def example_patient_record_procedure_201
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'record', 'procedure-example-f201-tpf.xml'))
end

#example_patient_usObject



20
21
22
# File 'lib/data/resources.rb', line 20

def example_patient_us
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'patient', 'patient-example-us-extensions.xml'))
end

#fixture_pathObject

FIXME: Determine a better way to share fixture data with Crucible



8
9
10
11
12
13
14
# File 'lib/data/resources.rb', line 8

def fixture_path
  if File.exists?(FIXTURE_DIR)
    FIXTURE_DIR
  else
    File.join(Rails.root, 'test', 'fixtures')
  end
end

#load_fixture(path) ⇒ Object



152
153
154
# File 'lib/data/resources.rb', line 152

def load_fixture(path)
  FHIR.from_contents(File.read(File.join(fixture_path, path)))
end

#medicationorder_simpleObject

—————————— PATCH TRACK TESTS ——————————



148
149
150
# File 'lib/data/resources.rb', line 148

def medicationorder_simple
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'patch', 'medicationrequest-simple.xml'))
end

#minimal_patientObject



24
25
26
# File 'lib/data/resources.rb', line 24

def minimal_patient
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'patient', 'patient-minimal.xml'))
end

#scheduling_appointmentObject

—————————— SCHEDULING TEST TRACK ——————————



102
103
104
# File 'lib/data/resources.rb', line 102

def scheduling_appointment
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'scheduling', 'appointment-simple.xml'))
end

#scheduling_practitionerObject



114
115
116
# File 'lib/data/resources.rb', line 114

def scheduling_practitioner
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'scheduling', 'practitioner-simple.xml'))
end

#scheduling_response_patientObject



106
107
108
# File 'lib/data/resources.rb', line 106

def scheduling_response_patient
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'scheduling', 'appointmentresponse-patient-simple.xml'))
end

#scheduling_response_practitionerObject



110
111
112
# File 'lib/data/resources.rb', line 110

def scheduling_response_practitioner
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'scheduling', 'appointmentresponse-practitioner-simple.xml'))
end

#scheduling_scheduleObject



118
119
120
# File 'lib/data/resources.rb', line 118

def scheduling_schedule
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'scheduling', 'schedule-simple.xml'))
end

#scheduling_slotObject



122
123
124
# File 'lib/data/resources.rb', line 122

def scheduling_slot
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'scheduling', 'slot-simple.xml'))
end

#simple_claimObject

—————————— CLAIM TEST TRACK ——————————



88
89
90
# File 'lib/data/resources.rb', line 88

def simple_claim
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'financial', 'claim-example.xml'))
end

#track3_observationsObject



76
77
78
79
80
81
82
83
84
# File 'lib/data/resources.rb', line 76

def track3_observations
  # get all observations in fixture_path/validation/observations
  observations = []
  files = File.join(fixture_path, 'validation', 'observations', '*.xml')
  Dir.glob(files).each do |f|
      observations << FHIR::Xml.from_xml( File.read(f) )
  end
  observations
end

#track3_profileObject



72
73
74
# File 'lib/data/resources.rb', line 72

def track3_profile
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'validation', 'observation.profile.xml'))
end

#valueset_simpleObject



138
139
140
# File 'lib/data/resources.rb', line 138

def valueset_simple
  FHIR::Xml.from_xml File.read(File.join(fixture_path, 'terminology', 'valueset-example.xml'))
end