public static List <SearchResultDrugEvent> CnvDeviceEventsToResultDrugEvents(List <AdverseDeviceEvent> tmpAdverseDeviceEventList)
            {
                var result = new List <SearchResultDrugEvent>();

                foreach (var itm in tmpAdverseDeviceEventList)
                {
                    var obj = new SearchResultDrugEvent();

                    obj.Classification = "Device Event";
                    obj.IsEvent        = false;
                    obj.IsDeviceEvent  = true;

                    if (itm.EventType.ToString().
                        Length > 1)
                    {
                        obj.Seriousness.Add(itm.EventType);
                    }

                    obj.DateStarted = Utilities.ConvertDateStringToDate(itm.DateOfEvent, "yyyyMMdd").
                                      ToString("ddMMMyyyy");
                    obj.ReportDate = Utilities.ConvertDateStringToDate(itm.DateReceived, "yyyyMMdd").
                                     ToString("ddMMMyyyy");
                    // DateTime.TryParse(itm.DateOfEvent, .DateStarted)
                    //DateTime.TryParse(itm.DateReceived, .ReceiptDate)

                    var objDetail = new SearchResultDrugEventItem();

                    foreach (var deviceItem in itm.Device)
                    {
                        if (!string.IsNullOrEmpty(deviceItem.BrandName))
                        {
                            objDetail.BrandName.Add(deviceItem.BrandName.ToTitleCase());
                        }

                        if (!string.IsNullOrEmpty(deviceItem.GenericName))
                        {
                            objDetail.GenericName.Add(deviceItem.GenericName.ToTitleCase());
                        }

                        foreach (var mdrItem in itm.MdrText)
                        {
                            obj.Description.Add(mdrItem.Text.ToTitleCase());
                        }
                    }

                    obj.DrugItem.Add(objDetail);

                    result.Add(obj);
                }

                return(result);
            }
            public static List<SearchResultDrugEvent> CnvDeviceEventsToResultDrugEvents(List<AdverseDeviceEvent> tmpAdverseDeviceEventList)
            {
                var result = new List<SearchResultDrugEvent>();

                foreach (var itm in tmpAdverseDeviceEventList)
                {
                    var obj = new SearchResultDrugEvent();

                    obj.Classification = "Device Event";
                    obj.IsEvent = false;
                    obj.IsDeviceEvent = true;

                    if (itm.EventType.ToString().
                            Length > 1)
                    {
                        obj.Seriousness.Add(itm.EventType);
                    }

                    obj.DateStarted = Utilities.ConvertDateStringToDate(itm.DateOfEvent, "yyyyMMdd").
                                                ToString("ddMMMyyyy");
                    obj.ReportDate = Utilities.ConvertDateStringToDate(itm.DateReceived, "yyyyMMdd").
                                               ToString("ddMMMyyyy");
                    // DateTime.TryParse(itm.DateOfEvent, .DateStarted)
                    //DateTime.TryParse(itm.DateReceived, .ReceiptDate)

                    var objDetail = new SearchResultDrugEventItem();

                    foreach (var deviceItem in itm.Device)
                    {
                        if (!string.IsNullOrEmpty(deviceItem.BrandName))
                        {
                            objDetail.BrandName.Add(deviceItem.BrandName.ToTitleCase());
                        }

                        if (!string.IsNullOrEmpty(deviceItem.GenericName))
                        {
                            objDetail.GenericName.Add(deviceItem.GenericName.ToTitleCase());
                        }

                        foreach (var mdrItem in itm.MdrText)
                        {
                            obj.Description.Add(mdrItem.Text.ToTitleCase());
                        }
                    }

                    obj.DrugItem.Add(objDetail);

                    result.Add(obj);
                }

                return result;
            }
