diff --git a/src/main/kotlin/no/nav/syfo/sykmelding/KafkaSykmeldingConsumer.kt b/src/main/kotlin/no/nav/syfo/sykmelding/KafkaSykmeldingConsumer.kt index fbce7bad..02fbe927 100644 --- a/src/main/kotlin/no/nav/syfo/sykmelding/KafkaSykmeldingConsumer.kt +++ b/src/main/kotlin/no/nav/syfo/sykmelding/KafkaSykmeldingConsumer.kt @@ -11,7 +11,7 @@ import no.nav.syfo.kafka.launchKafkaTask import no.nav.syfo.personoppgave.domain.PersonOppgave import no.nav.syfo.personoppgave.domain.PersonOppgaveType import no.nav.syfo.personoppgave.getPersonOppgaverByReferanseUuid -import no.nav.syfo.sykmelding.ReceivedSykmeldingDTO +import no.nav.syfo.sykmelding.* import no.nav.syfo.util.configuredJacksonMapper import org.apache.kafka.clients.consumer.* import org.apache.kafka.common.serialization.Deserializer @@ -81,6 +81,7 @@ class KafkaSykmeldingConsumer( connection = connection, receivedSykmeldingDTO = receivedSykmeldingDTO, ) + countIrrelevantSykmeldingFelter(sykmelding) } } } @@ -88,6 +89,24 @@ class KafkaSykmeldingConsumer( } } + private fun countIrrelevantSykmeldingFelter(sykmelding: Sykmelding) { + val beskrivBistandNav = sykmelding.meldingTilNAV?.beskrivBistand + val tiltakNav = sykmelding.tiltakNAV + val andreTiltak = sykmelding.andreTiltak + if (!beskrivBistandNav.isNullOrEmpty() && isIrrelevant(beskrivBistandNav)) { + COUNT_MOTTATT_SYKMELDING_BESKRIV_BISTAND_NAV_IRRELEVANT.increment() + } + if (!tiltakNav.isNullOrEmpty() && isIrrelevant(tiltakNav)) { + COUNT_MOTTATT_SYKMELDING_TILTAK_NAV_IRRELEVANT.increment() + } + if (!andreTiltak.isNullOrEmpty() && isIrrelevant(andreTiltak)) { + COUNT_MOTTATT_SYKMELDING_ANDRE_TILTAK_IRRELEVANT.increment() + } + } + + private fun isIrrelevant(content: String): Boolean = + irrelevantSykmeldingFelterContent.contains(content.lowercase().trim()) + private fun createPersonoppgave( connection: Connection, receivedSykmeldingDTO: ReceivedSykmeldingDTO, @@ -116,6 +135,7 @@ class KafkaSykmeldingConsumer( companion object { val log: Logger = LoggerFactory.getLogger(KafkaSykmeldingConsumer::class.java) + val irrelevantSykmeldingFelterContent = listOf(".", "-", "nei") } } diff --git a/src/main/kotlin/no/nav/syfo/sykmelding/SykmeldingMetrics.kt b/src/main/kotlin/no/nav/syfo/sykmelding/SykmeldingMetrics.kt index 8ac7750f..7b38781c 100644 --- a/src/main/kotlin/no/nav/syfo/sykmelding/SykmeldingMetrics.kt +++ b/src/main/kotlin/no/nav/syfo/sykmelding/SykmeldingMetrics.kt @@ -1,10 +1,13 @@ -package no.nav.syfo.behandler.kafka.sykmelding +package no.nav.syfo.sykmelding import io.micrometer.core.instrument.Counter import no.nav.syfo.metric.* const val MOTTATT_SYKMELDING = "${METRICS_NS}_mottatt_sykmelding_count" const val MOTTATT_SYKMELDING_CREATED_PERSONOPPGAVE = "${METRICS_NS}_mottatt_sykmelding_personoppgave_count" +const val MOTTATT_SYKMELDING_BESKRIV_BISTAND_NAV_IRRELEVANT = "${METRICS_NS}_mottatt_sykmelding_beskriv_bistand_nav_irrelevant_count" +const val MOTTATT_SYKMELDING_TILTAK_NAV_IRRELEVANT = "${METRICS_NS}_mottatt_sykmelding_tiltak_nav_irrelevant_count" +const val MOTTATT_SYKMELDING_ANDRE_TILTAK_IRRELEVANT = "${METRICS_NS}_mottatt_sykmelding_andre_tiltak_irrelevant_count" val COUNT_MOTTATT_SYKMELDING: Counter = Counter .builder(MOTTATT_SYKMELDING) @@ -15,3 +18,18 @@ val COUNT_MOTTATT_SYKMELDING_SUCCESS: Counter = Counter .builder(MOTTATT_SYKMELDING_CREATED_PERSONOPPGAVE) .description("Counts the number of received sykmelding that created personoppgave") .register(METRICS_REGISTRY) + +val COUNT_MOTTATT_SYKMELDING_BESKRIV_BISTAND_NAV_IRRELEVANT: Counter = Counter + .builder(MOTTATT_SYKMELDING_BESKRIV_BISTAND_NAV_IRRELEVANT) + .description("Counts the number of received sykmelding with beskriv bistand Nav that is irrelevant for oppgave") + .register(METRICS_REGISTRY) + +val COUNT_MOTTATT_SYKMELDING_TILTAK_NAV_IRRELEVANT: Counter = Counter + .builder(MOTTATT_SYKMELDING_TILTAK_NAV_IRRELEVANT) + .description("Counts the number of received sykmelding with tiltak Nav that is irrelevant for oppgave") + .register(METRICS_REGISTRY) + +val COUNT_MOTTATT_SYKMELDING_ANDRE_TILTAK_IRRELEVANT: Counter = Counter + .builder(MOTTATT_SYKMELDING_ANDRE_TILTAK_IRRELEVANT) + .description("Counts the number of received sykmelding with andre tiltak that is irrelevant for oppgave") + .register(METRICS_REGISTRY)