Module: HealthDataStandards::Export::CCR

Extended by:
CCR
Included in:
CCR
Defined in:
lib/health-data-standards/export/ccr.rb

Instance Method Summary collapse

Instance Method Details

#export(patient) ⇒ Builder::XmlMarkup

Builds a CCR XML document representing the patient.

Returns:

  • (Builder::XmlMarkup)

    CCR XML representation of patient data



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
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/health-data-standards/export/ccr.rb', line 7

def export(patient)
  xml = Builder::XmlMarkup.new(:indent => 2)
  xml.ContinuityOfCareRecord("xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
                             "xsi:schemaLocation" => "urn:astm-org:CCR CCR_20051109.xsd http://www.w3.org/2001/XMLSchema xmldsig-core-schema.xsd",
                             "xmlns" => "urn:astm-org:CCR") do
    xml.CCRDocumentObjectID(patient.id)
    xml.Language do
      xml.Text("English")
    end
    xml.Version("V1.0")
    xml.DateTime do
      #TODO: Need to fix this and not be a hard-coded value
      xml.ExactDateTime(Time.now.xmlschema)
    end
    xml.Patient do 
      xml.ActorID(patient.id)
    end
    xml.From do
      xml.ActorLink do
        xml.ActorID("AA0002")
      end
    end
    to_ccr_purpose(xml)
    xml.Body do
      
      to_ccr_problems(xml, patient)
      to_ccr_socialhistory(xml, patient)
      to_ccr_allergies(xml, patient)
      
      to_ccr_medications(xml, patient)
      to_ccr_immunizations(xml, patient)
      to_ccr_vitals(xml, patient)
      to_ccr_results(xml, patient) 
      to_ccr_procedures(xml, patient)
      to_ccr_encounters(xml, patient)   
    end
    to_ccr_actors(xml, patient)
  end
end