Skip to content

Commit

Permalink
Merge branch 'main' into platform/bill/16141
Browse files Browse the repository at this point in the history
  • Loading branch information
wcutshall authored Jan 15, 2025
2 parents ec10791 + 6e08fd2 commit 97e3a29
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 86 deletions.
6 changes: 3 additions & 3 deletions frontend-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"@microsoft/applicationinsights-react-js": "^17.3.4",
"@microsoft/applicationinsights-web": "^3.3.4",
"@okta/okta-react": "^6.9.0",
"@okta/okta-signin-widget": "^7.27.1",
"@okta/okta-signin-widget": "^7.27.2",
"@rest-hooks/rest": "^3.0.3",
"@tanstack/react-query": "^5.62.16",
"@tanstack/react-query-devtools": "^5.62.16",
"@tanstack/react-query": "^5.64.0",
"@tanstack/react-query-devtools": "^5.64.0",
"@trussworks/react-uswds": "^9.1.0",
"@uswds/uswds": "3.7.1",
"axios": "^1.7.9",
Expand Down
2 changes: 2 additions & 0 deletions frontend-react/src/content/about/our-network.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Labs, testing facilities, and other healthcare organizations throughout the coun
- ARCpoint Labs
- BASE10 Genetics
- BZD Labs
- Carbon Health
- CLX Health
- Color
- CovX Labs
Expand All @@ -115,6 +116,7 @@ Labs, testing facilities, and other healthcare organizations throughout the coun
- Innolitics
- Intrivo
- LIMSABC
- MakeMyTestCount.org
- Mayo Clinic
- MedArbor Diagnostics
- Medical Network Solutions
Expand Down
44 changes: 22 additions & 22 deletions frontend-react/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1407,11 +1407,11 @@ __metadata:
languageName: node
linkType: hard

"@okta/okta-signin-widget@npm:^7.27.1":
version: 7.27.1
resolution: "@okta/okta-signin-widget@npm:7.27.1"
"@okta/okta-signin-widget@npm:^7.27.2":
version: 7.27.2
resolution: "@okta/okta-signin-widget@npm:7.27.2"
dependencies:
"@okta/okta-auth-js": ^7.9.0
"@okta/okta-auth-js": ^7.10.0
"@sindresorhus/to-milliseconds": ^1.0.0
"@types/backbone": ^1.4.15
"@types/eslint-scope": ^3.7.3
Expand All @@ -1433,7 +1433,7 @@ __metadata:
dependenciesMeta:
fsevents:
optional: true
checksum: 704c599fcab1009ea29a8fdab59c3b37b26942e4b19436d09a544cee00289c00ca425b00440f29c01e7ccfd6d522b7e7dbeb7697b063fab3b0afb5b1eff92bab
checksum: ca41430cc088fe703864d7e57bf29e1a9073fe0211ea9676632bbde8b3009254f520eb661215e1a7e32342ba760693206c02a3891130734ee9076cd5f8d416fa
languageName: node
linkType: hard

Expand Down Expand Up @@ -2459,10 +2459,10 @@ __metadata:
languageName: node
linkType: hard

"@tanstack/query-core@npm:5.62.16":
version: 5.62.16
resolution: "@tanstack/query-core@npm:5.62.16"
checksum: 96e712dba70b9234884108ecac2fa05ae588f7a1758377d80aa30d4e830f00cbef95309d2806828ca224d1db51e3c8364857a6f3581edb989f2f16cb98ad0f26
"@tanstack/query-core@npm:5.64.0":
version: 5.64.0
resolution: "@tanstack/query-core@npm:5.64.0"
checksum: a489552af41419f9561baaff15073d63a4cf8634b5a9f4a484364a70734b6e37f7460560acccf61ef4b631ac4b6008000c4f13996b905f219b8099bd8343451c
languageName: node
linkType: hard

Expand All @@ -2473,26 +2473,26 @@ __metadata:
languageName: node
linkType: hard

