# Basic Patient Handling

This section teaches the basic ways of handling patients and demographic data in the GNUmed EMR system.

## Concepts

When the GNUmed client starts up, no patient will appear selected and, in place of patient selection, one of the plugins that does not depend on a patient will run (configurable in GNUmed > Options > User Interface > Initial plugin). You must activate a patient by searching for them before GNUmed will permit your access to certain parts of the user interface. Once a patient has been activated, there will always be an active patient (namely the one you last worked on).

## Searching for a Patient

- in the top toolbar of the GNUmed client click on the search box
- type a search term (usually part of the patient name)
- hit [ENTER]

If only one patient matches the search term that patient is made active. If several patients match the search term a list is shown so the proper patient can be selected. If no patient matches the search term the wizard for creating a new patient is invoked which is then made active. Useful search terms include:

- parts of last and/or first name(s) with or without a separating "," including previous names that are not active anymore
- the GNUmed internal patient ID (prepend with "#" for even faster access)
- any number that is linked to a patient as an external ID
- date of birth (if entered in a format recognized by PostgreSQL to be a date)

Several keys and key combinations bring up tools and selections which were described here. Within the search box:

`<Cursor-Down>`

- shows a list of the ten most-recently activated patients to select from

`<Cursor-Up>`

- brings up the term used in the most recent search

`<F-2>`

- brings up a list of external patients to select from
- external patients can come from various sources:
  - detected to be active in other software running concurrently
  - exported for patient exchange by other software
  - other sources to follow soon (say, German KVK chipcards)

If you are connected to the public test database (at publicdb.gnumed.de), you can try searching on "kirk".

## Registering a New Patient

- in the main menu of the GNUmed client activate the Patient menu
- select the Register new patient menu item

This will start a wizard for adding a new patient to your GNUmed EMR system. You may know how to use a wizard from software installers. A wizard is a sequence of pages each of which asks a few closely related questions. When the [Finish] button is clicked a new patient is added to the database with the data provided in the wizard. Pages will contain required fields which are labelled in red. Some combinations of fields may only become mandatory if any of them is filled in (eg one cannot enter just a zip code and leave blank the rest of the address fields). Mandatory fields that are missing data will be prompted and underlaid in pink when the attempt is made to save the patient.

The actual pages offered in the wizard will depend on several factors including the country you use GNUmed in or the type of insurance policy this patient is under. You will be asked for basic patient demographics such as first and last names, date of birth and gender in any case.

## Editing Patient Demographics

In the main notebook raise the Patient details plugin. This will bring up a notebook page with two tabs. First tab will read Identity and second will read Contacts. Each will show a list of the respective demographic information and allow it to be edited.

## Merging Duplicate Patients

"Merging" in GNUmed terms means that one patient will be kept in the database, one patient record will be deleted, and any data belonging to the deleted patient gets associated with the patient that is kept around. In other words, one patient record is "assimilated" by the other one.

First you want to make absolutely sure you do have duplicate patients.

Then, in the menu Patient choose the item Merge patients. You will be presented a dialog in which to select the patients to be merged. The patient search fields work just like the selector for the active patient in the top panel (except that they do not set the active patient, of course). Then mark which patient you want to keep after the merge.

Before the actual merge occurs you will be presented details on the selected patients. You are asked to explicitely confirm the merger. Make extra sure that what is presented to you is what you want to happen. Unmerging is possible but is a very laborious manual undertaking which required in-depth knowledge of the clinical history of the patients involved as well as solid SQL skills.

You will then need to password of the GNUmed database owner `gm-dbo` to initiate the merging. The merge itself can take a noticeably amount of time if the patient to be merged has a substantial number of clinical items.

After the merge the patient that has been kept will own all names, addresses, health issues, episodes, encounters, documents, test results, progress notes, allergies (in fact, everything) which was previously associated with the merged patient. Note that after the merge:

- the merged patient record will NOT be accessible anymore
- the active name of the merged patient is set to inactive before being added to the assimilating patient
- while all allergies are transferred from the merged patient the allergy state will be that of the assimilating patient

Also note that you cannot merge the currently active patient into another patient. You can, however, merge another patient into the currently active one.

## Deleting a Patient

We do not support deleting a patient from within the Python reference client.

You can, however, disable a patient so that it will not be treated as an active patient anymore. Once merging two patients is implemented you can make accidentally duplicated patients "disappear" by merging the duplicate into the "real" patient. Disabling a patient is a priviledged operation for which you will need to know the `gm-dbo` administrator password.

If you really really want to physically delete a patient from the database (say, for privacy reasons) you need to get in touch with your database administrator (the person with the account `gm-dbo`) to have it done manually at the database console. A discussion of this, with some technical details, is on the list archive here.

Next: Basic Usage Tips