Class: Crucible::Tests::DAFResourceGenerator
Class Method Summary
collapse
ancestor_fhir_classes, apply_invariants!, generate, generate_child, minimal_animal, minimal_codeableconcept, minimal_coding, minimal_condition, minimal_humanname, minimal_identifier, minimal_observation, minimal_patient, minimal_quantity, random_oid, set_fields!, textonly_codeableconcept, textonly_reference
Class Method Details
.daf_address ⇒ Object
60
61
62
63
64
65
66
67
68
|
# File 'lib/daf_resource_generator.rb', line 60
def self.daf_address
resource = FHIR::Address.new
resource.line = ['Statue of Liberty National Monument']
resource.city = 'New York'
resource.state = 'NY'
resource.postalCode = '10004'
resource.country = 'USA'
resource
end
|
Patient.name Sex Gender Patient.gender Date of Birth Date of Birth Patient.birthDate Race Race Patient.extension(us-core-race) Ethnicity Ethnicity Patient.extension(us-core-ethnicity) Preferred Language Preferred Language Patient.communication.preferred Patient Identifiers Patient.identifier Multiple Birth Indicator Patient.multipleBirthBoolean Birth Order Patient.multipleBirthInteger Mother’s Maiden Name Patient.extension(patient-mothers-maiden-name) Address Patient.address Telephone Patient.telecom Marital Status Patient.maritalStatus Birth Place Patient.extension(birthplace) Religious Affiliation Patient.extension(religion) Guardian Patient.contact
52
53
54
55
56
57
58
|
# File 'lib/daf_resource_generator.rb', line 52
def self.daf_contact_point
resource = FHIR::ContactPoint.new
resource.system = 'phone'
resource.value = '1-800-555-1212'
resource.use = 'work'
resource
end
|
.daf_patient(identifier = '0', name = 'Name') ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/daf_resource_generator.rb', line 5
def self.daf_patient(identifier='0',name='Name')
resource = minimal_patient(identifier,name)
resource.meta = FHIR::Meta.new
resource.meta.profile = ['http://hl7.org/fhir/StructureDefinition/daf-patient']
resource.active = true
resource.telecom = [ daf_contact_point ]
resource.gender = 'unknown'
resource.birthDate = DateTime.now.strftime("%Y-%m-%d")
resource.deceasedBoolean = false
resource.address = [ daf_address ]
resource.maritalStatus = minimal_codeableconcept('http://hl7.org/fhir/v3/MaritalStatus','S')
resource.multipleBirthBoolean = false
resource.contact = [ daf_patient_contact ]
resource.communication = [ daf_patient_communication ]
resource.managingOrganization = FHIR::Reference.new resource.managingOrganization.display = 'DAF Organization'
resource.extension = []
resource.extension << make_extension('http://hl7.org/fhir/StructureDefinition/us-core-race','CodeableConcept',minimal_codeableconcept('http://hl7.org/fhir/v3/Race','2106-3'))
resource.extension << make_extension('http://hl7.org/fhir/StructureDefinition/us-core-ethnicity','CodeableConcept',minimal_codeableconcept('http://hl7.org/fhir/v3/Ethnicity','2186-5'))
resource.extension << make_extension('http://hl7.org/fhir/StructureDefinition/us-core-religion','CodeableConcept',minimal_codeableconcept('http://hl7.org/fhir/v3/ReligiousAffiliation','1007'))
resource.extension << make_extension('http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName','String','Liberty')
resource.extension << make_extension('http://hl7.org/fhir/StructureDefinition/birthPlace','Address',daf_address)
resource
end
|
.daf_patient_communication ⇒ Object
79
80
81
82
83
|
# File 'lib/daf_resource_generator.rb', line 79
def self.daf_patient_communication
resource = FHIR::Patient::Communication.new
resource.language = minimal_codeableconcept('http://tools.ietf.org/html/bcp47','en-US')
resource
end
|
70
71
72
73
74
75
76
77
|
# File 'lib/daf_resource_generator.rb', line 70
def self.daf_patient_contact
resource = FHIR::Patient::Contact.new
resource.relationship = [ minimal_codeableconcept('http://hl7.org/fhir/patient-contact-relationship','parent'), minimal_codeableconcept('http://hl7.org/fhir/patient-contact-relationship','emergency') ]
resource.name = minimal_humanname('Mom')
resource.telecom = [ daf_contact_point ]
resource.address = daf_address
resource
end
|
.make_extension(url, type, value) ⇒ Object
85
86
87
88
89
90
|
# File 'lib/daf_resource_generator.rb', line 85
def self.make_extension(url,type,value)
extension = FHIR::Extension.new
extension.url = url
extension.method("value#{type}=".to_sym).call(value)
extension
end
|