I am working on a health care application which has a user's health care data. I need help to export this data into a CDA document using Rails or Javascript
Asked
Active
Viewed 531 times
2 Answers
1
CDA is just XML. Use your favourite library (JAXB should be available via Groovy/Java) to feed your data (from a DB?) to your CDA. Get the CDA schemas and try to generate the classes you need. Another approach: use a templating engine (velocity or the like).
Start with a sample CDA and from there try to understand the intricacies of CDA.

ThomasW
- 475
- 3
- 15
0
Maybe something like this could work.
require 'builder'
@schools = School.where(state_code: 'NV').order('name DESC')
file = File.new("#{Rails.root}/public/data.xml", 'w')
xml = Builder::XmlMarkup.new(target: file, :indent => 2)
xml.instruct! :xml, :version=>'1.0'
xml.tag! 'plist' , 'version' => '1.0' do
xml.array do
@schools.each do |s|
xml.dict do
xml.key 'id'
xml.string s.id
xml.key 'name'
xml.string s.name
xml.key 'zip'
xml.string s.zipcode
end
end
end
end

Roshan
- 905
- 9
- 21