en:manuals:freediams:command_line
Keywords: en:freediams,en:usermanual,updated
Date: 2010-11-02T08:48:42+0100

freediams, usermanual, updated

# Connecting FreeDiams to external EMR

This page is up-to-date.

## Usage of the command line

FreeDiams is thought as an external “module”. This “module” can be used by many software. At present, MedinTux and GNUMed are configurable to use this software as a prescriber.

In order to interface software with FreeDiams, just inform the command line params and/or use the exchange-in file.

### Params of the command line

In most cases, it is recommended to inform FreeDiams' datas with the exchange-in file instead of the command line (see following).

You can, at any time, check the transmitted params (by the command line or the exchange-in file) thanks to the About dialog, item Application/Command line.

#### Params concerning the user's interface of FreeDiams

- –version,-version,-v: Displays the current version of FreeDiams.
- –selection-only : Starts FreeDiams in Selection Only Mode
- –chrono: log chronos on various functions of the tester interactions (proposed for debugging)
- –blockpatientdatas : value can be : 0 or 1. User can/can't modify patient's datas inside the FreeDiams session.
- –drugsdb-uid : Drugs database Unique identifier to use at startup

#### Params used for the exchange files

- –medintux: defines a specific user MedinTux.
- –exchange-in=”/path/to/xml/exchange-in.xml” : defines the “in” exchange file.
- –exchange-out=“xxx” : “xxx” is the file that FreeDiams will write, given PATH write permission.
- –exchange-format=“xml html html_xml” : format of the exchange out file (select a format; default is html_xml)

#### Params used for external EMRs

- –emr-name : name of the EMR (will be returned without any modification in the “out” exchange file)
- –emr-uid : EMR session UID (will be returned without any modification in the “out” exchange file)

#### Params used to transmit patient's datas

- Identity:
  - –patientuid : Patient UID (will be returned without any modification in the “out” exchange file)
  - –patientname=“xx xx xx” defines the name of the patient.
  - –patientfirstname=“xx xx” define the firstname of the patient.
  - –gender=M: defines the sex (can be equal to 'M' for Male, 'F' Female, 'H' hermaphroditism)
  - –dateofbirth=“yyyy/MM/dd” defines the data of birth of patient

- Physiological datas:
  - –weight=“dd” defines the patient's weight (kg)
  - –weight-unit : value can be : Kg/lbs
  - –height=“ddd”: sets the size of the patient
  - –height-unit : value can be : cm/inches
  - –crcl=“dd.d” defines the clearance of creatinine of the patient
  - –crcl-unit
  - –creatinine=“dd” : defines the patient's serum creatinine
  - –creatinine-unit: (mg/l or mmol/l)

* Patient's precautions: (allergies and intolerances)

- Allergies:
  - –drugs-uid-allergies: List of the drugs UID with known allergy (separate with a ; )
  - –atc-allergies: : List of ATC codes with known allergy (separate with a ; )
  - –inn-allergies: : List of INN labels with known allergy (separate with a ; - Label must be extracted from the ATC classification of FreeDiams)
- Intolerances:
  - –drugs-uid-Intolerances: List of the drugs UID with known intolerance (separate with a ; )
  - –atc-Intolerances: : List of ATC codes with known intolerance (separate with a ; )
  - –inn-Intolerances: : List of INN labels with known intolerance (separate with a ; - Label must be extracted from the ATC classification of FreeDiams)

#### Params for the FreeMedForms project participants

- –transmit-dosage = transmit personnal protocols to the scitific commitee server.

### Examples

