jordanbyron/mission_of_mercy — pull request #59 by justinramel (2011-10-24 00:43:43+00:00)
Title: adding export feature - first try for discussion

issue #22 - export feature

Hi Jordan,

I've had a quick stab at this and though I'd check in what I had for discussion.

The is an example export in https://github.com/justinramel/mission_of_mercy/blob/export/test/export_files/patient.csv.

I'll warn you it's not pretty!

Really not sure how to show one to many associations as CSV and also uncertain if this file will be one per Patient of all Patients in the system.

I looked at the university web exporter and created an Exporter model in MoM.

At the moment the Exporter (https://github.com/justinramel/mission_of_mercy/blob/export/app/models/exporter.rb) takes a Patient and spits out every column and the association columns of Procedures, Prescriptions, and Pre-Meds as a CSV string.

There is one test which compares the Exporter#to_csv with the expected CSV file in test/export_files/patient.csv.

Happy to scrap and start again if I've gone in the wrong direction with this, just let me know.