Exemplo n.º 1
0
        public List <CdaObservationModel> ExtractDataElements()
        {
            List <CdaObservationModel> returnList = new List <CdaObservationModel>();

            if (this.Initialize())
            {
                if (this.documentType.Value == IheDocumentType.APE)
                {
                    // Education Topic
                    List <POCD_MT000040Procedure> edItems = this.ExtractEducationProcedures();

                    if (edItems != null)
                    {
                        foreach (var edItem in edItems)
                        {
                            CdaSimpleObservation cdaObs = CdaObservationFactory.CreateObservation(edItem);

                            if ((cdaObs != null) && (cdaObs.Code != null))
                            {
                                CdaObservationModel tempObs = CdaObservationModel.Create(cdaObs);
                                returnList.Add(tempObs);
                            }
                        }
                    }
                }
                else if (this.documentType.Value == IheDocumentType.NDS)
                {
                    returnList = this.ExtractBabyObservationsFromNds();
                }
                else
                {
                    List <POCD_MT000040Observation> pocdObsList = this.ExtractObservations();

                    foreach (var pocdObs in pocdObsList)
                    {
                        // *** Create a simple observation ***
                        CdaSimpleObservation cdaObs;

                        cdaObs = CdaObservationFactory.CreateObservation(pocdObs);

                        // *** Convert to model + add to return ***
                        if ((cdaObs != null) && (cdaObs.Code != null))
                        {
                            CdaObservationModel tempObs = CdaObservationModel.Create(cdaObs);
                            returnList.Add(tempObs);
                        }
                    }
                }
            }

            return(returnList);
        }
Exemplo n.º 2
0
        private List <CdaObservationModel> ExtractBabyObservationsFromNds()
        {
            // *** Extract section observations from the document ***

            List <CdaObservationModel> returnList = new List <CdaObservationModel>();
            int babyNumber = 0;

            if (this.Initialize())
            {
                // *** Check if we have something to work with ***
                if (this.PocdDocument != null)
                {
                    if (this.PocdDocument.component != null)
                    {
                        if (this.PocdDocument.component.Item is POCD_MT000040StructuredBody)
                        {
                            POCD_MT000040StructuredBody body = this.PocdDocument.component.Item as POCD_MT000040StructuredBody;

                            if (body.component != null)
                            {
                                if (body.component.Length > 0)
                                {
                                    foreach (var item in body.component)
                                    {
                                        if (item.section != null)
                                        {
                                            if (item.section.code != null)
                                            {
                                                if (item.section.code.code == "57075-4")
                                                {
                                                    if (item.section.component != null)
                                                    {
                                                        foreach (var comp in item.section.component)
                                                        {
                                                            if (comp.section != null)
                                                            {
                                                                if (comp.section.code.code == "10210-3")
                                                                {
                                                                    if (comp.section.entry != null)
                                                                    {
                                                                        ++babyNumber;

                                                                        List <POCD_MT000040Observation> pocdList = new List <POCD_MT000040Observation>();

                                                                        foreach (var entry in comp.section.entry)
                                                                        {
                                                                            if (entry.Item != null)
                                                                            {
                                                                                if (entry.Item is POCD_MT000040Observation)
                                                                                {
                                                                                    POCD_MT000040Observation pocdObs = entry.Item as POCD_MT000040Observation;
                                                                                    pocdList.Add(pocdObs);

                                                                                    List <POCD_MT000040Observation> tempList = this.GetSupportingObservationsFromSection(pocdObs);
                                                                                    pocdList.AddRange(tempList);
                                                                                }
                                                                            }
                                                                        }

                                                                        foreach (var pocdObs in pocdList)
                                                                        {
                                                                            // *** Create a simple observation ***
                                                                            CdaSimpleObservation cdaObs = CdaObservationFactory.CreateObservation(pocdObs);

                                                                            // *** Convert to model + add to return ***
                                                                            if ((cdaObs != null) && (cdaObs.Code != null))
                                                                            {
                                                                                CdaObservationModel tempObs = CdaObservationModel.Create(cdaObs);
                                                                                tempObs.BabyNumber = babyNumber;
                                                                                returnList.Add(tempObs);
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(returnList);
        }