Skip to content

Commit

Permalink
rename assertion related references to be assertion instead of automated
Browse files Browse the repository at this point in the history
Co-authored-by: saquino0827 <[email protected]>
Co-authored-by: Sylvie <[email protected]>
Co-authored-by: basiliskus <[email protected]>
  • Loading branch information
4 people committed Jan 10, 2025
1 parent 19dc37b commit 3db4f37
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
## Routing of these files

To avoid routing issues, we have decided to use `MSH-11` for routing of test messages ([more context here](/adr/026-hl7-test-message-routing.md)). The values we have decided to use are:
- `D`: for test files **not** to be sent to partners and to be sent manually. Any files under `examples/` and not in `examples/Test/Automated/` should have this value
- `N`: for test files **not** to be sent to partners and sent by a scheduled task. Any files under `examples/Test/Automated/` should have this value
- `D`: for test files **not** to be sent to partners and to be sent manually. Any files under `examples/` and not in `examples/Test/Automated/Assertion/` should have this value
- `N`: for test files **not** to be sent to partners and sent by a scheduled task. Any files under `examples/Test/Automated/Assertion/` should have this value
- `T`: for test files to be sent manually to partners. `P` will also be routed to partners

**Note**: for some sample files, our transformations **will** rewrite the `MSH-5` and/or `MSH-6` HL7 fields normally used for routing, so we can't rely only on those fields to route. This is the case for most of the files in the `examples/CA` folder. If you are sending any files in that folder and you don't want the message to be delivered to our partner, please make sure `MSH-11` is **not** `T` or `P`. Otherwise the message will be delivered to our partner regardless of what is there in `MSH-5` and `MSH-6`. Please see [this ADR](/adr/026-hl7-test-message-routing.md) for more context
Expand All @@ -38,7 +38,7 @@ In order to keep the snapshots up-to-date, we have a script that automates the r
- The `ORM` messages with ids `003`, `004`, `005`, `006`, `007`, `008`, `009`, `010` in the `Test/Orders` folder were modified to comply with current requirements for ReportStream, as it doesn't yet support HL7 `2.3`:
- Added `MSH-9.3`
- Changed `MSH-10` to `2.5.1`
- The `MSH-11` value for all sample files in `examples/` (with the exception of files in `examples/Test/Automated/`) was changed to `D`. This is to comply with our routing filters in RS for test messages
- The `MSH-11` value for all sample files in `examples/` (with the exception of files in `examples/Test/Automated/Assertion/`) was changed to `D`. This is to comply with our routing filters in RS for test messages

