Skip to content

Commit 7b7ff37

Browse files
LNK-4540: remove patientIdsAcquired refs (#1285)
* LNK-4540: remove patientIdsAcquired refs * Update index.mdx
1 parent 80edcd1 commit 7b7ff37

10 files changed

Lines changed: 103 additions & 74 deletions

File tree

DotNet/Census/Application/Settings/CensusConstants.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ public static class HeaderNames
2121
public const string CorrelationId = "X-Correlation-Id";
2222
}
2323

24-
public static class MessageNames
25-
{
26-
public const string PatientIDsAcquired = "PatientIDsAcquired";
27-
public const string PatientIDsAcquiredError = "PatientIDsAcquired-Error";
28-
}
29-
3024
public static class CensusLoggingIds
3125
{
3226
public const int GenerateItems = 1000;

DotNet/DataAcquisition.Domain/Application/Serializers/PatientIDsAcquiredDataSerializer.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

DotNet/Report/Listeners/PatientListsAcquiredListener.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ private async void StartConsumerLoop(CancellationToken cancellationToken)
6969
{
7070
consumer.Subscribe(nameof(KafkaTopic.PatientListsAcquired));
7171

72-
_logger.LogInformation("Started PatientIdsAcquired consumer for topic '{Topic}' at {StartTime}", nameof(KafkaTopic.PatientListsAcquired), DateTime.UtcNow);
72+
_logger.LogInformation("Started PatientListsAcquired consumer for topic '{Topic}' at {StartTime}", nameof(KafkaTopic.PatientListsAcquired), DateTime.UtcNow);
7373

7474
while (!cancellationToken.IsCancellationRequested)
7575
{
@@ -155,7 +155,7 @@ await _submissionEntryManager.AddAsync(new MeasureReportSubmissionEntryModel()
155155
}
156156
catch (Exception ex)
157157
{
158-
_deadLetterExceptionHandler.HandleException(result, new DeadLetterException("Report - PatientIdsAcquired Exception thrown: " + ex.Message), facilityId);
158+
_deadLetterExceptionHandler.HandleException(result, new DeadLetterException("Report - PatientListsAcquired Exception thrown: " + ex.Message), facilityId);
159159
}
160160
finally
161161
{
@@ -183,7 +183,7 @@ await _submissionEntryManager.AddAsync(new MeasureReportSubmissionEntryModel()
183183
}
184184
catch (Exception ex)
185185
{
186-
_logger.LogError(ex, "Error encountered in PatientIdsAcquiredListener");
186+
_logger.LogError(ex, "Error encountered in PatientListsAcquiredListener");
187187
consumer.Commit();
188188
}
189189
}

DotNet/Report/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ static void RegisterServices(WebApplicationBuilder builder)
283283

284284
builder.Services.AddTransient<IDeadLetterExceptionHandler<string, string>, DeadLetterExceptionHandler<string, string>>();
285285

286-
//PatientIdsAcquired Listener
286+
//PatientListsAcquired Listener
287287
builder.Services.AddTransient<ITransientExceptionHandler<string, PatientListMessage>, TransientExceptionHandler<string, PatientListMessage>>();
288288
builder.Services.AddTransient<IDeadLetterExceptionHandler<string, PatientListMessage>, DeadLetterExceptionHandler<string, PatientListMessage>>();
289289

docs/docs/dev/testing.mdx

Lines changed: 87 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Automated report scheduling can be configured through the Tenant API. However, a
104104

105105
Because the report generation process runs immediately after the set `EndDate`, allocate enough time (a few minutes) to perform the subsequent steps.
106106

107-
To manually admit patients, produce the following into the `PatientIDsAcquired` topic in Kafka UI:
107+
To manually admit patients, produce the following into the `PatientListsAcquired` topic in Kafka UI:
108108
> [!NOTE]
109109
> The patients included in the event below are examples only. Add patient identifiers that exist in your EHR endpoint.
110110
@@ -116,29 +116,50 @@ Test-Hospital
116116
**Value:**
117117
```
118118
{
119-
"PatientIds": {
120-
"resourceType": "List",
121-
"entry": [
122-
{
123-
"item": {
124-
"reference": "Patient/hJOGSZyFOTIiwEBWUU6p9NKxflMTOLCRRpLbAkfPrfqee"
125-
}
126-
},
127-
{
128-
"item": {
129-
"reference": "Patient/0VmZaB90pc5yRSefoK6sW9C9WVOvPARAgquBFNtGr6LXk"
130-
}
131-
},
132-
{
133-
"item": {
134-
"reference": "Patient/9mDh8TdqYuZP4JZkjbyDkw1SRwOG6TOhCY8GfClh5QG2m"
135-
}
136-
}]
137-
}
119+
"ReportTrackingId": null,
120+
"PatientLists": [
121+
{
122+
"ListType": "Discharge",
123+
"TimeFrame": "Between24To48Hours",
124+
"PatientIds": []
125+
},
126+
{
127+
"ListType": "Admit",
128+
"TimeFrame": "LessThan24Hours",
129+
"PatientIds": [
130+
"hJOGSZyFOTIiwEBWUU6p9NKxflMTOLCRRpLbAkfPrfqee",
131+
"0VmZaB90pc5yRSefoK6sW9C9WVOvPARAgquBFNtGr6LXk"
132+
]
133+
},
134+
{
135+
"ListType": "Discharge",
136+
"TimeFrame": "MoreThan48Hours",
137+
"PatientIds": []
138+
},
139+
{
140+
"ListType": "Admit",
141+
"TimeFrame": "Between24To48Hours",
142+
"PatientIds": [
143+
"9mDh8TdqYuZP4JZkjbyDkw1SRwOG6TOhCY8GfClh5QG2m"
144+
]
145+
},
146+
{
147+
"ListType": "Admit",
148+
"TimeFrame": "MoreThan48Hours",
149+
"PatientIds": [
150+
]
151+
},
152+
{
153+
"ListType": "Discharge",
154+
"TimeFrame": "LessThan24Hours",
155+
"PatientIds": [
156+
]
157+
}
158+
]
138159
}
139160
```
140161

141-
To discharge a patient and begin their reporting workflow, produce the same `PatientIDsAcquired` event without the discharged patient in the list. The example below will discharge `Patient/0VmZaB90pc5yRSefoK6sW9C9WVOvPARAgquBFNtGr6LXk`:
162+
To discharge a patient and begin their reporting workflow, produce the same `PatientListsAcquired` event without the discharged patient in the list. The example below will discharge `Patient/0VmZaB90pc5yRSefoK6sW9C9WVOvPARAgquBFNtGr6LXk`:
142163

143164
**Key:**
144165
```
@@ -148,20 +169,46 @@ Test-Hospital
148169
**Value:**
149170
```
150171
{
151-
"PatientIds": {
152-
"resourceType": "List",
153-
"entry": [
154-
{
155-
"item": {
156-
"reference": "Patient/hJOGSZyFOTIiwEBWUU6p9NKxflMTOLCRRpLbAkfPrfqee"
157-
}
158-
},
159-
{
160-
"item": {
161-
"reference": "Patient/9mDh8TdqYuZP4JZkjbyDkw1SRwOG6TOhCY8GfClh5QG2m"
162-
}
163-
}]
164-
}
172+
"ReportTrackingId": null,
173+
"PatientLists": [
174+
{
175+
"ListType": "Discharge",
176+
"TimeFrame": "Between24To48Hours",
177+
"PatientIds": []
178+
},
179+
{
180+
"ListType": "Admit",
181+
"TimeFrame": "LessThan24Hours",
182+
"PatientIds": [
183+
"hJOGSZyFOTIiwEBWUU6p9NKxflMTOLCRRpLbAkfPrfqee"
184+
]
185+
},
186+
{
187+
"ListType": "Discharge",
188+
"TimeFrame": "MoreThan48Hours",
189+
"PatientIds": []
190+
},
191+
{
192+
"ListType": "Admit",
193+
"TimeFrame": "Between24To48Hours",
194+
"PatientIds": [
195+
"9mDh8TdqYuZP4JZkjbyDkw1SRwOG6TOhCY8GfClh5QG2m"
196+
]
197+
},
198+
{
199+
"ListType": "Admit",
200+
"TimeFrame": "MoreThan48Hours",
201+
"PatientIds": [
202+
]
203+
},
204+
{
205+
"ListType": "Discharge",
206+
"TimeFrame": "LessThan24Hours",
207+
"PatientIds": [
208+
"0VmZaB90pc5yRSefoK6sW9C9WVOvPARAgquBFNtGr6LXk"
209+
]
210+
}
211+
]
165212
}
166213
```
167214

@@ -207,8 +254,8 @@ sequenceDiagram
207254
Census->>Kafka: Produce - CensusAcquisitionScheduled()
208255
Kafka->>Acquisition: Consume - CensusAcquisitionScheduled()
209256
Acquisition->>EHR: Query STU3 Patient List()
210-
Acquisition-->>Kafka: Produce - PatientIDsAcquired()
211-
Kafka->>Census: Consume - PatientIDsAcquired()
257+
Acquisition-->>Kafka: Produce - PatientListsAcquired()
258+
Kafka->>Census: Consume - PatientListsAcquired()
212259
Census->>Census: Persist and admit patient ID’s from the consumed list()
213260
Census->>Census: Discharge patients who were admitted and are no longer on the consumed list()
214261
Census-->>Kafka: Produce - PatientEvent(discharge)
@@ -218,11 +265,11 @@ sequenceDiagram
218265
Acquisition->>Acquisition: Schedules a lag time before querying for patient resources()
219266
```
220267

221-
During the reporting period, the Census service is configured to continually request a new list of patients admitted in a facility by producing the `CensusAcquisitionScheduled` event. The Data Acquisition service consumed this event and queries the facility's List endpoint. After receiving a response back from the EHR endpoints, the Data Acquisition service then produces a `PatientIDsAcquired` event that contains a list of all patients that are currently admitted in the facility.
268+
During the reporting period, the Census service is configured to continually request a new list of patients admitted in a facility by producing the `CensusAcquisitionScheduled` event. The Data Acquisition service consumed this event and queries the facility's List endpoint. After receiving a response back from the EHR endpoints, the Data Acquisition service then produces a `PatientListsAcquired` event that contains a list of all patients that are currently admitted in the facility.
222269

223-
The Census service consumes the `PatientIDsAcquired` event and applies updates in the database for patients have been admitted or discharged.
270+
The Census service consumes the `PatientListsAcquired` event and applies updates in the database for patients have been admitted or discharged.
224271

225-
> Note: The Census service treats any patient in the PatientIDsAcquired list as an admitted patient. If the Census service has a patient marked as admitted in the database, but the patient is no longer present on the consumed list, it treats the patient as a discharge.
272+
> Note: The Census service treats any patient in the PatientListsAcquired list as an admitted patient. If the Census service has a patient marked as admitted in the database, but the patient is no longer present on the consumed list, it treats the patient as a discharge.
226273
227274
A `PatientEvent` Kafka message is produced for each patient that has been discharged.
228275

docs/domains/DataAccess/services/DataAcquisitionService/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ receives:
1414
- id: PatientCensusScheduled
1515

1616
sends:
17-
- id: PatientIDsAcquired
17+
- id: PatientListsAcquired
1818
- id: ReadyToAcquire
1919

2020
specifications:

docs/domains/Report/index.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,21 @@ TODO
5252
stateDiagram-v2
5353
state "Report Scheduled" as ReportScheduled
5454
state "Data Acquisition Requested" as DataAcquisitionRequested
55-
state "Patient IDs Acquired" as PatientIDsAcquired
55+
state "Patient Lists Acquired" as PatientListsAcquired
5656
state "Resource Evaluated" as ResourceEvaluated
5757
state "Validation Complete" as ValidationComplete
5858
state "Report Submitted" as ReportSubmitted
5959
state "Report Generation Failed" as ReportGenerationFailed
6060
state "Submission Failed" as SubmissionFailed
6161
6262
ReportScheduled --> DataAcquisitionRequested : GenerateReportValue
63-
DataAcquisitionRequested --> PatientIDsAcquired : PatientIdsAcquiredValue
64-
PatientIDsAcquired --> ResourceEvaluated : ResourceEvaluatedValue (for each patient)
63+
DataAcquisitionRequested --> PatientListsAcquired : PatientListsAcquiredValue
64+
PatientListsAcquired --> ResourceEvaluated : ResourceEvaluatedValue (for each patient)
6565
ResourceEvaluated --> ValidationComplete : ReadyForValidationValue
6666
ValidationComplete --> ReportSubmitted : ReportSubmittedValue
6767
6868
DataAcquisitionRequested --> ReportGenerationFailed : Error
69-
PatientIDsAcquired --> RelsportGenerationFailed : Error
69+
PatientListsAcquired --> ReportGenerationFailed : Error
7070
ResourceEvaluated --> ReportGenerationFailed : Error
7171
ValidationComplete --> ReportGenerationFailed : Error
7272
ReportSubmitted --> SubmissionFailed : Error

docs/domains/Report/services/ReportService/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ receives:
1414
- id: ReportScheduled
1515
- id: ValidationComplete
1616
- id: GenerateReportRequested
17-
- id: PatientIDsAcquired
17+
- id: PatientListsAcquired
1818
- id: ReportSubmitted
1919
- id: ResourceEvaluated
2020
- id: MeasureEvaluated

docs/domains/Tenant/services/CensusService/index.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ The system routinely gathers census data by leveraging multiple methods compatib
4545

4646
## Event Sourcing Workflow
4747

48-
The Census service consumes `PatientIDsAcquired` events from Kafka. When a new event is received, the `PatientListsAcquiredListener` processes the payload, updating census records for the specified facility. This enables downstream reporting and data acquisition.
48+
The Census service consumes `PatientListsAcquired` events from Kafka. When a new event is received, the `PatientListsAcquiredListener` processes the payload, updating census records for the specified facility. This enables downstream reporting and data acquisition.
4949

5050
**Workflow Steps:**
5151
1. **Scheduling:** A scheduled job (per tenant configuration) triggers a request for updated patient lists.
5252
2. **Data Acquisition:** The system sends a `DataAcquisitionRequested` event, prompting the acquisition of FHIR patient lists.
53-
3. **Event Production:** Upon successful acquisition, a `PatientIDsAcquired` event is produced, containing the list of patient FHIR IDs.
53+
3. **Event Production:** Upon successful acquisition, a `PatientListsAcquired` event is produced, containing the list of patient FHIR IDs.
5454
4. **Census Update:** The Census service consumes the event and updates its records accordingly.
5555

5656
## Event Payload Structures
@@ -536,6 +536,10 @@ The **FHIR List Resource** method is one of the primary approaches for acquiring
536536
- **Functionality**: Queries the EHR for patient lists identified by a `listId`.
537537
- **Tenant Configurability**: The `listId` is configurable per tenant within Link, allowing each institution to define the patient population that constitutes their census.
538538
- **Applicability**: This method supports census management for any EHR that utilizes FHIR Lists representing relevant patient groups.
539+
- **Rules**: The following rules are enforced by Census when processing FHIR List resources:
540+
- Admission lists are processed before discharge lists.
541+
- If a patient appears on a discharge lists with no corresponding admit event, an admission event is created and then the patient is discharged.
542+
- If a patient is admitted and then disappears off of all incoming lists, the patient is discharged.
539543

540544
#### 2. FHIR Standard - Bulk FHIR Implementation Guide
541545

topics.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ PatientCensusScheduled-Retry:3:1
1919
PatientEvent:3:1
2020
PatientEvent-Error:3:1
2121
PatientEvent-Retry:3:1
22-
PatientIDsAcquired:3:1
23-
PatientIDsAcquired-Error:3:1
24-
PatientIDsAcquired-Retry:3:1
2522
PatientListsAcquired:3:1
2623
PatientListsAcquired-Error:3:1
2724
PatientListsAcquired-Retry:3:1

0 commit comments

Comments
 (0)