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
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

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()