[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] GNUmed HL7 import - patient association or creation

From: Karsten Hilbert
Subject: Re: [Gnumed-devel] GNUmed HL7 import - patient association or creation
Date: Wed, 21 Jan 2015 23:15:29 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, Jan 21, 2015 at 07:37:10PM +0000, Jim Busser wrote:

> Can I be pointed to where, in the code, the minimum requirements for 
> "matching" an incoming HL7 message to an existing (possibly needing to be 
> re-associated) patient is specified? Is it in

def __find_patient(PID=None):
        name = PID[PID_name]
        pat_lname = name[PID_lastname]
        pat_fname = name[PID_firstname]
        pat_mname = None
        if len(name) > 2:
                pat_mname = name[PID_middlename]
        _log.debug('patient data from PID segment: first=%s (middle=%s) 
last=%s', pat_fname, pat_mname, pat_lname)
        dto = gmPerson.cDTO_person()
        dto.firstnames = pat_fname
        dto.lastnames = pat_lname
        dto.gender = HL7_GENDERS[PID[PID_gender][0]]
        dob = time.strptime(PID[PID_dob][0], '%Y%m%d')
        dto.dob = pyDT.datetime(dob.tm_year, dob.tm_mon, dob.tm_mday, tzinfo = 
        idents = dto.get_candidate_identities()
        if len(idents) == 0:
                _log.warning('no match candidate, not auto-importing')
                return []
        if len(idents) > 1:
                _log.warning('more than one match candidate, not 
                return idents
        return [gmPerson.cPatient(idents[0].ID)]

GPG key ID E4071346 @
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

reply via email to

[Prev in Thread] Current Thread [Next in Thread]