"@tanstack/react-query-devtools@npm:^5.62.16":
version: 5.62.16
resolution: "@tanstack/react-query-devtools@npm:5.62.16"
"@tanstack/react-query-devtools@npm:^5.64.0":
version: 5.64.0
resolution: "@tanstack/react-query-devtools@npm:5.64.0"
dependencies:
"@tanstack/query-devtools": 5.62.16
peerDependencies:
"@tanstack/react-query": ^5.62.16
"@tanstack/react-query": ^5.64.0
react: ^18 || ^19
checksum: 1acd07c82cd37a73731e180b4511025d33143a5820c09450143b81bde24871a7f7bccb44d6d488583dc319ae3ed22779bd38157836d37e2673a1c9efa004a3b6
checksum: 24e2aed653ed79ab132a8da451e8323daaea9acf4c677e7dad1cdc4fd8c5d7419906801d350a6596f7ff35b80dae97ba3c432d8e84d748d8ea53bc75b41348f6
languageName: node
linkType: hard

"@tanstack/react-query@npm:^5.62.16":
version: 5.62.16
resolution: "@tanstack/react-query@npm:5.62.16"
"@tanstack/react-query@npm:^5.64.0":
version: 5.64.0
resolution: "@tanstack/react-query@npm:5.64.0"
dependencies:
"@tanstack/query-core": 5.62.16
"@tanstack/query-core": 5.64.0
peerDependencies:
react: ^18 || ^19
checksum: dbf9cf549799d96ecefea237617e15234d9fa446460efe5286e128840b1bcfff5d7ff8a9eb9208aefe469800b50fa2ad31d93e631be3e0a58baac61a3094fb33
checksum: d6676fd1481753af1c348c8084057f9c879a8ac69c5cd5ae3f90ae29a6734a32511de90b2b02f9ac31da1ca475ecd72d2fb5e06d01dfa78c78d59919d32364d5
languageName: node
linkType: hard

