Exemple #1
0
        private static PcsData BuildDataFromAxis(XElement axisEl, PcsTabularCode parentCode, bool append, Dictionary <string, PcsOrderTxtLineData> txtLines)
        {
            var ret = new PcsData()
            {
                ParentCodes = Enumerable.Empty <PcsTabularCode>(),
                Terms       = Enumerable.Empty <IcdTerm>()
            };


            var labels = from el in axisEl.Elements()
                         where el.Name.LocalName.Equals("label", StringComparison.CurrentCultureIgnoreCase)
                         let elCode = parentCode != null ? parentCode.Code + el.Attribute("code").Value : el.Attribute("code").Value
                                      let titleAndAppend = txtLines.ContainsKey(elCode) ?
                                                           new Tuple <string, bool>(txtLines[elCode].FullText, false) :
                                                           append ?
                                                           new Tuple <string, bool>(", " + el.Value, true) :
                                                           new Tuple <string, bool>(el.Value, false)
                                                           let title = titleAndAppend.Item2 ? parentCode.Text + titleAndAppend.Item1 : titleAndAppend.Item1
                                                                       select new
            {
                ParentCodes = new PcsTabularCode()
                {
                    ParentCode = parentCode != null ? parentCode.Code : String.Empty,
                    Code       = elCode,
                    Text       = title
                },
                Term = new IcdTerm()
                {
                    ParentCode = parentCode != null ? parentCode.Code : String.Empty,
                    Code       = elCode,
                    Section    = "",
                    Title      = title,
                    Type       = IcdCodeStrings.CodeType_Procedure
                }
            };

            ret.ParentCodes = from label in labels select label.ParentCodes;
            ret.Terms       = from label in labels select label.Term;

            return(ret);
        }
Exemple #2
0
        private static PcsData ProcessAxis(IEnumerable <PcsTabularCode> parentCodes, IEnumerable <IGrouping <string, XElement> > axi, string useCode, bool append, Dictionary <string, PcsOrderTxtLineData> txtLines)
        {
            var ret = new PcsData()
            {
                ParentCodes = Enumerable.Empty <PcsTabularCode>(),
                Terms       = Enumerable.Empty <IcdTerm>()
            };

            var useAxi = from elGroup in axi
                         where elGroup.Key == useCode
                         from el in elGroup
                         select el;

            var data = Enumerable.Empty <PcsData>();

            var parentsArray = parentCodes.ToArray();

            if (parentsArray.Length > 0)
            {
                data = (from parent in parentsArray
                        select from axis in useAxi
                        select BuildDataFromAxis(axis, parent, append, txtLines)).SelectMany(d => d);
            }
            else
            {
                data = from axis in useAxi
                       select BuildDataFromAxis(axis, null, false, txtLines);
            }

            var dataArray = data.ToArray();

            ret.ParentCodes = from dataPieces in dataArray
                              from piece in dataPieces.ParentCodes
                              select piece;

            ret.Terms = from dataPieces in dataArray
                        from piece in dataPieces.Terms
                        select piece;

            return(ret);
        }