## Previously renamed files

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
* of this interface should provide a way to retrieve a list of HL7FileStream objects.
*/
public interface FileFetcher {
List<HL7FileStream> fetchFiles(FileFetchEnum fileFetchEnum);
List<HL7FileStream> fetchFiles(FileFetcherEnum fileFetcherEnum);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package gov.hhs.cdc.trustedintermediary.rse2e;

public enum FileFetchEnum {
public enum FileFetcherEnum {
GOLDEN_COPY,
AUTOMATED
ASSERTION
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import com.azure.storage.blob.BlobContainerClientBuilder;
import com.azure.storage.blob.models.BlobItem;
import com.azure.storage.blob.models.ListBlobsOptions;
import gov.hhs.cdc.trustedintermediary.rse2e.FileFetchEnum;
import gov.hhs.cdc.trustedintermediary.rse2e.FileFetcher;
import gov.hhs.cdc.trustedintermediary.rse2e.FileFetcherEnum;
import gov.hhs.cdc.trustedintermediary.rse2e.hl7.HL7FileStream;
import java.time.LocalDate;
import java.time.ZoneId;
Expand Down Expand Up @@ -51,15 +51,15 @@ public static FileFetcher getInstance() {
}

@Override
public List<HL7FileStream> fetchFiles(FileFetchEnum fileFetchEnum) {
public List<HL7FileStream> fetchFiles(FileFetcherEnum fileFetcherEnum) {
List<HL7FileStream> relevantFiles = new ArrayList<>();

LocalDate today = LocalDate.now(TIME_ZONE);

String pathPrefix = AzureBlobHelper.buildDatePathPrefix(today);

if (FileFetchEnum.AUTOMATED == fileFetchEnum) {
pathPrefix += "Automated/";
if (FileFetcherEnum.ASSERTION == fileFetcherEnum) {
pathPrefix += "Assertion/";
} else {
pathPrefix += "GoldenCopy/";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class AzureBlobOrganizer {

public static final String GOLDEN_COPY = "GoldenCopy/";
public static final String AUTOMATED = "Automated/";
public static final String ASSERTION = "Assertion/";
private final BlobContainerClient blobContainerClient;

protected final Logger logger = ApplicationContext.getImplementation(Logger.class);
Expand All @@ -31,10 +31,10 @@ private void deleteOldBlobs(String testType, ZoneId timeZone) {
}
}

// Organize blob into folder structure: YEAR/MONTH/DAY/Automated_OR_GoldenCopy/SOURCE_NAME
// Organize blob into folder structure: YEAR/MONTH/DAY/Assertion_OR_GoldenCopy/SOURCE_NAME
public void organizeAndCleanupBlobsByDate(int retentionDays, ZoneId timeZone) {
deleteOldBlobs(GOLDEN_COPY, timeZone);
deleteOldBlobs(AUTOMATED, timeZone);
deleteOldBlobs(ASSERTION, timeZone);
for (BlobItem blobItem : blobContainerClient.listBlobs()) {
String sourceName = blobItem.getName();
try {
Expand All @@ -58,7 +58,7 @@ public void organizeAndCleanupBlobsByDate(int retentionDays, ZoneId timeZone) {
continue;
}

String testTypeAndSourceName = AUTOMATED + sourceName;
String testTypeAndSourceName = ASSERTION + sourceName;
if (sourceBlob.getBlobName().contains("GOLDEN-COPY")) {
testTypeAndSourceName = GOLDEN_COPY + sourceName;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gov.hhs.cdc.trustedintermediary.rse2e.external.localfile;

import gov.hhs.cdc.trustedintermediary.rse2e.FileFetchEnum;
import gov.hhs.cdc.trustedintermediary.rse2e.FileFetcher;
import gov.hhs.cdc.trustedintermediary.rse2e.FileFetcherEnum;
import gov.hhs.cdc.trustedintermediary.rse2e.hl7.HL7FileStream;
import java.io.IOException;
import java.io.InputStream;
Expand All @@ -27,9 +27,9 @@ public static FileFetcher getInstance() {
}

@Override
public List<HL7FileStream> fetchFiles(FileFetchEnum fileFetchEnum) {
public List<HL7FileStream> fetchFiles(FileFetcherEnum fileFetcherEnum) {
String rse2ELocalInputFilePath = "../examples/Test/Automated/";
if (FileFetchEnum.AUTOMATED == fileFetchEnum) {
if (FileFetcherEnum.ASSERTION == fileFetcherEnum) {
rse2ELocalInputFilePath += "Assertion/";
} else {
rse2ELocalInputFilePath += "GoldenCopy/Expected/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class AutomatedTest extends Specification {

def "test defined assertions on relevant messages"() {
given:
azureFiles = azureFileFetcher.fetchFiles(FileFetchEnum.AUTOMATED)
localFiles = localFileFetcher.fetchFiles(FileFetchEnum.AUTOMATED)
azureFiles = azureFileFetcher.fetchFiles(FileFetcherEnum.ASSERTION)
localFiles = localFileFetcher.fetchFiles(FileFetcherEnum.ASSERTION)
def rulesToEvaluate = engine.getRules()
def matchedFiles = fileMatcher.matchFiles(azureFiles, localFiles)

Expand All @@ -86,8 +86,8 @@ class AutomatedTest extends Specification {

def "test golden copy files on actual files"() {
given:
azureFiles = azureFileFetcher.fetchFiles(FileFetchEnum.GOLDEN_COPY)
localFiles = localFileFetcher.fetchFiles(FileFetchEnum.GOLDEN_COPY)
azureFiles = azureFileFetcher.fetchFiles(FileFetcherEnum.GOLDEN_COPY)
localFiles = localFileFetcher.fetchFiles(FileFetcherEnum.GOLDEN_COPY)
def matchedFiles = fileMatcher.matchFiles(azureFiles, localFiles)

when:
Expand Down

0 comments on commit 3db4f37

Please sign in to comment.