Ejemplo n.º 1
0
        ///<summary>Returns EhrCodes for the specified EhrMeasureEventType ordered by how often and how recently they have been used.  Results are
        ///ordered by applying a weight based on the date diff from current date to DateTEvent of the EhrMeasureEvents.  EhrCodes used most
        ///recently will have the largest weight and help move the EhrCode to the top of the list.  Specify a limit amount if the result set should only
        ///be a certain number of EhrCodes at most.</summary>
        public static List <EhrCode> GetForEventTypeByUse(EhrMeasureEventType ehrMeasureEventTypes)
        {
            List <EhrCode> retVal = new List <EhrCode>();
            //list of CodeValueResults of the specified type ordered by a weight calculated by summing values based on how recently the codes were used
            List <string> listCodes = EhrMeasureEvents.GetListCodesUsedForType(ehrMeasureEventTypes);

            foreach (string codeStr in listCodes)
            {
                EhrCode codeCur = Listt.FirstOrDefault(x => x.CodeValue == codeStr);
                Snomed  sCur    = null;
                if (codeCur == null)
                {
                    sCur = Snomeds.GetByCode(codeStr);
                    if (sCur == null)
                    {
                        continue;
                    }
                    codeCur = new EhrCode {
                        CodeValue = sCur.SnomedCode, Description = sCur.Description
                    };
                }
                retVal.Add(codeCur);
            }
            return(retVal.OrderBy(x => x.Description).ToList());
        }
Ejemplo n.º 2
0
        ///<summary>Returns a list of EhrCodes for the specified InterventionCodeSet and ValueSetOID for any medication interventions.  Results will
        ///contain both intervention codes and medication codes that have been used in the last year.</summary>
        public static List <EhrCode> GetForIntervAndMedByUse(InterventionCodeSet codeSet, List <string> listMedValueSetOIDs)
        {
            //get all MedicationPats where the RxCui is one of the RxCui strings for list of ValueSetOIDs provided
            List <string>  listMedPats       = MedicationPats.GetAllForRxCuis(GetForValueSetOIDs(listMedValueSetOIDs, true).Select(x => x.CodeValue).ToList());
            List <string>  listInterventions = Interventions.GetAllForCodeSet(codeSet);
            List <EhrCode> retVal            = new List <EhrCode>();

            foreach (string codeStr in listMedPats.Union(listInterventions))
            {
                EhrCode codeCur = Listt.FirstOrDefault(x => x.CodeValue == codeStr);
                if (codeCur == null)
                {
                    continue;
                }
                retVal.Add(codeCur);
            }
            //we might find the "wrong" ehr code, because a single code may be in multiple code sets. This is still a valid code.
            return(retVal.OrderBy(x => x.Description).ToList());
        }