Example #1
0
        public bool AddFingerPrint(FingerPrintMinutias patientFingerprintMinutia, string deviceName, int originalDpi, int originalHeight, int originalWidth)
        {
            bool result = false;

            try
            {
                patientFingerprintMinutia.DeviceName     = deviceName;
                patientFingerprintMinutia.OriginalDpi    = originalDpi;
                patientFingerprintMinutia.OriginalHeight = originalHeight;
                patientFingerprintMinutia.OriginalWidth  = originalWidth;
                FHIRUtilities.LateralitySnoMedCode  lateralitySnoMedCode  = patientFingerprintMinutia.LateralitySnoMedCode;
                FHIRUtilities.CaptureSiteSnoMedCode captureSiteSnoMedCode = patientFingerprintMinutia.CaptureSiteSnoMedCode;
                if (lateralitySnoMedCode == FHIRUtilities.LateralitySnoMedCode.Left || lateralitySnoMedCode == FHIRUtilities.LateralitySnoMedCode.Right)
                {
                    switch (captureSiteSnoMedCode)
                    {
                    case FHIRUtilities.CaptureSiteSnoMedCode.IndexFinger:
                    case FHIRUtilities.CaptureSiteSnoMedCode.MiddleFinger:
                    case FHIRUtilities.CaptureSiteSnoMedCode.RingFinger:
                    case FHIRUtilities.CaptureSiteSnoMedCode.LittleFinger:
                    case FHIRUtilities.CaptureSiteSnoMedCode.Thumb:
                    {
                        result = true;
                        _fingerPrintMinutiasList.Add(patientFingerprintMinutia);
                        break;
                    }
                    }
                }
            }
            catch (Exception ex)
            {
                _exception = ex;
            }
            return(result);
        }
        public static Template ConvertFingerPrintMinutias(FingerPrintMinutias fingerPrintMinutias)
        {
            List <Minutia> listMinutia = new List <Minutia>();

            foreach (FingerPrintMinutia fingerPrintMinutia in fingerPrintMinutias.Minutiae)
            {
                Minutia newMinutiaPoint = new Minutia();
                newMinutiaPoint.Position.X = fingerPrintMinutia.PositionX;
                newMinutiaPoint.Position.Y = fingerPrintMinutia.PositionY;
                newMinutiaPoint.Direction  = fingerPrintMinutia.Direction;
                newMinutiaPoint.Type       = (MinutiaType)fingerPrintMinutia.Type;

                listMinutia.Add(newMinutiaPoint);
            }
            TemplateBuilder tb = new TemplateBuilder();

            tb.Minutiae = listMinutia;
            Template convertedTemplate = new Template(tb);

            return(convertedTemplate);
        }
