Skip to content

Commit 0563b38

Browse files
LNK-3255: POI Functionality (#1055)
* LNK-3917: Update FhirList Model and APIs * Update EHRPatientList to reflect new model * Add Presentation model classes for updated entities and better validation * Add ModelState validation to POST and PUT for FhirList * Merge branch 'dev' into feature/LNK-3255-Generate-patients-of-interest-POI-lists-framework-FHIR-list * LNK-3918: Consumer Workflow Update DA * Update DA to handle new configurations for PatientList * Reorganize Domain project models * Run SmokeTest and debug issues * Update Topics.txt for PatientListsAcquired * Debugging changes * Leverage ListType instead of PatientStatus * Additional Updates * Add indented json serializer * Add Patient List bundle for SmokeTest so that STU3 list is available. * LNK-3957: Update Report to consume new msg structure *Convert PatientIdsAcquired to PatientListItem (model) or PatientListsAcquired *Move ListType and TimeFrame enum to Shared *Add extra loop to iterate over PatientIds string list * LNK-3957: Testing fixes, SmokeTest updates * Fix deserialization issue * Add config and fhir data load only functionality * LNK-3257: Add POI tables *Remove old census tracking tables *add new POI tables *create migration *tested migration * LNK-3261: Working commit * Fix Migrations, Get builds working * LNK-3261: Insert Patients into PatientEvents * LNK-3261: share correlation ids * LNK-3262: Add/Update Materilized View * add records to PatientEncounters and PatientIdentifiers for materialized view. * Add new service for message generation * Add services for table CRUD ops * DI cleanup * Fix build errors * Remove Census controller code for future updates * cleanup unused dependencies * LNK-3262: create patient event/encounters, generate messages * LNK-3262: Add header check * add header check on PatientLIstsAcquiredListener when consuming to ensure if X-Exception-Service is present that it matches the name for the Census Service. * LNK-3265: Add PatientEvent and PatientEncounter API Endpoints * Bug fixes * Add unit and integration tests * Potential fix for code scanning alert no. 193: Log entries created from user input Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Potential fix for code scanning alert no. 190: Log entries created from user input Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * sanitize variables * Update PatientEncounterQueries.cs * CodeRabbit review * Update PatientListService.cs * Update PatientDataService.cs * Update EpicAuth.cs * Adding back CensusController.GetAdmittedPatients() * report relies on CensusController.GetAdmittedPatients() during adhoc report generation when the end-user does not pass a census. * Update GenerateReportListener.cs *add check for EnableAnonymous when retrieving a patient list. * incremental commit due to context switch * incremental commit * Integration Testing * add polymorphic serdes to IPayload functionality * Add 15 integration tests * various bug fixes * Add Large Scale Integration Test 1. Add larger test with: * 5 facilities * 65 patients * dynamic acceptance limits based on test 2. Introduced Transactions into workflow to better protect against bad data. 3. Various bug fixes * Fix facility id consistency in tests * Delete global.json * Add enable Flag Add enable flag to CensusConfig and update jobs accordingly based on that status. * Remove test files * Add'l Unit Tests, UI Enhancement, Docs * rewrite rebuild from findings in unit test * unit test for rebuild that produces 9500 events and 5500 encounters * add UI functionality for new enabled flag * other bug fixes * documentation update * add line to populate existing records with flag * Fix migration * Paging and more integration tests * Integration Tests - Additional integration tests - code changes based on integration test outcomes - optimized SeedDate to create 5k record in >3 seconds * Fix unit tests * Move models out of API namespace * Merge latest from Dev and fix issues --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 66d8064 commit 0563b38

179 files changed

Lines changed: 11192 additions & 2277 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ KAFKA_INTER_BROKER_USER=controller_user
77
KAFKA_INTER_BROKER_PASSWORD=controller_password
88
AZURITE_CONNECTION_STRING=DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1
99
INTERNAL_BLOB_CONTAINER_NAME=internal
10-
EXTERNAL_BLOB_CONTAINER_NAME=external
10+
EXTERNAL_BLOB_CONTAINER_NAME=external

DotNet/Admin.BFF/Application/Commands/Integration/CreatePatientAcquired/CreatePatientAcquired.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public async Task<string> Execute(PatientAcquired model, string? userId = null,
5656
Headers = headers
5757
};
5858

59-
await _producer.ProduceAsync(nameof(KafkaTopic.PatientIDsAcquired), message);
59+
await _producer.ProduceAsync(nameof(KafkaTopic.PatientListsAcquired), message);
6060

6161
return correlationId;
6262

@@ -65,7 +65,7 @@ public async Task<string> Execute(PatientAcquired model, string? userId = null,
6565
{
6666
Activity.Current?.SetStatus(ActivityStatusCode.Error);
6767
Activity.Current?.RecordException(ex);
68-
_logger.LogKafkaProducerException(nameof(KafkaTopic.PatientIDsAcquired), ex.Message);
68+
_logger.LogKafkaProducerException(nameof(KafkaTopic.PatientListsAcquired), ex.Message);
6969
throw;
7070
}
7171

DotNet/Admin.BFF/Application/Commands/Integration/KafkaConsumerManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public class KafkaConsumerManager
3030
{
3131
("Dynamic", KafkaTopic.ReportScheduled.ToString()),
3232
("Dynamic", KafkaTopic.ReportScheduled.ToString() + errorTopic),
33-
("Dynamic", KafkaTopic.PatientIDsAcquired.ToString()),
34-
("Dynamic", KafkaTopic.PatientIDsAcquired.ToString() + errorTopic),
33+
("Dynamic", KafkaTopic.PatientListsAcquired.ToString()),
34+
("Dynamic", KafkaTopic.PatientListsAcquired.ToString() + errorTopic),
3535
("Dynamic", KafkaTopic.PatientEvent.ToString()),
3636
("Dynamic", KafkaTopic.PatientEvent.ToString() + errorTopic),
3737
("Dynamic", KafkaTopic.DataAcquisitionRequested.ToString()),
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
using LantanaGroup.Link.Census.Application.Models.Enums;
2+
using LantanaGroup.Link.Census.Domain.Entities.POI;
3+
4+
namespace LantanaGroup.Link.Census.Application.Factories;
5+
6+
public class PatientEncounterBuilder
7+
{
8+
private PatientEncounter _patientEncounter = new PatientEncounter();
9+
10+
public PatientEncounterBuilder(string facilityId, string MRN, DateTime admitDate, DateTime? dischargeDate, string correlationId)
11+
{
12+
_patientEncounter.FacilityId = facilityId;
13+
_patientEncounter.MedicalRecordNumber = MRN;
14+
_patientEncounter.AdmitDate = admitDate;
15+
16+
if (dischargeDate != null)
17+
{
18+
_patientEncounter.DischargeDate = dischargeDate;
19+
}
20+
21+
_patientEncounter.CorrelationId = correlationId;
22+
_patientEncounter.CreateDate = DateTime.Now;
23+
}
24+
25+
public PatientEncounterBuilder AddVisitIdentifier(string visitId, SourceType sourceType)
26+
{
27+
PatientVisitIdentifier identifier = new PatientVisitIdentifier() { Identifier = visitId, SourceType = sourceType.ToString(), PatientEncounterId = _patientEncounter.Id };
28+
29+
if (_patientEncounter.PatientVisitIdentifiers == null)
30+
{
31+
_patientEncounter.PatientVisitIdentifiers = new List<PatientVisitIdentifier>();
32+
}
33+
34+
_patientEncounter.PatientVisitIdentifiers.Add(identifier);
35+
36+
return this;
37+
}
38+
39+
public PatientEncounterBuilder AddPatientIdentifier(string patientId, SourceType sourceType)
40+
{
41+
PatientIdentifier identifier = new PatientIdentifier() { Identifier = patientId, SourceType = sourceType.ToString() };
42+
43+
if (_patientEncounter.PatientIdentifiers == null)
44+
{
45+
_patientEncounter.PatientIdentifiers = new List<PatientIdentifier>();
46+
}
47+
48+
_patientEncounter.PatientIdentifiers.Add(identifier);
49+
50+
return this;
51+
}
52+
53+
public PatientEncounter GetPatientEncounter()
54+
{
55+
return _patientEncounter;
56+
}
57+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using LantanaGroup.Link.Census.Application.Interfaces;
2+
using LantanaGroup.Link.Census.Application.Models.Enums;
3+
using LantanaGroup.Link.Census.Domain.Entities.POI;
4+
5+
namespace LantanaGroup.Link.Census.Application.Factories;
6+
7+
public static class PatientEventFactory
8+
{
9+
public static PatientEvent Create(string correlationId, string patientId, string visitId, string MRN, EventType eventType, IPayload payload, SourceType sourceType, string facilityId)
10+
{
11+
return new PatientEvent()
12+
{
13+
CorrelationId = correlationId,
14+
SourcePatientId = patientId,
15+
SourceVisitId = visitId,
16+
MedicalRecordNumber = MRN,
17+
EventType = eventType,
18+
Payload = payload,
19+
SourceType = sourceType,
20+
CreateDate = DateTime.Now,
21+
FacilityId = facilityId
22+
};
23+
}
24+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using LantanaGroup.Link.Census.Domain.Entities.POI;
2+
3+
namespace LantanaGroup.Link.Census.Application.Interfaces;
4+
5+
public interface IPayload
6+
{
7+
string PayloadType { get; }
8+
PatientEvent CreatePatientEvent(string facilityId, string correlationId);
9+
PatientEncounter CreatePatientEncounter(string facilityId, string correlationId);
10+
PatientEncounter UpdatePatientEncounter(PatientEncounter patientEncounter);
11+
}
Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,34 @@
11
using Microsoft.AspNetCore.Mvc.ModelBinding;
22
using System.ComponentModel.DataAnnotations;
3+
using Census.Domain.Entities;
34

4-
namespace LantanaGroup.Link.Census.Application.Models
5+
namespace LantanaGroup.Link.Census.Application.Models;
6+
7+
[BindRequired]
8+
public class CensusConfigModel
59
{
6-
[BindRequired]
7-
public class CensusConfigModel
10+
[Required] public string FacilityId { get; set; }
11+
[Required] public string ScheduledTrigger { get; set; }
12+
13+
public bool? Enabled { get; set; } = true;
14+
15+
public CensusConfigEntity ToDomain()
16+
{
17+
return new CensusConfigEntity
18+
{
19+
FacilityID = this.FacilityId,
20+
ScheduledTrigger = this.ScheduledTrigger,
21+
Enabled = this.Enabled ?? true
22+
};
23+
}
24+
25+
public static CensusConfigModel FromDomain(CensusConfigEntity config)
826
{
9-
[Required]
10-
public string FacilityId { get; set; }
11-
[Required]
12-
public string ScheduledTrigger { get; set; }
27+
return new CensusConfigModel
28+
{
29+
FacilityId = config.FacilityID,
30+
ScheduledTrigger = config.ScheduledTrigger,
31+
Enabled = config.Enabled
32+
};
1333
}
14-
}
34+
}

DotNet/Census/Application/Models/ConsumePatientIdsAcquiredEventModel.cs

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace LantanaGroup.Link.Census.Application.Models.Enums;
2+
3+
public enum EventType
4+
{
5+
A01,
6+
A03,
7+
EncounterFound,
8+
FHIRListAdmit,
9+
FHIRListDischarge
10+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace LantanaGroup.Link.Census.Application.Models.Enums;
2+
3+
public enum SourceType
4+
{
5+
FHIR,
6+
ADT,
7+
SFTP
8+
}

0 commit comments

Comments
 (0)