public static CdaSimpleObservation CreateObservation(POCD_MT000040Observation pocdObservation)
        {
            CdaSimpleObservation returnVal = null;

            if (pocdObservation.value != null)
            {
                if (pocdObservation.value.Length > 0)
                {
                    ANY first = pocdObservation.value[0];

                    if (first is INT)
                    {
                        returnVal = new CdaIntObservation(pocdObservation);
                    }
                    else if (first is TS)
                    {
                        returnVal = new CdaDateObservation(pocdObservation);
                    }
                    else if (first is PQ)
                    {
                        returnVal = new CdaPqObservation(pocdObservation);
                    }
                    else if (first is ST)
                    {
                        returnVal = new CdaTextObservation(pocdObservation);
                    }
                }
            }

            return(returnVal);
        }
        /// <summary>
        /// Method to allow adding of a pregnancy observation
        /// </summary>
        /// <param name="pregIen">The unique id for the pregnancy</param>
        /// <param name="pregObs">The observation</param>
        public void AddPregnancyObservation(string pregIen, CdaSimpleObservation pregObs)
        {
            // *** Add the pregnancy if it does not exist yet ***
            if (!this.PregnancyOrganizers.ContainsKey(pregIen))
            {
                this.PregnancyOrganizers.Add(pregIen, new PregnancyHistoryOrganizer());
            }

            this.PregnancyOrganizers[pregIen].Observations.Add(pregObs);
        }
        /// <summary>
        /// Method to allow adding of baby observation
        /// </summary>
        /// <param name="pregIen">The unique id for the pregnancy</param>
        /// <param name="babyNum">The unique id for the baby</param>
        /// <param name="babyObs">The observation</param>
        public void AddBabyObservation(string pregIen, string babyNum, CdaSimpleObservation babyObs)
        {
            // *** Add the organizer if it does not exist ***
            if (!this.PregnancyOrganizers.ContainsKey(pregIen))
            {
                this.PregnancyOrganizers.Add(pregIen, new PregnancyHistoryOrganizer());
            }

            this.PregnancyOrganizers[pregIen].AddBabyObservation(babyNum, babyObs);
        }
示例#4
0
        /// <summary>
        /// Add baby observations
        /// </summary>
        /// <param name="babyNum">A unique baby identifier</param>
        /// <param name="obs">The observation to add</param>
        public void AddBabyObservation(string babyNum, CdaSimpleObservation obs)
        {
            if (!this.BirthEventOrganizers.ContainsKey(babyNum))
            {
                this.BirthEventOrganizers.Add(babyNum, new BirthEventOrganizer()
                {
                    BabyNum = babyNum
                });
            }

            this.BirthEventOrganizers[babyNum].Observations.Add(obs);
        }
        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);
        }
        private StrucDocTr CreateRow(CdaSimpleObservation obs, bool isFinal, DateTime dateTime)
        {
            // *** Create the row ***
            StrucDocTr tr = new StrucDocTr()
            {
                ID = obs.ReferenceId
            };

            // *** Create a list of TD ***
            List <StrucDocTd> tdList = new List <StrucDocTd>();

            // *** Add TD's ***

            // *** Date/Time ***
            tdList.Add(new StrucDocTd()
            {
                Text = new string[] { dateTime.ToString() }
            });

            // *** Description ***
            tdList.Add(new StrucDocTd()
            {
                Text = new string[] { obs.Code.DisplayName }
            });

            // *** Value ***
            StrucDocTd td = new StrucDocTd()
            {
                Text = new string[] { obs.DisplayValue }
            };

            td.align          = StrucDocTdAlign.center;
            td.alignSpecified = true;
            tdList.Add(td);

            //// *** Is final ***
            //StrucDocTd td1 = new StrucDocTd() { Text = new string[] { (isFinal) ? "YES" : "NO" } };
            //td1.align = StrucDocTdAlign.center;
            //td1.alignSpecified = true;
            //tdList.Add(td1);

            // *** Add td's to tr ***
            tr.Items = tdList.ToArray();

            return(tr);
        }
示例#7
0
        public static CdaObservationModel Create(CdaSimpleObservation obs)
        {
            CdaObservationModel returnVal = new CdaObservationModel();

            // TODO: Support low/high 
            // TODO: Show time 

            returnVal.EffectiveTime = obs.EffectiveTime.High.ToString(VistaDates.UserDateFormat);

            if (obs.Code != null)
            {
                returnVal.CodeSystem = CodingSystemUtility.GetDescription(obs.Code.CodeSystem);
                returnVal.Code = obs.Code.Code;
                returnVal.DisplayName = obs.Code.DisplayName;
            }

            returnVal.NegationInd = (obs.NegationIndicator) ? "True" : "False";

            returnVal.Status = obs.Status.ToString();

            returnVal.Value = obs.DisplayValue; 

            return returnVal; 
        }
        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);
        }