Go to the first, previous, next, last section, table of contents.

Direct Access to CareVue's Database

Synopsis

idb_direct -e event -r recno -l bed [-s recno2] [-m bed2] [-n nbed]
    [-c] [-H height] [-W weight] [-S BSA]
idb_direct -e 1|8 -r recno -l bed [-c] [-H height] [-W weight] [-S BSA]
idb_direct -e 2   -r recno -l old_bed -n new_bed
idb_direct -e 3   -r recno -l bed
idb_direct -e 17  -r recno1 -l bed1 -s recno2 -m bed2

Description

CareVue does only accept medical record numbers (recno) for patient reference. CareVue's own HL7 interface fails to report many application error conditions, such as admitting a patient into an occupied bed. This script takes the medical record number(s) and bed identifier(s) of a patient (or a pair of patients) and tests

  1. whether the bed is free or occupied,
  2. whether the patient is known or unknown (by his/her record number), and
  3. whether the given (known) patient is assigned to the given (occupied) bed or else the bed is occupied by a different patient. Currently, however, there is no way to report the identity of the other patient back to the calling program.

For the HL7 events A01 (admission), A03 (discharge), and A08 (update pat. info.), only the first bed/patient is tested. For A02 (transfer) the second recno is set equal to the first while the first bed is the source bed and the second bed is the destination bed. Thus one can test, whether the patient was already transfered to the new bed (i.e. if the second bed is occupied by the given known patient).

NOTE
All patient locations are assumed to be within one and the same careunit.

If observations (weight, height, and BSA) are supplied and the commit flag (`-c') is also given, these values are written into the patient record. If the relevant entities (AdmitWt, etc.) do not yet exist, they are inserted and linked to the patient record before.

Any write access to the database requires the patient record to be known to the patient manager in order to avoid severe database havoc. Therefore the ptMgrSup program is repeatedly polled until the patient is found. This can be most efficiently handled by waiting for the admitted patient to appear in the census (ptMgrSup -c) only during the commit phase (-c) of the admission (-e 1) transaction. Thus any successive transaction can be quite sure that it won't get into conflict with a pending admission.

The idb part requires the script new_wt_ht_bsa to be accessible within the standard path in the CHARTING domain. This bourne shell script calls dbload in order to insert new entities in the ADT observation classes.

Return Value

The return value is to be interpreted as a bit-set, where the least significant triple denotes the first (or only) given bed/recno and the more significant triple denotes the second bed/recno. The most significant bit is the error flag. The following table defines the meaning of each bit in a triple:


Bitset  Value   Meaning
------- ------- ------------------------------------------------
001     1       bed is occupied (by whoever)    
010     2       patient is known (assigned to whatever location)
111     7       bed is occupied, patient is known, and given
                patient is assigned to the given bed

The idb_direct script issues CareVue system messages if a patient that is to be admitted will be put on the waiting list because the assigned patient location is occupied (see section The HL7 to CareVue Gateway Program).

The actions being taken by this script highly depend on local considerations. They can be programmed differently. Shell scripts provide an easy way of prototyping changes regarding it's use in other circumstances. It is only required not to change the interface of this script, i.e. the argument list format, and the results presentation to the calling program.

Options

-e event
The ADT event number out of 1, 2, 3, 8, and 17.
-c
Commit flag, tells that the CareVue database is to be updated. Without the commit flag the database will not be changed.
-l bed
The patient location, a valid term for name of BedConfig.
-m bed2
The patient location for the second patient for the event number 17 (swap). A valid term for name of BedConfig.
-n new_bed
The new patient location in a A02 (transfer) transaction. A valid term for name of BedConfig.
-r recno
The medical record number (medRecNum).
-s recno2
The medical record number (medRecNum) of the second patient in a swap transaction (event == 2).
-H height
The height for the admit height (ht).
-W weight
The weight for the admit weight (admitWt).
-S BSA
The surface area value for the body surface area (BSA).

Examples

The idb_direct program is normally only called from a cvgateway process.

Test for admission of patient 12345 into bed 601-1:

/usr/hl7/etc/idb_direct -e 1 -r 12345 -l 601-1 

Test for transfer of patient 12345 from bed 601-1 into 604-7:

/usr/hl7/etc/idb_direct -e 2 -r 12345 -l 601-1 -n 604-7

Test for update of patient 12345 in 601-1. Update the admission observations if the patient does exist in the census:

/usr/hl7/etc/idb_direct -e 8 -r 12345 -l 601-1 -c -H 182 -W 75 -S 2.7

Test for swapping patients 12345 into 601-1 and 54321 into 604-7:

/usr/hl7/etc/idb_direct -e 17 -r 12345 -l 601-1 -s 54321 -m 604-7

Environment

ADMIN
The e-mail address of a system administrator who gets error and warning messages mailed. This variable need not exist, it is better to let the system look for its value in the file `/usr/hl7/etc/admin'
CAREVUE
The rcp address (`login@host') of the carevue system in order for rcp or rsh to execute CareVue idb, dbload and ptMgrSup commands. The user and host who runs idb_direct must have an `.rhosts' entry in this account. This variable need not exist, it is better to let the system look for its value in the file `/usr/hl7/etc/carevue'.

Files

`/usr/hl7/etc/admin'
The e-mail address of a system administrator who gets error and warning messages mailed.
`/usr/hl7/etc/carevue'
The rcp address (`login@host') of the carevue system in order for rcp or rsh to execute CareVue idb, dbload and ptMgrSup commands. The user and host who runs idb_direct must have an `.rhosts' entry in this account.
`cvuser@cvhost:new_wt_ht_bsa'
This file must reside in the login account for carevue command execution. It is needed to run dbload on it in order to create new admission weight, height, and BSA entries.

See Also

sh(1), rcp(1), rsh(1), idb(1), dbload(1), ptMgrSup(1), section The HL7 to CareVue Gateway Program.


Go to the first, previous, next, last section, table of contents.