Skip to content

Commit

Permalink
chore: replace common with navikt/diagnosekoder
Browse files Browse the repository at this point in the history
  • Loading branch information
karl-run committed Aug 1, 2024
1 parent 14dcc50 commit a95d867
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ val kotlinVersion = "2.0.0"
val commonsCodecVersion = "1.17.0"
val ktfmtVersion = "0.44"
val snappyJavaVersion = "1.1.10.5"
val diagnosekoderVersion = "1.2024.0"
val javaVersion = JvmTarget.JVM_21

plugins {
Expand Down Expand Up @@ -69,7 +70,7 @@ dependencies {

implementation("no.nav.helse:syfosm-common-models:$smCommonVersion")
implementation("no.nav.helse:syfosm-common-networking:$smCommonVersion")
implementation("no.nav.helse:syfosm-common-diagnosis-codes:$smCommonVersion")
implementation("no.nav.helse:diagnosekoder:$diagnosekoderVersion")
implementation("no.nav.helse:syfosm-common-kafka:$smCommonVersion")
constraints {
implementation("org.xerial.snappy:snappy-java:$snappyJavaVersion") {
Expand Down
6 changes: 4 additions & 2 deletions src/main/kotlin/no/nav/syfo/rules/arbeidsuforhet/Rules.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package no.nav.syfo.rules.arbeidsuforhet

import no.nav.helse.diagnosekoder.Diagnosekoder
import no.nav.syfo.model.Diagnose
import no.nav.syfo.model.RuleMetadata
import no.nav.syfo.model.Sykmelding
import no.nav.syfo.rules.dsl.RuleResult
import no.nav.syfo.sm.Diagnosekoder
import no.nav.syfo.sm.isICPC2

typealias Rule<T> = (sykmelding: Sykmelding, ruleMetadata: RuleMetadata) -> RuleResult<T>

Expand Down Expand Up @@ -90,3 +90,5 @@ val ugyldigKodeVerkBiDiagnose: ArbeidsuforhetRule = { sykmelding, _ ->
ruleResult = ugyldigKodeVerkBiDiagnose,
)
}

private fun Diagnose.isICPC2(): Boolean = system == Diagnosekoder.ICPC2_CODE
5 changes: 4 additions & 1 deletion src/main/kotlin/no/nav/syfo/rules/tilbakedatering/Rules.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package no.nav.syfo.rules.tilbakedatering

import no.nav.helse.diagnosekoder.Diagnosekoder
import no.nav.syfo.model.Diagnose
import java.time.temporal.ChronoUnit
import no.nav.syfo.model.Sykmelding
import no.nav.syfo.rules.dsl.RuleResult
Expand All @@ -16,7 +18,6 @@ import no.nav.syfo.rules.tilbakedatering.TilbakedateringRules.TILBAKEDATERT_INNT
import no.nav.syfo.services.RuleMetadataSykmelding
import no.nav.syfo.services.sortedFOMDate
import no.nav.syfo.services.sortedTOMDate
import no.nav.syfo.sm.isICD10

typealias Rule<T> = (sykmelding: Sykmelding, metadata: RuleMetadataSykmelding) -> RuleResult<T>

Expand Down Expand Up @@ -157,3 +158,5 @@ fun getNumberOfWords(input: String?): Int {
fun containsLetters(text: String): Boolean {
return text.contains("""[A-Za-z]""".toRegex())
}

fun Diagnose.isICD10(): Boolean = system == Diagnosekoder.ICD10_CODE
5 changes: 3 additions & 2 deletions src/test/kotlin/no/nav/syfo/Testdata.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package no.nav.syfo

import no.nav.helse.diagnosekoder.Diagnosekoder
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.OffsetDateTime
Expand Down Expand Up @@ -38,9 +39,9 @@ import no.nav.syfo.model.Periode
import no.nav.syfo.model.Prognose
import no.nav.syfo.model.SporsmalSvar
import no.nav.syfo.model.Sykmelding
import no.nav.syfo.sm.Diagnosekoder

fun Diagnosekoder.DiagnosekodeType.toDiagnose() = Diagnose(system = oid, kode = code, tekst = text)
fun Diagnosekoder.ICPC2.toDiagnose() = Diagnose(system = oid, kode = code, tekst = text)
fun Diagnosekoder.ICD10.toDiagnose() = Diagnose(system = oid, kode = code, tekst = text)

fun generateSykmelding(
fom: LocalDate = LocalDate.now(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package no.nav.syfo.rules.arbeidsuforhet

import io.kotest.core.spec.style.FunSpec
import no.nav.helse.diagnosekoder.Diagnosekoder
import java.time.LocalDate
import no.nav.syfo.client.Behandler
import no.nav.syfo.generateMedisinskVurdering
Expand All @@ -12,7 +13,6 @@ import no.nav.syfo.rules.validation.generatePersonNumber
import no.nav.syfo.services.BehandlerOgStartdato
import no.nav.syfo.services.RuleMetadataSykmelding
import no.nav.syfo.services.SykmeldingMetadataInfo
import no.nav.syfo.sm.Diagnosekoder
import no.nav.syfo.toDiagnose
import org.amshove.kluent.shouldBeEqualTo

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package no.nav.syfo.rules.tilbakedatering

import io.kotest.core.spec.style.FunSpec
import no.nav.helse.diagnosekoder.Diagnosekoder
import java.time.LocalDate
import no.nav.syfo.client.Behandler
import no.nav.syfo.generateSykmelding
Expand All @@ -23,7 +24,6 @@ import no.nav.syfo.services.BehandlerOgStartdato
import no.nav.syfo.services.Forlengelse
import no.nav.syfo.services.RuleMetadataSykmelding
import no.nav.syfo.services.SykmeldingMetadataInfo
import no.nav.syfo.sm.Diagnosekoder
import no.nav.syfo.toDiagnose
import org.amshove.kluent.shouldBeEqualTo

Expand Down

0 comments on commit a95d867

Please sign in to comment.