Example #3
0
        public PatientProfile(string organizationName, Uri fhirAddress, Patient loadPatient, string noidStatus, DateTime checkinDateTime)
        {
            _organizationName = organizationName;
            _fhirAddress      = fhirAddress;
            _noidStatus       = noidStatus;
            _checkinDateTime  = FHIRUtilities.DateTimeToFHIRString(checkinDateTime);
            NewSession();

            if (loadPatient != null)
            {
                _noID = new SourceAFIS.Templates.NoID();

                SetMetaData(loadPatient);       //Sets all the data from the meta area of FHIR message
                SetIdentifierData(loadPatient); //Sets all the data from the identifier area of FHIR message

                // Gets the demographics from the patient FHIR resource class
                _lastName = loadPatient.Name[0].Family.ToString();
                List <string> givenNames = loadPatient.Name[0].Given.ToList();
                _firstName = givenNames[0].ToString();
                if (givenNames.Count > 1)
                {
                    _middleName = givenNames[1].ToString();
                }
                _gender    = loadPatient.Gender.ToString().Substring(0, 1).ToUpper();
                _birthDate = loadPatient.BirthDate.ToString();

                // Gets the address information from the patient FHIR resource class
                if (loadPatient.Address.Count > 0)
                {
                    List <string> addressLines = loadPatient.Address[0].Line.ToList();
                    _streetAddress = addressLines[0].ToString();
                    if (addressLines.Count > 1)
                    {
                        _streetAddress2 = addressLines[1].ToString();
                    }

                    _city       = loadPatient.Address[0].City.ToString();
                    _state      = loadPatient.Address[0].State.ToString();
                    _postalCode = loadPatient.Address[0].PostalCode.ToString();
                    _country    = loadPatient.Address[0].Country.ToString();
                }
                // Gets the contact information from the patient FHIR resource class
                if (loadPatient.Contact.Count > 0)
                {
                    foreach (var contact in loadPatient.Contact)
                    {
                        foreach (var telecom in contact.Telecom)
                        {
                            if (telecom.Use.ToString().ToLower() == "home")
                            {
                                if (telecom.System.ToString().ToLower() == "email")
                                {
                                    EmailAddress = telecom.Value.ToString();
                                }
                                else if (telecom.System.ToString().ToLower() == "phone")
                                {
                                    PhoneHome = telecom.Value.ToString();
                                }
                            }
                            else if (telecom.Use.ToString().ToLower() == "work")
                            {
                                PhoneWork = telecom.Value.ToString();
                            }
                            else if (telecom.Use.ToString().ToLower() == "mobile")
                            {
                                PhoneCell = telecom.Value.ToString();
                            }
                        }
                    }
                }

                if (loadPatient.Photo.Count > 0)
                {
                    foreach (var minutia in loadPatient.Photo)
                    {
                        Attachment mediaAttachment = loadPatient.Photo[0];
                        byte[]     byteMinutias    = mediaAttachment.Data;

                        Stream stream = new MemoryStream(byteMinutias);
                        Media  media  = (Media)FHIRUtilities.StreamToFHIR(new StreamReader(stream));

                        // Get captureSite and laterality from media
                        string captureSiteDescription = media.Extension[1].Value.Extension[1].Value.ToString();
                        string lateralityCode         = media.Extension[1].Value.Extension[2].Value.ToString();
                        string DeviceName             = media.Extension[2].Value.Extension[1].Value.ToString();
                        string OriginalDpi            = media.Extension[2].Value.Extension[2].Value.ToString();
                        string OriginalHeight         = media.Extension[2].Value.Extension[3].Value.ToString();
                        string OriginalWidth          = media.Extension[2].Value.Extension[4].Value.ToString();

                        Template            addMinutia             = ConvertFHIR.FHIRToTemplate(media);
                        FingerPrintMinutias newFingerPrintMinutias = new FingerPrintMinutias(
                            SessionID, addMinutia, FHIRUtilities.SnoMedCodeToLaterality(lateralityCode), FHIRUtilities.StringToCaptureSite(captureSiteDescription));

                        AddFingerPrint(newFingerPrintMinutias, DeviceName, Int32.Parse(OriginalDpi), Int32.Parse(OriginalHeight), Int32.Parse(OriginalWidth));
                    }
                    _biometricsCaptured = GetBiometricsCaptured();
                }
            }
            else
            {
                throw new Exception("Error in PatientProfile constructor.  loadPatient is null.");
            }
        }
Example #4
0
        public Media FingerPrintFHIRMedia(FingerPrintMinutias fingerPrints, string deviceName, int originalDPI, int originalHeight, int originalWidth)
        {
            Media FingerPrintMedia = null;

            try
            {
                if ((fingerPrints != null))
                {
                    //TODO: add capture date/time to message
                    FingerPrintMedia = new Media(); //Creates the fingerprint minutia template FHIR object as media type.
                    FingerPrintMedia.AddExtension("Healthcare Node", FHIRUtilities.OrganizationExtension(OrganizationName, DomainName, ServerName));
                    FingerPrintMedia.AddExtension("Biometic Capture", FHIRUtilities.CaptureSiteExtension(fingerPrints.CaptureSiteSnoMedCode, fingerPrints.LateralitySnoMedCode, deviceName, originalDPI, originalHeight, originalWidth));

                    FingerPrintMedia.Identifier = new List <Identifier>();

                    Identifier idSession;
                    Identifier idPatientCertificate;
                    if ((SessionID != null))
                    {
                        if (SessionID.Length > 0)
                        {
                            idSession        = new Identifier();
                            idSession.System = ServerName + "/fhir/SessionID";
                            idSession.Value  = SessionID;
                            FingerPrintMedia.Identifier.Add(idSession);
                        }
                        else
                        {
                            //TODO this is a critical error.  all need a unique session id.
                        }
                    }
                    else
                    {
                        //TODO this is critical.  all need a unique session id.
                    }
                    if (LocalNoID != null)
                    {
                        if (LocalNoID.Length > 0)
                        {
                            idPatientCertificate        = new Identifier();
                            idPatientCertificate.System = ServerName + "/fhir/LocalNoID";
                            idPatientCertificate.Value  = LocalNoID;
                            FingerPrintMedia.Identifier.Add(idPatientCertificate);
                        }
                    }
                    // TODO: Add RemoteNoID.

                    foreach (var Minutia in fingerPrints.Minutiae)
                    {
                        if (FingerPrintMedia is null)
                        {
                            FingerPrintMedia = new Media();
                        }

                        Extension extFingerPrintMedia = FHIRUtilities.FingerPrintMediaExtension(
                            Minutia.PositionX.ToString(),
                            Minutia.PositionY.ToString(),
                            Minutia.Direction.ToString(),
                            Minutia.Type.ToString()
                            );

                        FingerPrintMedia.AddExtension("Biometrics", extFingerPrintMedia);
                    }
                }
            }
            catch (Exception ex)
            {
                BaseException = ex;
            }
            return(FingerPrintMedia);
        }