Expand Down Expand Up @@ -9811,7 +9811,7 @@ __metadata:
"@microsoft/applicationinsights-react-js": ^17.3.4
"@microsoft/applicationinsights-web": ^3.3.4
"@okta/okta-react": ^6.9.0
"@okta/okta-signin-widget": ^7.27.1
"@okta/okta-signin-widget": ^7.27.2
"@playwright/test": ^1.49.1
"@rest-hooks/rest": ^3.0.3
"@rest-hooks/test": ^7.3.1
Expand All @@ -9828,8 +9828,8 @@ __metadata:
"@storybook/react-vite": ^8.4.7
"@storybook/testing-library": ^0.2.2
"@storybook/theming": ^8.4.7
"@tanstack/react-query": ^5.62.16
"@tanstack/react-query-devtools": ^5.62.16
"@tanstack/react-query": ^5.64.0
"@tanstack/react-query-devtools": ^5.64.0
"@testing-library/dom": ^10.4.0
"@testing-library/jest-dom": ^6.6.3
"@testing-library/react": ^16.1.0
Expand Down
16 changes: 6 additions & 10 deletions prime-router/src/main/kotlin/azure/ReportFunction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.SerializationFeature
import com.fasterxml.jackson.databind.json.JsonMapper
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import com.github.ajalt.clikt.core.CliktError
import com.google.common.net.HttpHeaders
import com.microsoft.azure.functions.HttpMethod
import com.microsoft.azure.functions.HttpRequestMessage
import com.microsoft.azure.functions.HttpResponseMessage
Expand Down Expand Up @@ -148,6 +149,8 @@ class ReportFunction(
) request: HttpRequestMessage<String?>,
): HttpResponseMessage {
val claims = AuthenticatedClaims.authenticate(request)
val caseInsensitiveHeaders = request.headers.mapKeys { it.key.lowercase() }
val accessToken = caseInsensitiveHeaders[HttpHeaders.AUTHORIZATION.lowercase()]
if (claims != null && claims.authorized(setOf(Scope.primeAdminScope))) {
val receiverName = request.queryParameters["receiverName"]
val organizationName = request.queryParameters["organizationName"]
Expand Down Expand Up @@ -179,11 +182,12 @@ class ReportFunction(
try {
val result = ProcessFhirCommands().processFhirDataRequest(
file,
Environment.get().envName,
Environment.get(),
receiverName,
organizationName,
senderSchema,
false
false,
accessToken!!
)
file.delete()
val message = if (result.message != null) {
Expand All @@ -202,17 +206,13 @@ class ReportFunction(
MessageOrBundleStringified(
message,
bundle,
result.senderTransformPassed,
result.senderTransformErrors,
result.senderTransformWarnings,
result.enrichmentSchemaPassed,
result.enrichmentSchemaErrors,
result.senderTransformWarnings,
result.receiverTransformPassed,
result.receiverTransformErrors,
result.receiverTransformWarnings,
result.filterErrors,
result.filtersPassed
)
)
)
Expand All @@ -227,17 +227,13 @@ class ReportFunction(
class MessageOrBundleStringified(
var message: String? = null,
var bundle: String? = null,
override var senderTransformPassed: Boolean = true,
override var senderTransformErrors: MutableList<String> = mutableListOf(),
override var senderTransformWarnings: MutableList<String> = mutableListOf(),
override var enrichmentSchemaPassed: Boolean = true,
override var enrichmentSchemaErrors: MutableList<String> = mutableListOf(),
override var enrichmentSchemaWarnings: MutableList<String> = mutableListOf(),
override var receiverTransformPassed: Boolean = true,
override var receiverTransformErrors: MutableList<String> = mutableListOf(),
override var receiverTransformWarnings: MutableList<String> = mutableListOf(),
override var filterErrors: MutableList<String> = mutableListOf(),
override var filtersPassed: Boolean = true,
) : ProcessFhirCommands.MessageOrBundleParent()

/**
Expand Down
64 changes: 37 additions & 27 deletions prime-router/src/main/kotlin/cli/ProcessFhirCommands.kt
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ class ProcessFhirCommands : CliktCommand(
private val environmentParam by option(
"--receiver-setting-env", help = "Environment that specifies where to get the receiver settings"
)
.choice("local", "test", "staging", "prod", "demo1")
.default("local", "local environment")

/**
* Sender schema location
Expand All @@ -141,15 +143,39 @@ class ProcessFhirCommands : CliktCommand(

private val hl7DiffHelper = HL7DiffHelper()

/**
* The environment specified by the command line parameters
*/
val environment: Environment by lazy {
Environment.get(environmentParam)
}

/**
* The access token left by a previous login command as specified by the command line parameters
*/
private val oktaAccessToken: String by lazy {

if (environment.oktaApp == null) {
"placeholder_token"
} else {
OktaCommand.fetchAccessToken(environment.oktaApp)
?: abort(
"Invalid access token. " +
"Run ./prime login to fetch/refresh your access token for the $environmentParam environment."
)
}
}

override fun run() {
val messageOrBundle =
processFhirDataRequest(
inputFile,
environmentParam,
environment,
receiverNameParam,
orgNameParam,
senderSchemaParam,
true
true,
oktaAccessToken
)
if (messageOrBundle.message != null) {
outputResult(messageOrBundle.message!!)
Expand All @@ -162,18 +188,19 @@ class ProcessFhirCommands : CliktCommand(

fun processFhirDataRequest(
inputFile: File,
environment: String?,
environment: Environment,
receiverName: String?,
orgName: String?,
senderSchema: String?,
isCli: Boolean,
accessToken: String,
): MessageOrBundle {
// Read the contents of the file
val contents = inputFile.inputStream().readBytes().toString(Charsets.UTF_8)
if (contents.isBlank()) throw CliktError("File ${inputFile.absolutePath} is empty.")
// Check on the extension of the file for supported operations
val inputFileType = inputFile.extension.uppercase()
val receiver = getReceiver(environment, receiverName, orgName, GetMultipleSettings(), isCli)
val receiver = getReceiver(environment, receiverName, orgName, isCli, accessToken)

val messageOrBundle = MessageOrBundle()
when {
Expand Down Expand Up @@ -293,7 +320,6 @@ class ProcessFhirCommands : CliktCommand(

messageOrBundle.bundle = output
}
messageOrBundle.enrichmentSchemaPassed = messageOrBundle.enrichmentSchemaErrors.isEmpty()
}
}

Expand Down Expand Up @@ -350,33 +376,25 @@ class ProcessFhirCommands : CliktCommand(
}

abstract class MessageOrBundleParent(
open var senderTransformPassed: Boolean = true,
open var senderTransformErrors: MutableList<String> = mutableListOf(),
open var senderTransformWarnings: MutableList<String> = mutableListOf(),
open var enrichmentSchemaPassed: Boolean = true,
open var enrichmentSchemaErrors: MutableList<String> = mutableListOf(),
open var enrichmentSchemaWarnings: MutableList<String> = mutableListOf(),
open var receiverTransformPassed: Boolean = true,
open var receiverTransformErrors: MutableList<String> = mutableListOf(),
open var receiverTransformWarnings: MutableList<String> = mutableListOf(),
open var filterErrors: MutableList<String> = mutableListOf(),
open var filtersPassed: Boolean = true,
)

class MessageOrBundle(
var message: Message? = null,
var bundle: Bundle? = null,
override var senderTransformPassed: Boolean = true,
override var senderTransformErrors: MutableList<String> = mutableListOf(),
override var senderTransformWarnings: MutableList<String> = mutableListOf(),
override var enrichmentSchemaPassed: Boolean = true,
override var enrichmentSchemaErrors: MutableList<String> = mutableListOf(),
override var enrichmentSchemaWarnings: MutableList<String> = mutableListOf(),
override var receiverTransformPassed: Boolean = true,
override var receiverTransformErrors: MutableList<String> = mutableListOf(),
override var receiverTransformWarnings: MutableList<String> = mutableListOf(),
override var filterErrors: MutableList<String> = mutableListOf(),
override var filtersPassed: Boolean = true,
) : MessageOrBundleParent()

private fun applyConditionFilter(receiver: Receiver, bundle: Bundle): Bundle {
Expand Down Expand Up @@ -404,27 +422,20 @@ class ProcessFhirCommands : CliktCommand(
}

fun getReceiver(
environment: String?,
environment: Environment,
receiverName: String?,
orgName: String?,
getMultipleSettings: GetMultipleSettings = GetMultipleSettings(),
isCli: Boolean,
accessToken: String,
): Receiver? {
if (!environment.isNullOrBlank() && !receiverName.isNullOrBlank() && !orgName.isNullOrBlank()) {
if (!receiverName.isNullOrBlank() && !orgName.isNullOrBlank()) {
if (isCli && !outputFormat.isNullOrBlank()) {
throw CliktError(
"Please specify either a receiver OR an output format. Not both."
)
}
val foundEnvironment = Environment.get(environment)
val accessToken = OktaCommand.fetchAccessToken(foundEnvironment.oktaApp)
?: abort(
"Invalid access token. " +
"Run ./prime login to fetch/refresh your access " +
"token for the $foundEnvironment environment."
)
val organizations = getMultipleSettings.getAll(
environment = foundEnvironment,
val organizations = GetMultipleSettings().getAll(
environment = environment,
accessToken = accessToken,
specificOrg = orgName,
exactMatch = true
Expand All @@ -439,7 +450,7 @@ class ProcessFhirCommands : CliktCommand(
}
} else if (isCli && outputFormat.isNullOrBlank()) {
throw CliktError(
"Output format is required if the environment, receiver, and org " +
"Output format is required if the receiver and org " +
"are not specified. "
)
}
Expand Down Expand Up @@ -491,7 +502,6 @@ class ProcessFhirCommands : CliktCommand(
errors = messageOrBundle.receiverTransformErrors
).process(messageOrBundle.bundle!!)
messageOrBundle.message = message
messageOrBundle.receiverTransformPassed = messageOrBundle.receiverTransformErrors.isEmpty()
}
}

Expand Down
2 changes: 1 addition & 1 deletion prime-router/src/main/kotlin/cli/SettingCommands.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ class GetMultipleSettings : SettingCommand(

fun getAll(
environment: Environment,
accessToken: String = oktaAccessToken,
accessToken: String,
specificOrg: String? = filter,
exactMatch: Boolean = false,
): List<DeepOrganization> {
Expand Down
Loading

0 comments on commit 97e3a29

Please sign in to comment.