- Linux/*BSD :

    freediams --exchange-in="/home/me/exchange-in.xml"

- Win :

    freediams.exe --exchange-in="c:\Files\exchangein.xml"

- Mac (don't forget the bundle) :

    FreeDiams.app/Contents/MacOs/FreeDiams --exchange-in="/Users/me/exchange-in.xml"

## The exchange files

### The "in" exchange file

All files are UTF-8 encoded.
Instead of using the command line to inform the various parameters used in FreeDiams, the EMRs should use the XML encoded exchange-in file.
When you specify an exchange-in file, the command line params are replaced with the XML values.
You can use both (command line and xml in file) to define params to pass to FreeDiams.
The structure of this file must meet the following requirements.

### XML structuration of the "in" exchange file

    <FreeDiams_In version="0.5.0">
      <ConfigFile value="/absolute/file/specification/to/the/required/configFile.ini"/>
      <ExchangeOut value="/absolute/file/specification/to/the/required/exchange_File.txt" format="xml html html_xml"/>
      <DrugsDatabase uid="FREEDIAMS_DRUGS_DATABASE_UID"/>
      <EMR name="NameWillBeShownInTheMainWindowTitle" uid="SessionUIDWillBeReturnedInOutputFile"/>
      <Patient>
        <Identity lastnames="Family or equivalent name e.g. Kirk"
                  firstnames="James Tiberius"
                  uid="EMR Patient's UID"
                  dob="yyyy/MM/dd"
                  gender="M or F or H"/>

        <Creatinine value="12" unit="mg/l or mmol/l"/>
        <Weight value="70" unit="kg or lbs" />
        <Height value="170" unit="cm or "/>

        <InnAllergies value="inn1;inn2;inn3"/>
        <ATCAllergies value="ATC1;ATC2;ATC3"/>
        <DrugsUidAllergies value="7655668;876769;656789"/>

        <InnIntolerances value="inn1;inn2;inn3"/>
        <ATCIntolerances value="ATC1;ATC2;ATC3"/>
        <DrugsUidIntolerances value="7655668;876769;656789"/>

        <ICD10 value="J11.0;A22;Z23"/>

      </Patient>
      <Ui editmode="select-only or prescriber" blockPatientDatas="0/1"/>
    </FreeDiams_In>

FreeDiams will “read-only” this XML file for patient and allergy/intolerance data. If an “ExchangeOut” file is specified, FreeDiams will read it only for prescription data (ignoring patient data). On close, FreeDiams will write the currently edited prescription to the “ExchangeOut” file, so that EMR can retreive information.

Please note the difference between relative and absolute path.

- absolute path starts with '/' or 'X:\\'
- relative path starts with './' or '../'

The relative path are calculated from the application's binary. They should be different for each OS:

- under Linux, the binary is installed in /usr/bin
- under MacOs, binary is inside the Bundle /Path/To/Application.app/Contents/MacOs
- under Windows, binary is installed in C:\\Path\\To\FreeDiams

It is recommended to use absolute full path inside the XML exhange-in file, so that the calls to FreeDiams will be fully multi-OS.

When passing ATC codes for allergies or intolerances, you can pass Class ATC Codes which are less than 7 char length.
2010/09/27 12:09

### Defaults

- –exchange-format = html_xml
- Ui : prescriber
- blockPatientData = 0
- ConfigFile : will use the default one (in your home path).

## The "out" exchange file

When an exchange file is notified, FreeDiams tries to read the file contents and to retrieve data from the prescription and process them (interactions, allergies…).
At the close of the application, the prescription is automatically stored in the exchange format XML (user does not need to save before quitting).

When the –medintux is notified in the command line, the format of the paging file is specific to MedinTux.
The contents of the 'out' exchange file is a mix between HTML and XML.

### File format

#### Format: html_xml

Till v0.4.0, the out exchange file is structured like this.

    <html>
      ...
    <body>
    <a href="FreeDiamsEncodedPrescription:base64FreeDiamsXmlencoded">
    ... (full HTML prescription)
    </a>
    </body>
    </html>

For versions upper or egal to 0.4.0 :

    <html>
       ...
      <meta name="FreeDiams" content="FreeDiamsEncodedPrescription:base64FreeDiamsXmlencoded"/>
    <body>
    ... (full HTML prescription)
    </body>
    </html>

#### Format: xml

The XML content of the exchange out file depends on the editing mode of FreeDiams. The content is described in the prescription file format chapter.