private async Task CustomMapAsync(PatientClinicalEvent patientClinicalEventFromRepo, PatientClinicalEventExpandedDto dto)
        {
            IExtendable patientClinicalEventExtended = patientClinicalEventFromRepo;

            // Map all custom attributes
            dto.ClinicalEventAttributes = _modelExtensionBuilder.BuildModelExtension(patientClinicalEventExtended)
                                          .Select(h => new AttributeValueDto()
            {
                Id             = h.Id,
                Key            = h.AttributeKey,
                Value          = h.TransformValueToString(),
                Category       = h.Category,
                SelectionValue = GetSelectionValue(h.Type, h.AttributeKey, h.Value.ToString())
            }).Where(s => (s.Value != "0" && !String.IsNullOrWhiteSpace(s.Value)) || !String.IsNullOrWhiteSpace(s.SelectionValue)).ToList();

            dto.ReportDate = await _customAttributeService.GetCustomAttributeValueAsync("PatientClinicalEvent", "Date of Report", patientClinicalEventExtended);

            dto.IsSerious = await _customAttributeService.GetCustomAttributeValueAsync("PatientClinicalEvent", "Is the adverse event serious?", patientClinicalEventExtended);

            var activity = await _reportInstanceQueries.GetExecutionStatusEventsForEventViewAsync(patientClinicalEventFromRepo.Id);

            dto.Activity = activity.ToList();

            var reportInstanceFromRepo = await _reportInstanceRepository.GetAsync(ri => ri.ContextGuid == patientClinicalEventFromRepo.PatientClinicalEventGuid, new string[] { "TerminologyMedDra", "Medications", "Tasks.Comments" });

            if (reportInstanceFromRepo == null)
            {
                return;
            }

            dto.SetMedDraTerm     = reportInstanceFromRepo.TerminologyMedDra?.DisplayName;
            dto.SetClassification = ReportClassification.From(reportInstanceFromRepo.ReportClassificationId).Name;
            dto.Medications       = _mapper.Map <ICollection <ReportInstanceMedicationDetailDto> >(reportInstanceFromRepo.Medications.Where(m => !String.IsNullOrWhiteSpace(m.WhoCausality) || (!String.IsNullOrWhiteSpace(m.NaranjoCausality))));
            dto.Tasks             = _mapper.Map <ICollection <TaskDto> >(reportInstanceFromRepo.Tasks.Where(t => t.TaskStatusId != Core.Aggregates.ReportInstanceAggregate.TaskStatus.Cancelled.Id));
        }
Exemplo n.º 2
0
        private async Task <bool> CheckIfSeriousAsync(PatientClinicalEvent patientClinicalEvent)
        {
            var extendable      = (IExtendable)patientClinicalEvent;
            var extendableValue = await _attributeService.GetCustomAttributeValueAsync("PatientClinicalEvent", "Is the adverse event serious?", extendable);

            return(extendableValue == "Yes");
        }
        private async Task CustomMapAsync(PatientClinicalEvent patientClinicalEventFromRepo, PatientClinicalEventDetailDto dto)
        {
            IExtendable patientClinicalEventExtended = patientClinicalEventFromRepo;

            // Map all custom attributes
            dto.ClinicalEventAttributes = _modelExtensionBuilder.BuildModelExtension(patientClinicalEventExtended)
                                          .Select(h => new AttributeValueDto()
            {
                Id             = h.Id,
                Key            = h.AttributeKey,
                Value          = h.TransformValueToString(),
                Category       = h.Category,
                SelectionValue = GetSelectionValue(h.Type, h.AttributeKey, h.Value.ToString())
            }).Where(s => (s.Value != "0" && !String.IsNullOrWhiteSpace(s.Value)) || !String.IsNullOrWhiteSpace(s.SelectionValue)).ToList();

            dto.ReportDate = await _customAttributeService.GetCustomAttributeValueAsync("PatientClinicalEvent", "Date of Report", patientClinicalEventExtended);

            dto.IsSerious = await _customAttributeService.GetCustomAttributeValueAsync("PatientClinicalEvent", "Is the adverse event serious?", patientClinicalEventExtended);
        }
        private async Task CustomMapAsync(PatientMedication patientMedicationFromRepo, PatientMedicationDetailDto dto)
        {
            IExtendable patientMedicationExtended = patientMedicationFromRepo;

            // Map all custom attributes
            dto.MedicationAttributes = _modelExtensionBuilder.BuildModelExtension(patientMedicationExtended)
                                       .Select(h => new AttributeValueDto()
            {
                Id             = h.Id,
                Key            = h.AttributeKey,
                Value          = h.TransformValueToString(),
                Category       = h.Category,
                SelectionValue = GetSelectionValue(h.Type, h.AttributeKey, h.Value.ToString())
            }).Where(s => (s.Value != "0" && !String.IsNullOrWhiteSpace(s.Value)) || !String.IsNullOrWhiteSpace(s.SelectionValue)).ToList();

            dto.IndicationType = await _customAttributeService.GetCustomAttributeValueAsync("PatientMedication", "Type of Indication", patientMedicationExtended);

            dto.ReasonForStopping = await _customAttributeService.GetCustomAttributeValueAsync("PatientMedication", "Reason For Stopping", patientMedicationExtended);

            dto.ClinicianAction = await _customAttributeService.GetCustomAttributeValueAsync("PatientMedication", "Clinician action taken with regard to medicine if related to AE", patientMedicationExtended);

            dto.ChallengeEffect = await _customAttributeService.GetCustomAttributeValueAsync("PatientMedication", "Effect OF Dechallenge (D) & Rechallenge (R)", patientMedicationExtended);
        }
Exemplo n.º 5
0
        private async Task <List <MailboxAddress> > PrepareDestinationMailBoxesAsync(TaskCancelledDomainEvent domainEvent)
        {
            var patientClinicalEvent = await _patientClinicalEventRepository.GetAsync(pce => pce.PatientClinicalEventGuid == domainEvent.Task.ReportInstance.ContextGuid,
                                                                                      new string[] { });

            if (patientClinicalEvent == null)
            {
                throw new KeyNotFoundException(nameof(patientClinicalEvent));
            }

            var extendable   = (IExtendable)patientClinicalEvent;
            var reporterName = await _attributeService.GetCustomAttributeValueAsync("PatientClinicalEvent", "Name of reporter", extendable);

            var reporterEmail = await _attributeService.GetCustomAttributeValueAsync("PatientClinicalEvent", "Email address", extendable);

            var destinationAddresses = new List <MailboxAddress>();

            destinationAddresses.Add(new MailboxAddress(domainEvent.Task.ReportInstance.CreatedBy.FullName, domainEvent.Task.ReportInstance.CreatedBy.Email));
            if (!String.IsNullOrEmpty(reporterName) && !String.IsNullOrEmpty(reporterEmail))
            {
                destinationAddresses.Add(new MailboxAddress(reporterName, reporterEmail));
            }
            return(destinationAddresses);
        }
Exemplo n.º 6
0
        private async Task CustomClinicalEventMapAsync(PatientClinicalEventDetailDto dto)
        {
            var clinicalEvent = await _patientClinicalEventRepository.GetAsync(p => p.Id == dto.Id);

            if (clinicalEvent == null)
            {
                return;
            }

            IExtendable clinicalEventExtended = clinicalEvent;

            dto.ReportDate = await _customAttributeService.GetCustomAttributeValueAsync("PatientClinicalEvent", "Date of Report", clinicalEventExtended);

            dto.IsSerious = await _customAttributeService.GetCustomAttributeValueAsync("PatientClinicalEvent", "Is the adverse event serious?", clinicalEventExtended);
        }