# Getting test results into the GNUmed system

## Entering results manually

There are two parts to entering a result manually:

- creating the measurement or test 'type', if it does not already exist, and
- inputting a value for the measurement or test type of interest

If you intend to manually enter results which were received from a laboratory then you may rather first set these up under the menu GNUmed > Master data > Manage lists > Test types because this will provide you the flexibility to define which laboratories are providing you with their results, together with their contact information.

You can ignore the above, and create test types which did not already exist right inside a patient measurement edit area. You only need to know that test types that are created in this situation are assumed to be generated within the praxis (such as weights and blood pressures). These will therefore be automatically assigned under the laboratory "inhouse lab". This can later be revised under the Master data menu.

To input new measurements inside the current patient's edit area,

- go to menu EMR / Observations / Add Measurements or click on the Measurements plugin where you will find the Add button
- select, or enter for creation, the test or measurement type of interest
- fill in the rest of the dialog, noting that fields labelled in red are required
- [Next] lets you enter the next value of the same type with minimum hassle
- phrasewheels provide online feedback from the backend

The same Edit Area is used when editing existing results.

## Automated import

### LDT

There's a partially finished LDT importer available in the source tree.

### HL7

This section describes HL7 lab results import functionality that exists, but only roughly so far, in client v 1.5.2 (server 20.2, database v20)

Here's how it works (all manually ATM), in a rough overview:

- select "unwrap XML to HL7" if needed
  - this extracts HL7 from CDATA attributes of XML nodes

- select "stage HL7 file"
  - this takes an HL7 file, splits it up into single-MSH/single-PID files, and stores those files into clin.incoming_data_unmatched along with a copy of the import log in the .comment

- select "browse incoming data"
  - this exports one row from clin.incoming_data_unmatched and tries to import it into a patient chart
  - if there is a value in .pk_identity_disambiguated it will use that patient, regardless of what the HL7 data says
  - (currently we don't have a way to set that field yet however, the browser displays the identifying information such that a missing patient can be created)
  - if there is no value in that field it will ask whether to use the active patient (if there is one)
  - on failure it will update the .comment field of the incoming data entry, the incoming entry can be viewed (data and comment) from the incoming data browser
  - on success it will delete the incoming_data entry (the data is now in clin.test_result et alii), the hl7 data file will be appended (as a new part) to a document "hl7 data" in the patient's document archive and a note about the import (lab & no+date of results & import file) is added to the patient chart as an administrative entry

Rough, but works.

Next: Viewing test results