Example #1
0
        //public List<LookupValue> Map(IVocabulary vocabulary, string key, string source, DateTime eventDate,
        //    bool caseSensitive)
        //{
        //    if (!string.IsNullOrEmpty(Lookup))
        //    {
        //        return vocabulary.Lookup(source, Lookup, eventDate, caseSensitive);
        //    }

        //    return new List<LookupValue> {new LookupValue {ConceptId = _fields[key]}};
        //}

        //public List<LookupValue> Map(IVocabulary vocabulary, string key, string source, DateTime eventDate,
        //    bool caseSensitive)
        //{
        //    if (!string.IsNullOrEmpty(Lookup))
        //    {
        //        return vocabulary.Lookup(source, Lookup, eventDate);
        //    }

        //    return new List<LookupValue> { new LookupValue { ConceptId = _fields[key] } };
        //}

        public List <LookupValue> Map(IVocabulary vocabulary, string key, string source, DateTime eventDate)
        {
            if (!string.IsNullOrEmpty(Lookup))
            {
                return(vocabulary.Lookup(source, Lookup, eventDate));
            }

            return(new List <LookupValue> {
                new LookupValue {
                    ConceptId = _fields[key]
                }
            });
        }
Example #2
0
        public void Fill(IVocabulary vocab, ConditionOccurrence[] conditionOccurrences,
                         ProcedureOccurrence[] procedureOccurrences, Observation[] observations, Measurement[] measurements, DrugExposure[] drugExposures)
        {
            var events = new Dictionary <string, List <PregnancyConcept> >();

            Fill(vocab, conditionOccurrences, events);
            Fill(vocab, procedureOccurrences, events);
            Fill(vocab, observations, events);
            Fill(vocab, measurements, events);
            foreach (var e in GetNonDrug(events))
            {
                if (!PregnancyEvents.ContainsKey(e.Category))
                {
                    PregnancyEvents.Add(e.Category, new List <Event>());
                }

                PregnancyEvents[e.Category].Add(e);
            }

            foreach (var de in drugExposures)
            {
                var res = vocab.Lookup(de.ConceptId.ToString(), "PregnancyDrug", DateTime.MinValue);
                if (res.Count == 0 || !res[0].ConceptId.HasValue)
                {
                    continue;
                }

                foreach (var pc in vocab.LookupPregnancyConcept(res[0].ConceptId.Value))
                {
                    if (pc == null)
                    {
                        continue;
                    }

                    if (!PregnancyEvents.ContainsKey(pc.Category))
                    {
                        PregnancyEvents.Add(pc.Category, new List <Event>());
                    }

                    PregnancyEvents[pc.Category].Add(new Event
                    {
                        EventId   = _eventId,
                        Category  = pc.Category,
                        Date      = de.StartDate,
                        PersonId  = de.PersonId,
                        GestValue = null
                    });
                    _eventId++;
                }
            }
        }