private List <IdNamePair> getAllCommModes(IDataDomainRequest request)
        {
            List <IdNamePair> response = null;

            try
            {
                response = new List <IdNamePair>();
                string      DDLookupServiceUrl = ConfigurationManager.AppSettings["DDLookupServiceUrl"];
                IRestClient client             = new JsonServiceClient();
                string      url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/commmodes",
                                                                       DDLookupServiceUrl,
                                                                       "NG",
                                                                       request.Version,
                                                                       request.ContractNumber), request.UserId);

                // [Route("/{Context}/{Version}/{ContractNumber}/commmodes", "GET")]
                Phytel.API.DataDomain.LookUp.DTO.GetAllCommModesDataResponse dataDomainResponse = client.Get <Phytel.API.DataDomain.LookUp.DTO.GetAllCommModesDataResponse>(url);
                List <IdNamePair> dataList = dataDomainResponse.CommModes;
                if (dataList != null && dataList.Count > 0)
                {
                    response = dataList;
                }
            }
            catch (Exception ex) { throw ex; }
            return(response);
        }
        public static IMongoSearchRepository GetSearchRepository(IDataDomainRequest request, RepositoryType type)
        {
            try
            {
                IMongoSearchRepository repo = null;

                switch (type)
                {
                case RepositoryType.Search:
                {
                    var context = new SearchMongoContext(request.ContractNumber);
                    repo = new MongoSearchRepository <SearchMongoContext>(context)
                    {
                        UserId = request.UserId, ContractDBName = request.ContractNumber
                    };
                    break;
                }

                case RepositoryType.Lucene:
                {
                    repo = new LuceneSearchRepository()
                    {
                        UserId = request.UserId, ContractDBName = request.ContractNumber
                    };
                    break;
                }
                }
                return(repo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #3
0
 protected static void RequireUserId(IDataDomainRequest request)
 {
     if (string.IsNullOrEmpty(request.UserId))
     {
         throw new UnauthorizedAccessException("PatientNoteDD:Put()::Unauthorized Access");
     }
 }
        public ISchedulingRepository GetRepository(IDataDomainRequest request, RepositoryType type)
        {
            try
            {
                ISchedulingRepository repo = null;

                switch (type)
                {
                case RepositoryType.ToDo:
                {
                    repo = new StubMongoToDoRepository(request.ContractNumber);
                    break;
                }

                case RepositoryType.Schedule:
                {
                    repo = new StubMongoScheduleRepository(request.ContractNumber);
                    break;
                }
                }

                repo.UserId = request.UserId;
                return(repo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #5
0
        /// <summary>
        /// Calls PatientSystem data domain to insert an Engage System record for the newly created patient.
        /// </summary>
        /// <param name="request">IDataDomainRequest object</param>
        /// <returns>PatientSystemData object.</returns>
        private PatientSystemData insertEngagePatientSystem(string patientId, IDataDomainRequest request)
        {
            PatientSystemData data = null;

            try
            {
                InsertPatientSystemDataRequest psRequest = new InsertPatientSystemDataRequest
                {
                    PatientId          = patientId,
                    IsEngageSystem     = true,
                    PatientSystemsData = new PatientSystemData {
                        PatientId = patientId
                    },
                    Context        = request.Context,
                    ContractNumber = request.ContractNumber,
                    UserId         = Constants.SystemContactId,// the requirement says that the engage Id should have createdby user as 'system'.
                    Version        = request.Version
                };

                string      DDPatientSystemServiceUrl = ConfigurationManager.AppSettings["DDPatientSystemServiceUrl"];
                IRestClient client = new JsonServiceClient();
                //[Route("/{Context}/{Version}/{ContractNumber}/Patient/{PatientId}/PatientSystem", "POST")]
                string url = Helpers.BuildURL(string.Format("{0}/{1}/{2}/{3}/Patient/{4}/PatientSystem", DDPatientSystemServiceUrl, psRequest.Context, psRequest.Version, psRequest.ContractNumber, psRequest.PatientId), psRequest.UserId);
                InsertPatientSystemDataResponse dataDomainResponse = client.Post <InsertPatientSystemDataResponse>(url, psRequest as object);
                if (dataDomainResponse != null)
                {
                    data = dataDomainResponse.PatientSystemData;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(data);
        }
Exemple #6
0
        public IPatientObservationRepository GetRepository(IDataDomainRequest request, RepositoryType type)
        {
            IPatientObservationRepository repo = null;

            switch (type)
            {
            case RepositoryType.PatientObservation:
            {
                repo =
                    new MongoPatientObservationRepository(request.ContractNumber);
                break;
            }

            case RepositoryType.Observation:
            {
                repo =
                    new MongoObservationRepository(request.ContractNumber);
                break;
            }
            }

            if (repo != null)
            {
                repo.UserId = request.UserId;
            }

            return(repo);
        }
Exemple #7
0
        public IPatientRepository GetRepository(IDataDomainRequest request, RepositoryType type)
        {
            IPatientRepository repo = null;

            switch (type)
            {
            case RepositoryType.Patient:
            {
                repo = new MongoPatientRepository(request.ContractNumber) as IPatientRepository;
                break;
            }

            case RepositoryType.CohortPatientView:
            {
                repo = new MongoCohortPatientViewRepository(request.ContractNumber)
                {
                    Utils = new DTOUtils()
                } as IPatientRepository;
                break;
            }

            case RepositoryType.PatientUser:
            {
                repo = new MongoPatientUserRepository(request.ContractNumber) as IPatientRepository;
                break;
            }
            }

            repo.UserId = request.UserId;
            return(repo);
        }
Exemple #8
0
        public IGoalRepository GetRepository(IDataDomainRequest request, RepositoryType type)
        {
            try
            {
                IGoalRepository repo = null;

                switch (type)
                {
                case RepositoryType.PatientGoal:
                {
                    repo = new MongoPatientGoalRepository(request.ContractNumber);
                    break;
                }

                case RepositoryType.PatientBarrier:
                {
                    repo = new MongoPatientBarrierRepository(request.ContractNumber);
                    break;
                }

                case RepositoryType.PatientTask:
                {
                    repo = new MongoPatientTaskRepository(request.ContractNumber);
                    break;
                }

                case RepositoryType.PatientIntervention:
                {
                    repo = new MongoPatientInterventionRepository(request.ContractNumber);
                    break;
                }

                case RepositoryType.Goal:
                {
                    repo = new MongoGoalRepository(request.ContractNumber);
                    break;
                }

                case RepositoryType.Task:
                {
                    repo = new MongoTaskRepository(request.ContractNumber);
                    break;
                }

                case RepositoryType.Intervention:
                {
                    repo = new MongoInterventionRepository(request.ContractNumber);
                    break;
                }
                }

                repo.UserId = request.UserId;
                return(repo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #9
0
        private List <PatientInterventionData> getInterventionsByPatientGoalId(IDataDomainRequest request, string patientGoalId)
        {
            IGoalRepository repo = Factory.GetRepository(request, RepositoryType.PatientIntervention);

            List <PatientInterventionData> interventionDataList = repo.Find(patientGoalId) as List <PatientInterventionData>;

            return(interventionDataList);
        }
Exemple #10
0
        private List <PatientTaskData> getTasksByPatientGoalId(IDataDomainRequest request, string patientGoalId)
        {
            IGoalRepository repo = Factory.GetRepository(request, RepositoryType.PatientTask);

            List <PatientTaskData> taskDataList = repo.Find(patientGoalId) as List <PatientTaskData>;

            return(taskDataList);
        }
Exemple #11
0
        private List <PatientBarrierData> getBarriersByPatientGoalId(IDataDomainRequest request, string patientGoalId)
        {
            IGoalRepository repo = Factory.GetRepository(request, RepositoryType.PatientBarrier);

            List <PatientBarrierData> barrierDataList = repo.Find(patientGoalId) as List <PatientBarrierData>;

            return(barrierDataList);
        }
Exemple #12
0
        public static IMongoMedicationRepository GetMedicationRepository(IDataDomainRequest request, RepositoryType type)
        {
            try
            {
                IMongoMedicationRepository repo = null;

                switch (type)
                {
                case RepositoryType.Medication:
                {
                    var context = new MedicationMongoContext(request.ContractNumber);
                    repo = new MongoMedicationRepository <MedicationMongoContext>(context)
                    {
                        UserId = request.UserId, ContractDBName = request.ContractNumber
                    };
                    break;
                }

                case RepositoryType.MedicationMapping:
                {
                    var context = new MedicationMongoContext(request.ContractNumber);
                    repo = new MongoMedicationMappingRepository <MedicationMongoContext>(context)
                    {
                        UserId = request.UserId, ContractDBName = request.ContractNumber
                    };
                    break;
                }

                case RepositoryType.PatientMedSupp:
                {
                    var context = new MedicationMongoContext(request.ContractNumber);
                    repo = new MongoPatientMedSuppRepository <MedicationMongoContext>(context)
                    {
                        UserId = request.UserId, ContractDBName = request.ContractNumber
                    };
                    break;
                }

                case RepositoryType.PatientMedFrequency:
                {
                    var context = new MedicationMongoContext(request.ContractNumber);
                    repo = new MongoPatientMedFrequencyRepository <MedicationMongoContext>(context)
                    {
                        UserId = request.UserId, ContractDBName = request.ContractNumber
                    };
                    break;
                }
                }
                return(repo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #13
0
        public ICareMemberRepository GetRepository(IDataDomainRequest request, RepositoryType type)
        {
            ICareMemberRepository repo = null;

            switch (type)
            {
            case RepositoryType.CareMember:
            {
                repo = new MongoCareMemberRepository(request.ContractNumber) as ICareMemberRepository;
                break;
            }
            }

            repo.UserId = request.UserId;
            return(repo);
        }
        public IProgramRepository GetRepository(IDataDomainRequest request, RepositoryType type)
        {
            IProgramRepository repo = null;

            switch (type)
            {
            case RepositoryType.Program:
            {
                repo = new MongoProgramRepository(request.ContractNumber) as IProgramRepository;
                break;
            }

            case RepositoryType.PatientProgram:
            {
                repo = new MongoPatientProgramRepository(request.ContractNumber) as IProgramRepository;
                break;
            }

            case RepositoryType.ContractProgram:
            {
                repo = new MongoContractProgramRepository(request.ContractNumber) as IProgramRepository;
                break;
            }

            case RepositoryType.Response:
            {
                repo = new MongoResponseRepository(request.ContractNumber) as IProgramRepository;
                break;
            }

            case RepositoryType.PatientProgramResponse:
            {
                repo = new MongoPatientProgramResponseRepository(request.ContractNumber) as IProgramRepository;
                break;
            }

            case RepositoryType.PatientProgramAttribute:
            {
                repo = new MongoPatientProgramAttributeRepository(request.ContractNumber) as IProgramRepository;
                break;
            }
            }

            repo.UserId = request.UserId;
            return(repo);
        }
Exemple #15
0
        public ProgramAttributeData GetProgramAttributes(string objectId, IDataDomainRequest request)
        {
            try
            {
                ProgramAttributeData pad  = null;
                IProgramRepository   repo = Factory.GetRepository(request, RepositoryType.PatientProgramAttribute);

                MEProgramAttribute pa = repo.FindByPlanElementID(objectId) as MEProgramAttribute;
                if (pa != null)
                {
                    pad = new ProgramAttributeData
                    {
                        //  AssignedBy = pa.AssignedBy.ToString(), Sprint 12
                        //  AssignedTo = pa.AssignedTo.ToString(), Sprint 12
                        // AssignedOn = pa.AssignedOn, Sprint 12
                        Completed          = (int)pa.Completed,
                        CompletedBy        = pa.CompletedBy,
                        DateCompleted      = pa.DateCompleted,
                        DidNotEnrollReason = pa.DidNotEnrollReason,
                        Eligibility        = (int)pa.Eligibility,
                        //  AttrEndDate = pa.EndDate, , Sprint 12
                        Enrollment       = (int)pa.Enrollment,
                        GraduatedFlag    = (int)pa.GraduatedFlag,
                        Id               = pa.Id.ToString(),
                        IneligibleReason = pa.IneligibleReason,
                        Locked           = (int)pa.Locked,
                        OptOut           = pa.OptOut,
                        OverrideReason   = pa.OverrideReason,
                        PlanElementId    = pa.PlanElementId.ToString(),
                        Population       = pa.Population,
                        RemovedReason    = pa.RemovedReason,
                        // AttrStartDate = pa.StartDate, Sprint 12
                        Status = (int)pa.Status
                    };
                }
                return(pad);
            }
            catch (Exception ex)
            {
                throw new Exception("DD:DataProgramManager:GetProgramAttributes()::" + ex.Message, ex.InnerException);
            }
        }
        public IPatientRepository GetRepository(IDataDomainRequest request, RepositoryType type)
        {
            IPatientRepository repo = null;

            switch (type)
            {
            case RepositoryType.Patient:
            {
                repo = new StubPatientRespository(request.ContractNumber) as IPatientRepository;
                break;
            }

            case RepositoryType.CohortPatientView:
            {
                repo = new StubCohortPatientViewRepository(request.ContractNumber) as IPatientRepository;
                break;
            }
            }

            repo.UserId = request.UserId;
            return(repo);
        }
Exemple #17
0
        public ILookUpRepository GetRepository(IDataDomainRequest request, RepositoryType type)
        {
            ILookUpRepository repo = null;

            switch (type)
            {
            case RepositoryType.LookUp:
            {
                repo = new MongoLookUpRepository(request.ContractNumber) as ILookUpRepository;
                break;
            }

            case RepositoryType.Setting:
            {
                repo = new MongoSettingRepository(request.ContractNumber) as ILookUpRepository;
                break;
            }
            }

            repo.UserId = request.UserId;
            return(repo);
        }
Exemple #18
0
        private string getDefaultTimeZone(IDataDomainRequest request)
        {
            string timeZoneId = null;

            try
            {
                IRestClient client = new JsonServiceClient();
                string      url    = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/TimeZone/Default",
                                                                          DDLookupServiceUrl,
                                                                          "NG",
                                                                          request.Version,
                                                                          request.ContractNumber), request.UserId);

                //  [Route("/{Context}/{Version}/{ContractNumber}/TimeZone/Default", "GET")]
                Phytel.API.DataDomain.LookUp.DTO.GetTimeZoneDataResponse dataDomainResponse = client.Get <Phytel.API.DataDomain.LookUp.DTO.GetTimeZoneDataResponse>(url);
                if (dataDomainResponse != null && dataDomainResponse.TimeZone != null)
                {
                    timeZoneId = dataDomainResponse.TimeZone.Id;
                }
            }
            catch (Exception ex) { throw ex; }
            return(timeZoneId);
        }
        public IAttributeRepository GetRepository(IDataDomainRequest request, RepositoryType type)
        {
            try
            {
                IAttributeRepository repo = null;

                switch (type)
                {
                case RepositoryType.AttributeLibrary:
                {
                    repo = new MongoAttributeLibraryRepository(request.ContractNumber);
                    break;
                }
                }

                repo.UserId = request.UserId;
                return(repo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #20
0
        public ObservationValueData InitializePatientObservation(IDataDomainRequest request, string patientId, List <ObservationValueData> list, ObservationData od, string initSetId)
        {
            try
            {
                IPatientObservationRepository repo = Factory.GetRepository(request, RepositoryType.PatientObservation);

                PutInitializeObservationDataRequest req = new PutInitializeObservationDataRequest
                {
                    PatientId      = patientId,
                    ObservationId  = od.Id,
                    Context        = request.Context,
                    ContractNumber = request.ContractNumber,
                    UserId         = request.UserId,
                    Version        = request.Version,
                    SetId          = initSetId
                };

                ObservationValueData ovd = new ObservationValueData();

                // get last value for each observation data
                GetPreviousValuesForObservation(ovd, patientId, od.Id, request);

                PatientObservationData pod = (PatientObservationData)repo.Initialize(req);

                ovd.Id    = pod.Id;
                ovd.Text  = od.Description;
                ovd.Value = string.Empty; // changed to initialize the value.

                list.Add(ovd);

                return(ovd);
            }
            catch (Exception ex)
            {
                throw new Exception("DD.DataPatientObservationManager:InitializePatientObservation()::" + ex.Message, ex.InnerException);
            }
        }
Exemple #21
0
        public static IMongoAllergyRepository GetAllergyRepository(IDataDomainRequest request, RepositoryType type)
        {
            try
            {
                IMongoAllergyRepository repo = null;

                switch (type)
                {
                case RepositoryType.Allergy:
                {
                    //var db = AppHostBase.Instance.Container.ResolveNamed<string>(Constants.Domain);
                    var context = new AllergyMongoContext(request.ContractNumber);
                    repo = new StubAllergyRepository <AllergyMongoContext>(context)
                    {
                        UserId = request.UserId, ContractDBName = request.ContractNumber
                    };
                    break;
                }

                case RepositoryType.PatientAllergy:
                {
                    //var db = AppHostBase.Instance.Container.ResolveNamed<string>(Constants.Domain);
                    var context = new AllergyMongoContext(request.ContractNumber);
                    repo = new StubPatientAllergyRepository <AllergyMongoContext>(context)
                    {
                        UserId = request.UserId, ContractDBName = request.ContractNumber
                    };
                    break;
                }
                }
                return(repo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #22
0
        private List <PatientSystemData> getPatientSystems(List <string> processedPatientSystemIds, IDataDomainRequest request)
        {
            List <PatientSystemData> psData = new List <PatientSystemData>();

            try
            {
                if (processedPatientSystemIds != null && processedPatientSystemIds.Count > 0)
                {
                    GetPatientSystemByIdsDataRequest psRequest = new GetPatientSystemByIdsDataRequest
                    {
                        Ids            = processedPatientSystemIds,
                        Context        = request.Context,
                        ContractNumber = request.ContractNumber,
                        UserId         = request.UserId,
                        Version        = request.Version
                    };

                    string      DDPatientSystemServiceUrl = ConfigurationManager.AppSettings["DDPatientSystemServiceUrl"];
                    IRestClient client = new JsonServiceClient();
                    //[Route("/{Context}/{Version}/{ContractNumber}/PatientSystems/Ids", "POST")]
                    string url = Helpers.BuildURL(string.Format("{0}/{1}/{2}/{3}/PatientSystems/Ids", DDPatientSystemServiceUrl, psRequest.Context, psRequest.Version, psRequest.ContractNumber), psRequest.UserId);
                    GetPatientSystemByIdsDataResponse dataDomainResponse = client.Post <GetPatientSystemByIdsDataResponse>(url, psRequest as object);
                    if (dataDomainResponse != null)
                    {
                        psData = dataDomainResponse.PatientSystems;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(psData);
        }
Exemple #23
0
        public List <DTO.ModuleDetail> GetModules(List <Module> list, string contractProgId, IDataDomainRequest request)
        {
            List <DTO.ModuleDetail> modules = new List <DTO.ModuleDetail>();

            list.ForEach(m =>
            {
                modules.Add(new DTO.ModuleDetail
                {
                    Id            = m.Id.ToString(),
                    Name          = m.Name,
                    Description   = m.Description,
                    SourceId      = m.SourceId.ToString(),
                    AttrStartDate = m.AttributeStartDate,
                    AttrEndDate   = m.AttributeEndDate,
                    AssignDate    = m.AssignedOn,
                    AssignTo      = m.AssignedTo.ToString(),
                    AssignBy      = m.AssignedBy.ToString(),
                    Objectives    = this.GetObjectivesData(m.Objectives),
                    Actions       = GetActions(m.Actions)
                });
            });
            return(modules);
        }
Exemple #24
0
 public List <Module> GetClonedModules(ObjectId?abyId, List <Module> list, IDataDomainRequest request, List <ObjectId> sil)
 {
     throw new NotImplementedException();
 }
Exemple #25
0
 public List <DTO.ActionsDetail> GetActions(List <MongoDB.DTO.Action> list, IDataDomainRequest request, Module mod)
 {
     throw new NotImplementedException();
 }
Exemple #26
0
        /// <summary>
        /// Calls PatientSystem data domain to insert bulk Engage System records for the provided patient ids.
        /// </summary>
        /// <param name="request">IDataDomainRequest object</param>
        /// <returns>List of ids of the engage patient systems inserted.</returns>
        private List <string> insertBatchEngagePatientSystem(List <string> patientIds, IDataDomainRequest request)
        {
            List <string> ids = null;

            try
            {
                if (patientIds != null && patientIds.Count > 0)
                {
                    InsertBatchEngagePatientSystemsDataRequest psRequest = new InsertBatchEngagePatientSystemsDataRequest
                    {
                        PatientIds     = patientIds,
                        Context        = request.Context,
                        ContractNumber = request.ContractNumber,
                        UserId         = Constants.SystemContactId,// the requirement says that the engage Id should have createdby user as 'system'.
                        Version        = request.Version
                    };

                    string      DDPatientSystemServiceUrl = ConfigurationManager.AppSettings["DDPatientSystemServiceUrl"];
                    IRestClient client = new JsonServiceClient();
                    //[Route("/{Context}/{Version}/{ContractNumber}/Batch/Engage/PatientSystems", "POST")]
                    string url = Helpers.BuildURL(string.Format("{0}/{1}/{2}/{3}/Batch/Engage/PatientSystems", DDPatientSystemServiceUrl, psRequest.Context, psRequest.Version, psRequest.ContractNumber), psRequest.UserId);
                    InsertBatchEngagePatientSystemsDataResponse dataDomainResponse = client.Post <InsertBatchEngagePatientSystemsDataResponse>(url, psRequest as object);
                    if (dataDomainResponse != null && dataDomainResponse.Result != null)
                    {
                        ids = dataDomainResponse.Result.ProcessedIds;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(ids);
        }
Exemple #27
0
        public void GetPreviousValuesForObservation(ObservationValueData ovd, string patientId, string observationTypeId, IDataDomainRequest request)
        {
            try
            {
                IPatientObservationRepository repo = Factory.GetRepository(request, RepositoryType.PatientObservation);

                PatientObservationData val = (PatientObservationData)repo.FindRecentObservationValue(observationTypeId, patientId);

                if (val != null)
                {
                    ovd.PreviousValue = new PreviousValueData
                    {
                        EndDate   = val.EndDate,
                        Source    = val.Source,
                        StartDate = val.StartDate,
                        Unit      = val.Units,
                        Value     = Util.GetPreviousValues(val.Values)
                    };
                }
            }
            catch (Exception ex)
            {
                throw new Exception("DD.DataPatientObservationManager:GetPreviousValuesForObservation()::" + ex.Message, ex.InnerException);
            }
        }