prime-simplereport icon indicating copy to clipboard operation
prime-simplereport copied to clipboard

Update processing-mode-code for lower envs

Open DanielSass opened this issue 8 months ago • 3 comments

BACKEND PULL REQUEST

Related Issue

  • TODO create issue

Changes Proposed

  • The processing-mode-code should be set to T (for test) in all environments aside from prod
  • processing-mode-code should be set to P (for production) in prod.

Additional Information

https://skylight-hq.slack.com/archives/C086AJ9CWAW/p1742925824301099

This is only relevant for bulk upload files as they get sent to RS directly, for single entry there is a no-op queue that takes test events.

Testing

Deploy to a lower. Send a test result (either pipeline, bulk upload or single entry), resulting CSV for FHIR bundle should have the processing mode code set.

(Covid Pipeline) /backend/src/main/java/gov/cdc/usds/simplereport/service/TestResultUploadService.java#L246-L249

    if (!"P".equals(processingModeCodeValue)
        && !row.containsKey(PROCESSING_MODE_CODE_COLUMN_NAME)) {
      row.put(PROCESSING_MODE_CODE_COLUMN_NAME, processingModeCodeValue);
    }

(Universal Pipeline) /backend/src/main/java/gov/cdc/usds/simplereport/utils/BulkUploadResultsToFhir.java#L568

            .processingId(processingModeCode)
            .build());

/backend/src/main/java/gov/cdc/usds/simplereport/api/converter/FhirConverter.java#L1413-L1420

    var messageHeader =
        createMessageHeader(
            testingLabOrganizationFullUrl,
            diagnosticReportFullUrl,
            provenanceFullUrl,
            props.getGitProperties(),
            props.getProcessingId(),
            uuidGenerator.randomUUID());

DanielSass avatar Mar 26 '25 17:03 DanielSass

should we change the default value here too? https://github.com/CDCgov/prime-simplereport/blob/b43dc34051df951e07e1bedb6076e6da5037c397/backend/src/main/java/gov/cdc/usds/simplereport/utils/BulkUploadResultsToFhir.java#L89-L90

also does @Value overwrite the explicit assignment? seems strange to assign at all?

edit oh also here https://github.com/CDCgov/prime-simplereport/blob/5ba4455154efc068c4e5dae201338db95a7402ca/backend/src/main/java/gov/cdc/usds/simplereport/service/TestResultUploadService.java#L116-L117

mehansen avatar Mar 26 '25 20:03 mehansen

~if someone uploads a CSV with a processing_mode_code column set to T in prod, does this mean we'll send it with T to the Covid pipeline but send it with P to the UP?~ 🤐

I think it's more like, in a lower, you can still override the processing mode code to P for the Covid pipeline if you include it in your CSV because of this: !row.containsKey(PROCESSING_MODE_CODE_COLUMN_NAME)

mehansen avatar Mar 26 '25 20:03 mehansen

also does @Value overwrite the explicit assignment? seems strange to assign at all?

edit oh also here

https://github.com/CDCgov/prime-simplereport/blob/5ba4455154efc068c4e5dae201338db95a7402ca/backend/src/main/java/gov/cdc/usds/simplereport/service/TestResultUploadService.java#L116-L117

I do believe @Value overwrites the default. Will go digging through the spring docs to confirm

I think this is still in progress now because of the prod profile thing? but just going through my PR inbox

Yup. Still low priority but still planning on doing this.

do we know from RS if setting the processing mode code to T is enough to prevent results from getting routed to their receivers in staging? I know it's excluded in most receiver filters in prod but not sure if the same applies to staging

I don't think it guarantees anything about routing, but it will make it clear to anyone who receives them that they are test messages.

I also think we should just remove this line since I don't think there's any legit use case for it and it does allow someone (potentially unauthenticated) in a lower to send data with the P code

🤔 🤔 🤔

DanielSass avatar May 09 '25 16:05 DanielSass

I also think we should just remove this line since I don't think there's any legit use case for it and it does allow someone (potentially unauthenticated) in a lower to send data with the P code

I think of this as being more of an issue that training / demo actually send things to report stream. I think the more correct solution would be to implement something similar to the no-op queues that would skip the sending to report stream.

/backend/src/main/java/gov/cdc/usds/simplereport/config/AzureTestEventReportingQueueConfiguration.java#L82-L88

  @Profile("!" + PROD)
  @Primary
  @Bean(name = "csvQueueReportingService")
  @ConditionalOnMissingBean(name = "csvQueueReportingService")
  TestEventReportingService noOpDebugCSVReportingService() {
    return NoOpCovidReportingService.builder().printSerializedTestEvent(true).build();
  }

DanielSass avatar May 09 '25 16:05 DanielSass