예제 #3
0
            public static List <SearchResultDrugEvent> ConvertJsonData(List <AdverseDrugEvent> drugEvent)
            {
                var data = new List <SearchResultDrugEvent>();

                foreach (var itm in drugEvent)
                {
                    var obj = new SearchResultDrugEvent();

                    if (!(itm.Patient.PatientDeathDate == null))
                    {
                        obj.IsPatientDeath = true;
                    }

                    obj.PatientSex = Enum.GetName(typeof(PatientSex), itm.Patient.PatientSex);

                    if (!string.IsNullOrEmpty(itm.ReceiveDate))
                    {
                        //.DateStarted = ConvertDateStringToDate(itm.ReceiveDate, "yyyyMMdd")
                        obj.DateStarted = DateTime.ParseExact(itm.ReceiveDate, "yyyyMMdd", CultureInfo.InvariantCulture).
                                          ToString("ddMMMyyyy");
                    }

                    if (!string.IsNullOrEmpty(itm.ReceiptDate))
                    {
                        //.ReceiptDate = ConvertDateStringToDate(itm.ReceiptDate, "yyyyMMdd")
                        obj.ReportDate = DateTime.ParseExact(itm.ReceiptDate, "yyyyMMdd", CultureInfo.InvariantCulture).
                                         ToString("ddMMMyyyy");
                    }

                    //Seriousneess
                    if (!string.IsNullOrEmpty(itm.Serious))
                    {
                        switch (itm.Serious)
                        {
                        case "1":
                            obj.Seriousness.Add(
                                "The adverse event resulted in death, a life threatening condition, hospitalization, disability, congenital anomali, or other serious condition.");
                            break;

                        case "2":
                            obj.Seriousness.Add(
                                "The adverse event did not result in (death, a life threatening condition, hospitalization, disability, congenital anomali, or other serious condition.)");
                            break;
                        }
                    }

                    if (!string.IsNullOrEmpty(itm.SeriousnessCongenitalAnomali))
                    {
                        if (itm.SeriousnessCongenitalAnomali == "1")
                        {
                            obj.Seriousness.Add("The adverse event resulted in a congenital anomali");
                        }
                    }

                    if (!string.IsNullOrEmpty(itm.SeriousnessDeath))
                    {
                        if (itm.SeriousnessDeath == "1")
                        {
                            obj.Seriousness.Add("The adverse event resulted in death");
                        }
                    }

                    if (!string.IsNullOrEmpty(itm.SeriousnessDisabling))
                    {
                        if (itm.SeriousnessDisabling == "1")
                        {
                            obj.Seriousness.Add("The adverse event resulted in disability");
                        }
                    }

                    if (!string.IsNullOrEmpty(itm.SeriousnessHospitalization))
                    {
                        if (itm.SeriousnessHospitalization == "1")
                        {
                            obj.Seriousness.Add("The adverse event resulted in a hospitalization");
                        }
                    }

                    if (!string.IsNullOrEmpty(itm.SeriousnessLifeThreatening))
                    {
                        if (itm.SeriousnessLifeThreatening == "1")
                        {
                            obj.Seriousness.Add("The adverse event resulted in a life threatening condition");
                        }
                    }

                    if (!string.IsNullOrEmpty(itm.SeriousnessOther))
                    {
                        if (itm.SeriousnessOther == "1")
                        {
                            obj.Seriousness.Add("The adverse event resulted in some other serious condition");
                        }
                    }

                    //.Sender
                    //.Receiver
                    // .Reactions
                    foreach (var react in itm.Patient.Reaction)
                    {
                        obj.Reactions.Add(react.ReactionMedDrapt);
                    }

                    foreach (var drug in itm.Patient.Drug)
                    {
                        var drugItem = new SearchResultDrugEventItem();

                        foreach (var ofda in drug.OpenFDA.Brand_Name)
                        {
                            drugItem.BrandName.Add(ofda.ToTitleCase());
                        }

                        foreach (var ofda in drug.OpenFDA.Generic_Name)
                        {
                            drugItem.GenericName.Add(ofda.ToTitleCase());
                        }

                        foreach (var ofda in drug.OpenFDA.Manufacturer_Name)
                        {
                            drugItem.ManufacturerName.Add(ofda.ToTitleCase());
                        }

                        foreach (var ofda in drug.OpenFDA.Route)
                        {
                            drugItem.Route.Add(ofda.ToTitleCase());
                        }

                        obj.DrugItem.Add(drugItem);
                    }

                    data.Add(obj);
                }

                return(data);
            }