Gnumed.business.gmHL7

Package Gnumed :: Package business :: Module gmHL7 |
[frames] | no frames]

# Module gmHL7

source code

Some HL7 handling.

Author: K.Hilbert <Karsten.Hilbert@gmx.net>

License: GPL v2 or later

Classes
| cIncomingData Represents items of incoming data, say, HL7 snippets.

Functions
get_incoming_data(order_by=None) | source code
create_incoming_data(data_type, filename) | source code
delete_incoming_data(pk_incoming_data=None) | source code
fix_HL7_stupidities(filename, encoding='utf8') | source code
extract_HL7_from_CDATA(filename, xml_path) | source code
split_HL7_by_MSH(filename, encoding='utf8') | source code
flatten_MSH_by_PID(filename) Assumes: | source code
split_HL7_by_PID(filename, encoding='utf8') | source code
import_MSH(filename) Assumes what's produced by flatten_MSH_by_PID(). | source code
stage_MSH_as_incoming_data(filename, source=None) Assumes what's produced by flatten_MSH_by_PID(). | source code
format_hl7_message(message=None, skip_empty_fields=True, eol=u'\n ') | source code
format_hl7_file(filename, skip_empty_fields=True, eol=u'\n ', return_filename=False) | source code

Variables
| HL7_EOL = `u'\r'`
| HL7_SEGMENTS = `u'FHS BHS MSH PID PV1 OBX NTE ORC OBR'.split()`
| MSH_sending_lab = `3`
| PID_name = `5`
| PID_lastname = `0`
| PID_firstname = `1`
| PID_middlename = `2`
| PID_dob = `7`
| PID_gender = `8`
| OBX_type = `3`
| OBX_LOINC = `0`
| OBX_name = `1`
| OBX_value = `5`
| OBX_unit = `6`
| HL7_field_labels = `{'PID': {0: 'Segment Type', 1: '<PID> Set I`...``

Imports: sys, os, codecs, logging, time, pyDT, pyhl7, pyxml, gmTools, gmBusinessDBObject, gmPG2, gmDateTime, gmPathLab

Function Details

### flatten_MSH_by_PID(filename) | source code
Assumes: ONE MSH per file utf8 encoding first non-empty line must be MSH line anything between MSH and PID is lost IOW, what's created by split_HL7_into_MSH()

Variables Details

  ### HL7_field_labels Value:
      {'PID': {0: 'Segment Type', 1: '<PID> Set ID', 2: 'Patient ID', 5: 'Pa
      tient name', 7: 'Date/Time of birth', 8: 'Administrative gender'}, 'OB
      R': {0: 'Segment Type'}, 'OBX': {0: 'Segment Type', 1: 'Set ID', 2: 'V
      alue Type', 3: 'Identifier (LOINC)', 4: 'Observation Sub-ID', 5: 'Valu
      e', 6: 'Units', 7: 'References Range (Low - High)', 8: 'Abnormal Flags
      ', 11: 'Result Status', 14: 'Date/Time of Observation'}}