The OpenAPI specification for the API is available at https://narmesteleder-api.nav.no/swagger
This is the repository for narmesteleder-api, a service that provides an API for managing narmesteleder connection between employees on sick leave and their narmeste ledere.
It identifies when an employee has a need to be assigned a narmeste leder from their employer. It will communicate this need to the employer by creating a dialog in Altinn Dialogporten, that will contain an url endpoints that can be used with GET to retrieve details about person on sick leave, and PUT to assign narmesteleder to the employee.
Tjenesten konsumerer Kafka-topics for å opprette og vedlikeholde data som brukes i narmesteleder-flyten.
teamsykmelding.syfo-sendt-sykmeldingteamsykmelding.syfo-narmesteleder-leesahpdl.leesah-v1(fase 1)
- Konsumenten bruker Avro og Schema Registry.
- Konsumenten starter bare når
PDL_LEESAH_CONSUMER_ENABLED=true. - Toggle er
falsei prod, ogfalsei dev til tilgang tilpdl.leesah-v1er bekreftet. - Logger og metrikker inneholder bare strukturell informasjon, aldri navn, fødselsnummer, personidenter eller rå meldingsinnhold.
- Ved relevante
NAVN_V1-hendelser brukes personidenter fra Leesah kun til å finne eksisterende personer iperson-tabellen. For treff hentes korrekt nåværende navn og fødselsdato fra PDL førperson-raden oppdateres. - Konsumenten oppretter fortsatt ikke nye personer fra
pdl.leesah-v1; kun eksisterende personer i registeret oppdateres. Personhendelse.avscer hentet franavikt/narmesteleder(src/main/avro/no/nav/person/pdl/leesah/Personhendelse.avsc, SHA24c9a2cd2921e9cc423df8c343542ff0967564ae).
An always up-to-date diagram can be views in the excellent service from Flex Arkitektur.
C4Container
title Container diagram esyfo-narmesteleder
Person(person, Person, "A person using inbox in Altinn3 to find linemanager requirements sent from jNAV")
Container_Ext(lps, "LPS", "And external system used by organizations")
Container_Boundary(c3, "Digdir") {
Container_Ext(dialogporten, "Dialogporten", "", "System for creating and responding with dialogs and transmissions")
}
Container_Boundary(c1, "Esyfo-Narmesteleder") {
Container(narmesteleder-frontend, "narmesteleder-frontend", "Typescript, Docker Container", "Provides frontend for used to assign narmesteleder to employees on sick leave")
Container(esyfo-narmesteleder, "narmesteleder-api", "Kotlin, Docker Container", "Provides api for managing narmesteleder connection between employees on sick leave and their narmeste ledere")
ContainerDb(database, "CloudSQL Database", "Postgresql Database", "Stores dialogs and documents")
Rel(esyfo-narmesteleder, database, "Uses", "sync, JDBC")
Rel(narmesteleder-frontend, esyfo-narmesteleder, "Uses", "HTTPS/JSON")
}
Container_Boundary(kafka, "Kafka Team Sykmelding") {
Container_Ext(kafkaTopic-sendt-sykmelding, "Kafka Topic: teamsykmelding.syfo-sendt-sykmelding", "Kafka Topic")
Rel(kafkaTopic-sendt-sykmelding, esyfo-narmesteleder, "Consumes from")
Container_Ext(kafkaTopic-narmesteleder-leesah, "Kafka Topic: teamsykmelding.syfo-narmesteleder-leesah", "Kafka Topic")
Rel(kafkaTopic-narmesteleder-leesah, esyfo-narmesteleder, "Consumes from")
Container_Ext(kafkaTopic-syfo-narmesteleder, "Kafka Topic: teamsykmelding.syfo-narmesteleder", "Kafka Topic")
Rel(esyfo-narmesteleder, kafkaTopic-syfo-narmesteleder, "Publishes to")
}
Container_Boundary(c2, "Other Nais applications") {
Container_Ext(tilganger, "Arbeidsgiver-altinn-tilganger", "Kotlin, Docker Container", "Provides Altinn access information for provided token")
Container_Ext(aareg, "Aareg", "", "Provides information about employment status for a person")
Container_Ext(ereg, "Ereg", "", "Provides information about organization structure")
Container_Ext(pdl, "PDL", "", "Fetches information about organization structure")
}
Rel(esyfo-narmesteleder, tilganger, "Uses", "HTTPS/JSON")
Rel(esyfo-narmesteleder, dialogporten, "Uses", "HTTPS/JSON")
Rel( esyfo-narmesteleder, aareg, "Uses", "HTTPS/JSON")
Rel( esyfo-narmesteleder, ereg, "Uses", "HTTPS/JSON")
Rel(esyfo-narmesteleder, pdl, "Uses", "HTTPS/JSON")
Rel(lps, dialogporten, "Uses", "HTTPS/JSON")
Rel(lps, esyfo-narmesteleder, "Uses", "HTTPS/PDF")
Rel(person, dialogporten, "Uses", "HTTPS/HTML")
Rel(person, narmesteleder-frontend, "Uses", "HTTPS/HTML")
We use mise to simplify running common tasks. To run a task, use the command
mise <task-name>To get a list of available tasks, run
mise tasksLinting and formatting is done using ktlint
Please make sure to run the lint check before pushing code. Best way to ensure this is to add a pre-commit git hook. You can do this with the mise task
mise add-lint-check-as-pre-commit-hook Or manually by running u
mise lintIf there are any linting errors, you can try to fix them automatically with
mise formatIn order to run kafka++ you will probably need to extend the default size of your container platform. (Rancher Desktop, Colima etc.)
Suggestion for Colima
colima start --arch aarch64 --memory 8 --cpu 4 We have a docker-compose.yml file to run a postgresql database, texas and a fake authserver. In addition, we have a docker-compose.kafka.yml that will run a kafka broker, schema registry and kafka-io
There are mise tasks to start and stop these environments. Start them both using
mise docker-upStop them all again
mise docker-downYou can use kafka-ui to inspect your consumers and topics. You can also publish or read messages on the topics
In order to get a token for annsatt that has access to update narmesteleder relasjon, you can use the following url: https://tokenx-token-generator.intern.dev.nav.no/api/obo?aud=dev-gcp:team-esyfo:esyfo-narmesteleder
Select "på høyt nivå" and give the ident of a Daglig leder for the organisasjonsnummer you want to test with.
There is a Bruno collection in the folder .bruno that you can open and find request to run against your locally running instance. Look in the Docs tab of requests for further instructions, when needed.
There is a folder with json files for kafka messages in local-dev-resources. These can be used from kafka-ui to publish messages to the topics that syfo-esyfo-narmesteleder is consuming.