public string DetermineValue(AspergillosisContext context) { if (NumericAnswer != null) { return(NumericAnswer.ToString()); } else if (DateAnswer != null) { return(DateAnswer.Value.ToString("dd-MM-yyyy")); } else if (TextAnswer != null) { return(TextAnswer); } else if (Options != null) { var optionsIds = Options.Select(o => o.CaseReportFormOptionChoiceId).ToList(); return(context.CaseReportFormOptionChoices .Where(o => optionsIds.Contains(o.ID)) .Select(o => o.Name) .ToList() .Join(",") .ToString()); } return(""); }
public static void SeedDefaultFoods(AspergillosisContext context) { if (context.Foods.Any()) { return; } var foods = new Food[] { new Food { Name = "Milk" }, new Food { Name = "Pork" }, new Food { Name = "Eggs" }, new Food { Name = "Nut" }, new Food { Name = "Chestnut" }, new Food { Name = "Multiple food allergies" } }; foreach (var food in foods) { context.Foods.Add(food); } context.SaveChanges(); }
public EPRDocxPatientSurgeryResolver(string potentialSurgery, Patient patient, AspergillosisContext context) { _potentialSurgery = potentialSurgery; _patient = patient; _context = context; LoadSurgeriesForPatient(); }
public static async Task <Dictionary <string, List <PatientIgViewModel> > > BuildIgChartEntries( AspergillosisContext context, List <IGrouping <int, PatientImmunoglobulin> > immunoglobulines) { int cursor = 0; var chartEntries = GetDictionaryWithKeys(context); foreach (var patientIg in immunoglobulines) { foreach (var entry in patientIg) { var igType = await context.ImmunoglobulinTypes. AsNoTracking(). SingleOrDefaultAsync(m => m.ID == patientIg.Key); var chartEntry = new PatientIgViewModel(); chartEntry.DateTaken = DateHelper.DateTimeToUnixTimestamp(entry.DateTaken); chartEntry.Name = igType.Name; chartEntry.Value = entry.Value.ToString(); chartEntries[igType.Name].Add(chartEntry); } } cursor++; return(chartEntries); }
public SGRQandIgGReportBuilder(AspergillosisContext context, FileStream inputFileStream) { _context = context; _outputWorkbook = new XSSFWorkbook(); _stream = inputFileStream; }
public static void CreateDbImportTypes(AspergillosisContext context) { if (context.DBImportTypes.Any()) { return; } var dbImportTypes = new DbImportType[] { new DbImportType { Name = "Chris Harris - Excel Spreadsheet", ImporterClass = "CHSpreadsheetImporter" }, new DbImportType { Name = "Graham Atherton - QoL CSV file", ImporterClass = "GAQoLCSVImporter" }, new DbImportType { Name = "David Lowes - Excel Spreadsheet", ImporterClass = "DLSpreadsheetImporter" } }; foreach (var dbImportType in dbImportTypes) { context.Add(dbImportType); } context.SaveChanges(); }
public PatientDiagnosisResolver(Patient patient, List <string> potentialDiagnosisNames, AspergillosisContext context) { _patient = patient; _potentialDiagnosisNames = potentialDiagnosisNames; _context = context; _discoveredDiagnoses = new List <PatientDiagnosis>(); }
public PatientSTGQuestionnaireResolver(AspergillosisContext context) { _context = context; _questionnaires = new List <PatientSTGQuestionnaire>(); _fields = new Dictionary <string, string>(); _questionnaire = new PatientSTGQuestionnaire(); }
public static void BuildSection(AspergillosisContext context, CaseReportFormSectionViewModel formSectionVM) { var formSection = new CaseReportFormSection() { Name = formSectionVM.Name }; formSection.CaseReportFormResultFields = new List <CaseReportFormField>(); foreach (var field in formSectionVM.Fields) { formSection.CaseReportFormResultFields.Add(field); context.CaseReportFormFields.Add(field); if (field.SelectedOptionsIds == null) { continue; } foreach (var fieldOptionId in field.SelectedOptionsIds) { var sectionOption = new CaseReportFormFieldOption(); sectionOption.CaseReportFormOptionChoiceId = fieldOptionId; sectionOption.Field = field; context.CaseReportFormFieldOptions.Add(sectionOption); } } context.CaseReportFormSections.Add(formSection); }
private static void BuildSmokingStatuses(AspergillosisContext context) { if (context.SmokingStatuses.Any()) { return; } var sts = new SmokingStatus[] { new SmokingStatus { Name = "Current" }, new SmokingStatus { Name = "Ex-Smoker" }, new SmokingStatus { Name = "Don't know" }, new SmokingStatus { Name = "Never" } }; foreach (var s in sts) { context.Add(s); } }
private static void BuildSurgeries(AspergillosisContext context) { if (context.Surgeries.Any()) { return; } var sgurgeries = new Surgery[] { new Surgery { Name = "Pneumonectomy" }, new Surgery { Name = "Lobectomy" }, new Surgery { Name = "Thoracotomy" }, new Surgery { Name = "Wedge resection" }, new Surgery { Name = "Pleurectomy" }, new Surgery { Name = "Bullectomy" } }; foreach (var s in sgurgeries) { context.Add(s); } }
public static void Seed(AspergillosisContext context) { BuildPulmonaryFunctionTests(context); BuildSurgeries(context); BuildSmokingStatuses(context); context.SaveChanges(); }
public static void SeedOtherUnits(AspergillosisContext context) { var importer = context.UnitOfMeasurements.Where(uom => uom.Name == GL_L).FirstOrDefault(); if (importer == null) { var unit = new UnitOfMeasurement { Name = GL_L }; context.UnitOfMeasurements.Add(unit); context.SaveChanges(); var unit2 = new UnitOfMeasurement { Name = BLOOD }; context.UnitOfMeasurements.Add(unit2); context.SaveChanges(); var unit3 = new UnitOfMeasurement { Name = IGE }; context.UnitOfMeasurements.Add(unit3); context.SaveChanges(); } else { return; } }
public PartialsController(AspergillosisContext context, IConfiguration configuration) { _listResolver = new DropdownListsResolver(context, ViewBag); _caseReportFormListResolver = new CaseReportFormsDropdownResolver(context); _configuration = configuration; _context = context; }
public static void Initialize(AspergillosisContext context) { context.Database.EnsureCreated(); if (context.ReportTypes.Any()) { return; } var reportTypes = new ReportType[] { new ReportType() { Name = "SGRQ Report", Code = "sgrq-report", Discriminator = "SGRQReportType" }, new ReportType() { Name = "Patient Heatmap Report", Code = "heatmap-report", Discriminator = "PatientHeatmapReportType" } }; foreach (ReportType r in reportTypes) { context.ReportTypes.Add(r); } context.SaveChanges(); }
public static async Task <NewPatientVisitViewModel> BuildPatientVisitVM(AspergillosisContext context, int patientId, object visitDate = null) { var patientManager = new PatientManager(context); var patient = await patientManager.FindPatientWithRelationsByIdAsync(patientId); if (patient == null) { return(null); } var patientMeasurements = context.PatientMeasurements .Where(pm => pm.PatientId == patient.ID); var patientVM = new NewPatientVisitViewModel(); if (visitDate != null) { DateTime patientVisitDate = (DateTime)visitDate; patientVM.VisitDate = DateHelper.DateTimeToUnixTimestamp(patientVisitDate).ToString(); } patientVM.PatientId = patient.ID; patientVM.STGQuestionnaires = patient.STGQuestionnaires; patientVM.PatientRadiologyFindings = patient.PatientRadiologyFindings; patientVM.PatientImmunoglobulines = patient.PatientImmunoglobulines; if (patientMeasurements != null) { patientVM.PatientMeasurements = patientMeasurements.ToList(); } return(patientVM); }
public static void AddIgTypes(AspergillosisContext context) { if (context.ImmunoglobulinTypes.Any()) { return; } var iGType = new ImmunoglobulinType[] { new ImmunoglobulinType { Name = "IgA" }, new ImmunoglobulinType { Name = "IgD" }, new ImmunoglobulinType { Name = "IgE" }, new ImmunoglobulinType { Name = "IgG" }, new ImmunoglobulinType { Name = "IgM" } }; foreach (var ig in iGType) { context.Add(ig); } context.SaveChanges(); }
public static void AddSelectFieldTypes(AspergillosisContext context) { var multiSelect = context.CaseReportFormFieldTypes .Where(ft => ft.Name.Contains("Select")); if (multiSelect.Any()) { return; } var caseReportFormFieldTypes = new CaseReportFormFieldType[] { new CaseReportFormFieldType { Name = "Single Select" }, new CaseReportFormFieldType { Name = "Multi Select" }, new CaseReportFormFieldType { Name = "Check-box" }, new CaseReportFormFieldType { Name = "Radio-button" } }; foreach (var item in caseReportFormFieldTypes) { context.Add(item); } context.SaveChanges(); }
public static void AddDefaultPatientStatuses(AspergillosisContext context) { if (context.PatientStatuses.Any()) { return; } var statuses = new PatientStatus[] { new PatientStatus { Name = "Active" }, new PatientStatus { Name = "Discharged" }, new PatientStatus { Name = "Inactive" }, new PatientStatus { Name = "Deceased" }, }; foreach (var status in statuses) { context.Add(status); } context.SaveChanges(); }
private static void AddCaseResultFormDefaultSections(AspergillosisContext context) { var caseReportFormSections = new CaseReportFormSection[] { new CaseReportFormSection { Name = "Aspergillus Fumigatus Percip" }, new CaseReportFormSection { Name = "Beta Glucan" }, new CaseReportFormSection { Name = "Aspergillus Galactomannan ag" }, new CaseReportFormSection { Name = "Cryptococcal Antigen" }, new CaseReportFormSection { Name = "Expected Resistance Profile" } }; foreach (var item in caseReportFormSections) { context.CaseReportFormSections.Add(item); } }
public void SetDistanceFromWythenshawe(AspergillosisContext context, ILogger logger) { var patientPosition = PatientPosition(context); var distanceCalculator = new GraphhopperApi(new RestClient(GraphhopperApi.ENDPOINT), logger); var distance = distanceCalculator.RequestDistance(patientPosition); DistanceFromWythenshawe = (double)distance; }
public CaseReportFormExcelExporter(AspergillosisContext context, ISheet currentSheet, XSSFWorkbook workbook) { _context = context; _currentSheet = currentSheet; _outputWorkbook = workbook; }
public ClinicLetterPdfFileImporter(FileStream stream, string fullPath, AspergillosisContext context) { _stream = stream; _fullPath = fullPath; _context = context; }
private static void LoadRelatedDrugLevels(AspergillosisContext context, Patient patient) { context.Entry(patient).Collection(c => c.DrugLevels).Load(); foreach (var patientDrugLevel in patient.DrugLevels) { context.Entry(patientDrugLevel).Reference <Drug>(t => t.Drug).Load(); context.Entry(patientDrugLevel).Reference <UnitOfMeasurement>(t => t.UnitOfMeasurement).Load(); } }
public PatientDrugLevelResolver(AspergillosisContext context, Drug drug, UnitOfMeasurement uom) { _context = context; PatientDrugLevel = new PatientDrugLevel() { Drug = drug, UnitOfMeasurement = uom }; }
public PatientsController(AspergillosisContext context, ExternalImportDbContext externalImport) { _patientManager = new PatientManager(context, Request); _context = context; _listResolver = new DropdownListsResolver(context, ViewBag); _caseReportFormListResolver = new CaseReportFormsDropdownResolver(context); _caseReportFormManager = new CaseReportFormManager(context); _externalImport = externalImport; }
public CPAMortalityAuditReportBuilder(AspergillosisContext context, ILogger logger, FileStream inputFileStream) { _context = context; _outputWorkbook = new XSSFWorkbook(); _logger = logger; _stream = inputFileStream; }
public BatchClinicLettersImporter(ICollection <IFileInfo> filesToImport, AspergillosisContext context, PASDbContext pasContext) { _filesToImport = filesToImport; _imported = 0; _context = context; _pasContext = pasContext; }
public EPRClinicLetterDocxImporter(FileStream stream, string fileExtension, AspergillosisContext context, PASDbContext pasContext) { _stream = stream; _fileExtension = fileExtension; _pasContext = pasContext; _context = context; _patientManager = new PatientManager(context); }
public SmokingStatusResolver(AspergillosisContext context, string smokingStatus, IRow row, List <string> headers) { _context = context; _smokingStatus = smokingStatus; _row = row; _headers = headers; _smokingDrinkingStatus = new PatientSmokingDrinkingStatus(); }