Skip to content

Commit

Permalink
Edits based on review
Browse files Browse the repository at this point in the history
  • Loading branch information
the-andrew committed Jan 10, 2025
1 parent ae4ea16 commit 1be93c5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 41 deletions.
3 changes: 1 addition & 2 deletions prime-router/src/main/kotlin/azure/SenderFunction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import com.microsoft.azure.functions.HttpResponseMessage
import com.microsoft.azure.functions.annotation.AuthorizationLevel
import com.microsoft.azure.functions.annotation.FunctionName
import com.microsoft.azure.functions.annotation.HttpTrigger
import gov.cdc.prime.router.Metadata
import gov.cdc.prime.router.azure.db.enums.TaskAction
import gov.cdc.prime.router.azure.observability.event.IReportStreamEventService
import gov.cdc.prime.router.azure.observability.event.ReportStreamEventService
Expand Down Expand Up @@ -69,7 +68,7 @@ class SenderFunction(
val bodyCsv = csvReader().readAllWithHeader(bodyCsvText)

// Get observation mapping table
val tableMapper = LookupTableConditionMapper(Metadata())
val tableMapper = LookupTableConditionMapper(workflowEngine.metadata)
val observationMappingTable = tableMapper.mappingTable.caseSensitiveDataRowsMap
val tableTestCodeMap = observationMappingTable.associateBy { it[ObservationMappingConstants.TEST_CODE_KEY] }

Expand Down
40 changes: 1 addition & 39 deletions prime-router/src/test/kotlin/azure/SenderFunctionTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,12 @@ import gov.cdc.prime.router.metadata.ObservationMappingConstants
import gov.cdc.prime.router.serializers.Hl7Serializer
import gov.cdc.prime.router.tokens.AuthenticatedClaims
import gov.cdc.prime.router.unittest.UnitTestUtils
import io.mockk.OfTypeMatcher
import io.mockk.clearAllMocks
import io.mockk.every
import io.mockk.mockk
import io.mockk.mockkClass
import io.mockk.mockkConstructor
import io.mockk.mockkObject
import io.mockk.spyk
import kotlinx.serialization.json.Json
import org.jooq.Meta
import org.jooq.tools.jdbc.MockConnection
import org.jooq.tools.jdbc.MockDataProvider
import org.jooq.tools.jdbc.MockResult
Expand All @@ -51,18 +47,6 @@ class SenderFunctionTest {
"80382-5,Influenza virus A Ag [Presence] in Upper respiratory specimen by Rapid immunoassay,LOINC\n" +
"12345,Flu B,LOCAL"

// val RESP_BODY_TEST_JSON = Json.parseToJsonElement(
// "[{\"test code\":\"97097-0\"," +
// "\"test description\":\"SARS-CoV-2 (COVID-19) Ag [Presence] in Upper respiratory specimen by Rapid " +
// "immunoassay\"," +
// "\"coding system\":\"LOINC\",\"mapped?\":\"Y\"}," +
// "{\"test code\":\"80382-5\"," +
// "\"test description\":\"Influenza virus A Ag [Presence] in Upper respiratory specimen by Rapid immunoassay\"," +
// "\"coding system\":\"LOINC\",\"mapped?\":\"Y\"}," +
// "{\"test code\":\"12345\",\"test description\":\"Flu B\"," +
// "\"coding system\":\"LOCAL\",\"mapped?\":\"N\"}]"
// )

val testOrganization = DeepOrganization(
"phd",
"test",
Expand Down Expand Up @@ -119,9 +103,7 @@ class SenderFunctionTest {
every { AuthenticatedClaims.authenticate(any()) } returns mockClaims
every { mockClaims.authorizedForSendOrReceive(any(), any()) } returns true

// TODO trying some stuff??
val myMetadata = Metadata(UnitTestUtils.simpleSchema)
myMetadata.lookupTableStore += mapOf(
metadata.lookupTableStore += mapOf(
"observation-mapping" to LookupTable(
"observation-mapping",
listOf(
Expand All @@ -147,26 +129,6 @@ class SenderFunctionTest {
)
)

// TODO mock LookupTableConditionMapper with DB in a cleared state
// mockkConstructor(LookupTableConditionMapper::class)
// every {
// anyConstructed<LookupTableConditionMapper>().mappingTable.caseSensitiveDataRowsMap
// } returns LookupTableConditionMapper(myMetadata).mappingTable.caseSensitiveDataRowsMap
// val mockMetadata = mockk<Metadata>()
// mockk<Metadata>()
// every {
// Metadata.getInstance()
// } returns myMetadata

// mockkClass(LookupTableConditionMapper::class)
// val conditionMapper = LookupTableConditionMapper(myMetadata)
// mockkConstructor(LookupTableConditionMapper::class)
// every {
// constructedWith<LookupTableConditionMapper>(OfTypeMatcher<Metadata>(Metadata::class))
// .mappingTable.caseSensitiveDataRowsMap
// } returns conditionMapper.mappingTable.caseSensitiveDataRowsMap


val codeToConditionMapping = listOf(
mapOf(
"test code" to "001",
Expand Down

0 comments on commit 1be93c5

Please sign in to comment.