User:Projekt ANA/GNUHealth Import Export

GNU Health Technical Guide

GNU Health provides functionality for importing and exporting data within the Tryton framework.

'''Export: '''

Choose the data you want to export: e.g. Health / Patients. Click on the upper left square of the tab "Patients" (icon: crossed tools screwdriver and wrench).

Choose from the drop-down menu "Export data...".

Choose fields you want to export: click on fields in the left part, entitled All fields. Click "Add" to add fields to the right part "Fields to export".

Choose under options "Open" for opening with LibreOffice Calc (if installed) or "Save" for saving as csv-file.

Check box "Add field names" for adding field names to csv-file.

Try exporting the five fields Age, DoB (Date of Birth), ID, Name, Sex.

'''Import: '''

Be aware of that you cannot just import an exported data set.

You have to choose first carefully the table where you want to import your data.

If you choose Health / Patients you will see something like this as last line:

tryton://localhost:8000/yourdatabase/model/gnuhealth.patient;views=%5B217%2C+216%5D

So you know that you have to look for the fields of the table gnuhealth.patient as displayed in

Administration / Models / Models Model name: gnuhealth.patient (this meta information is stored in table ir.model).

Double click this line there (or switch view with third icon from left with 4 blue arrows in corners).

135 field names are displayed, e.g. abortions, age, dob (Date of Birth), ID, name or sex.

Be aware of that the field "name" is many2one and has Model Relation to party.party

If you would try to re-import the file that you exported into gnuhealth.patient with the feature "Auto-Detect" then you will get errors with all fields Age, DoB, ID, Name, Sex.

So you have to import first patient data into table party.party. First make an export with the data you want to import, so that you will see the format of the fields. Try at least Code, DoB, ID, Last Name, Name, PUID, Patient, Person, Sex.

For your import include data (integer) into the ref field which will serve as PUID. You have to relate it to the gnuhealth.patient table with the "name" field (with the same integer).

References:

Tryton 3.2 Dokumentation zum Import und Export

Postgresql 9.3 Dokumentation zum Import und Export (Copy to / from)

PgadminIII import tool

Tryton: Erstellung eines Moduls - Beispiel HelloWorld