Skip to content

Commit

Permalink
stub out filter for organizing and fetching azure files
Browse files Browse the repository at this point in the history
Co-authored-by: James Herr <[email protected]>
Co-authored-by: Sylvie <[email protected]>
  • Loading branch information
3 people committed Dec 20, 2024
1 parent 7b545da commit ccca6ab
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,25 @@ public static FileFetcher getInstance() {
return INSTANCE;
}

// TODO - we need to modify the guts to only grab the golden or automated path
@Override
public List<HL7FileStream> fetchFiles() {
String files_path = System.getenv("LOCAL_FILE_PATH");
if (files_path == null || files_path.isEmpty()) {
throw new IllegalArgumentException("Environment variable LOCAL_FILE_PATH is not set");
}

List<HL7FileStream> relevantFiles = new ArrayList<>();

LocalDate today = LocalDate.now(TIME_ZONE);
String pathPrefix = AzureBlobHelper.buildDatePathPrefix(today);
String datePrefix = AzureBlobHelper.buildDatePathPrefix(today);

// TODO - update base on AzureBlobOrganizer
String pathPrefix = datePrefix + "Automated/";
if (files_path.contains("GoldenCopy")) {
pathPrefix += datePrefix + "GoldenCopy/";
}

ListBlobsOptions options = new ListBlobsOptions().setPrefix(pathPrefix);
for (BlobItem blobItem : blobContainerClient.listBlobs(options, null)) {
BlobClient blobClient = blobContainerClient.getBlobClient(blobItem.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,17 @@ public void organizeAndCleanupBlobsByDate(int retentionDays, ZoneId timeZone) {
}

// TODO - separate the content by golden or automated so it can be distinguished
// when its pulled down
// modify destinationName to be test folder specific
// possibly read blob and modify parseAndMapMessageByControlId or use its parts to
// get a different MSH header like getIdentifier
// when its pulled down and modify destinationName to be test folder specific
// possibly use a different receiver and filter on that

String testTypeAndSourceName = "Automated/" + sourceName;
if (sourceBlob.getBlobName().contains("golden")) {
testTypeAndSourceName = "GoldenCopy/" + sourceName;
}

String destinationName =
AzureBlobHelper.createDateBasedPath(sourceCreationDate, sourceName);
AzureBlobHelper.createDateBasedPath(
sourceCreationDate, testTypeAndSourceName);

BlobClient destinationBlob = blobContainerClient.getBlobClient(destinationName);
destinationBlob
Expand Down

0 comments on commit ccca6ab

Please sign in to comment.