Skip to content
cccskills
FreePublished on GitHub

statistikk

Expert knowledge of A1 statistics publishing to data warehouse in melosys-api. Use when: (1) Understanding utstedt A1 Kafka publishing, (2) Debugging UtstedtA1Service or Kafka producer issues, (3) Understanding DVH/data warehouse integration, (4) Investigating A1 statistics message format and schema.

The English summary is being prepared. Showing the original description.

See how to install

Files included (2)

  • SKILL.md7.8 KB
  • references/debugging.md6.4 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Statistikk Skill

Expert knowledge of statistics publishing for issued A1 certificates to the data warehouse.

Quick Reference

Key Components

ComponentLocationPurpose
UtstedtA1Servicestatistikk/src/main/java/.../utstedt_a1/service/Creates and sends A1 statistics messages
UtstedtA1EventListenerstatistikk/src/main/java/.../utstedt_a1/service/Listens for vedtak events
UtstedtA1AivenProducerstatistikk/src/main/java/.../utstedt_a1/integrasjon/Kafka producer for Aiven
UtstedtA1AdminControllerstatistikk/src/main/java/.../utstedt_a1/api/Admin endpoint for republishing
UtstedtA1Meldingstatistikk/src/main/java/.../utstedt_a1/integrasjon/dto/Kafka message DTO

Kafka Topics

TopicEnvironmentPurpose
teammelosys.melosys-utstedt-a1.v1prod-gcpA1 issued statistics
teammelosys.melosys-utstedt-a1.v1-q1dev-gcp (q1)A1 issued statistics
teammelosys.melosys-utstedt-a1.v1-q2dev-gcp (q2)A1 issued statistics
teammelosys.melosys-utstedt-a1.v1-locallocalA1 issued statistics

Processing Flow

1. VedtakMetadata is saved → VedtakMetadataLagretEvent published
   ↓
2. UtstedtA1EventListener receives event (@Async, @TransactionalEventListener)
   ↓
3. UtstedtA1Service.sendMeldingOmUtstedtA1(behandlingID) called
   ↓
4. Check if a1Produseres(behandlingsresultat) is true
   ↓
5. Build UtstedtA1Melding with:
   - Serienummer: saksnummer + behandlingId
   - Artikkel: Mapped from LovvalgBestemmelse
   - Periode: From lovvalgsperiode
   - UtsendtTilLand: From trygdemyndighetsland
   - TypeUtstedelse: FØRSTEGANG, ENDRING, or ANNULLERING
   ↓
6. Validate against JSON schema (a1-utstedt-schema.json)
   ↓
7. UtstedtA1AivenProducer publishes to Kafka topic

Debugging

For symptom-by-symptom troubleshooting (message not published, wrong article, missing utsendtTilLand, schema validation failures), diagnostic SQL queries, log strings to grep for, and curl/Kafka console-consumer commands for republishing and inspecting the topic, see references/debugging.md.

UtstedtA1Melding Schema

Message Structure

{
  "serienummer": "MEL-123456",
  "saksnummer": "MEL-123",
  "behandlingId": 456,
  "aktorId": "1234567891234",
  "artikkel": "12.1",
  "periode": {
    "fom": "2024-01-01",
    "tom": "2024-12-31"
  },
  "utsendtTilLand": "SE",
  "datoUtstedelse": "2024-01-15",
  "typeUtstedelse": "FØRSTEGANG",
  "meldingOpprettetTidspunkt": "2024-01-15T10:30:00.000Z"
}

Field Descriptions

FieldTypeRequiredDescription
serienummerStringYesUnique ID: saksnummer + behandlingId
saksnummerStringYesFagsak saksnummer (MEL-*)
behandlingIdLongYesTreatment ID
aktorIdStringYesPerson's aktør-ID (13 chars)
artikkelStringYesEU regulation article. On the Java side this is a Lovvalgsbestemmelse value object that serializes (via @JsonValue on getKode()) to the string code on the wire
periodeObjectYesA1 validity period (fom/tom)
utsendtTilLandStringConditionalISO-2 country code (for Art. 12)
datoUtstedelseDateYesDate of issuance/annulment
typeUtstedelseStringYesFØRSTEGANG, ENDRING, ANNULLERING
meldingOpprettetTidspunktDateTimeYesMessage creation timestamp

Artikkel Values

Mapped from EU Regulation 883/2004:

ValueDescription
11.3aWork in one member state (employed or self-employed)
11.3bCivil servant (tjenestemann)
11.4Work on a ship under a member state's flag (flaggstatsprinsippet)
11.5Flight or cabin crew (flyvende/kabinpersonell)
12.1Posted workers (employees)
12.2Posted workers (self-employed)
13.1Work in two or more states (employee)
13.2Work in two or more states (self-employed)
13.3Work in two or more states (mixed)
13.4Civil servants in multiple states
16Exceptions/agreements

The JSON schema enum (a1-utstedt-schema.json) accepts all values above, including 11.5. The Java Lovvalgsbestemmelse value object (see below) currently only maps 11.3a, 11.3b, 11.4, 12.1, 12.2, 13.1-13.4, and 16 — so a 11.5 value would need to be added to the enum before it can be produced on the wire.

TypeUtstedelse Values

ValueDescription
FØRSTEGANGFirst-time issuance
ENDRINGModification of existing A1
ANNULLERINGAnnulment of existing A1

Special Handling

UK/Great Britain Cases

For UK-related cases (EFTA Storbritannia convention), messages are sent twice:

  1. Once with the GB-specific bestemmelse
  2. Once with the standard 883/2004 equivalent

The gate is whether the lovvalgsperiode's bestemmelse is one of the Lovvalgbestemmelser_konv_efta_storbritannia values. When it is, lagMelding builds the article via Lovvalgsbestemmelse.avKonvensjonEftaStorbritannia(...); otherwise via Lovvalgsbestemmelse.av(...). Actual UtstedtA1Service source:

var erStorbritannia = Arrays.stream(Lovvalgbestemmelser_konv_efta_storbritannia.values())
    .anyMatch(bestemmelse -> bestemmelse == lovvalgsbestemmelse);

if (erStorbritannia) {
    sendMeldingOmUtstedtA1(behandlingsresultat); // GB-specific article (avKonvensjonEftaStorbritannia)
}
sendMeldingOmUtstedtA1(behandlingsresultat);     // standard 883/2004 article (av)

UtsendtTilLand Logic

Land is only included for certain articles:

// Land should NOT be sent for:
// - Article 13 (multiple countries, no single destination)
// - Article 11 (unless also 12 - edge case)
private boolean landSkalIkkeSendes(Lovvalgsperiode lovvalgsperiode) {
    return lovvalgsperiode.erArtikkel13()
        || (lovvalgsperiode.erArtikkel11() && !lovvalgsperiode.erArtikkel12());
}

Admin API

Republish Single Treatment

POST /admin/utstedtA1/{behandlingID}/publiserMelding
Authorization: Bearer {token}

Republish Multiple Treatments

POST /admin/utstedtA1/publiserMelding/eksisterendeBehandlinger?fom=2024-01-01
Authorization: Bearer {token}

Response:
{
  "sendteBehandlinger": [123, 456],
  "feiledeBehandlinger": [789]
}

Configuration

Kafka Configuration

kafka:
  aiven:
    a1-utstedt:
      topic: ${KAFKA_AIVEN_UTSTEDT_A1_TOPIC:teammelosys.melosys-utstedt-a1.v1}

Producer Configuration

@Bean
@Qualifier("aivenUtstedtA1")
KafkaTemplate<String, UtstedtA1Melding> aivenKafkaTemplate

JSON Schema Validation

Messages are validated against: utstedt_a1/a1-utstedt-schema.json

Schema enforces:

  • Required fields presence
  • Field types and formats
  • Valid enum values for artikkel and typeUtstedelse
  • Date formats (ISO-8601)
  • String length limits

Integration Points

Event Source

Triggered by: VedtakMetadataLagretEvent

  • Published when vedtak metadata is saved
  • Event contains behandlingID

Dependencies

ServicePurpose
BehandlingsresultatServiceFetch behandlingsresultat
LandvelgerServiceGet trygdemyndighetsland
VedtakMetadataRepositoryQuery existing vedtak for republishing

Related Skills

  • vedtak: VedtakMetadata triggers statistics
  • behandlingsresultat: Source of A1 data
  • lovvalg: Lovvalgsperiode and articles
  • kodeverk: Land_iso2, Lovvalgbestemmelser enums

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Expert knowledge of Altinn A1 application processing for posted workers in melosys-api. Use when: (1) Understanding Altinn søknad/skjema processing, (2) Debugging MedlemskapArbeidEOS form mapping, (3) Understanding SoeknadMapper transformations, (4) Investigating posted worker application issues, (5) Understanding the MOTTAK_SOKNAD_ALTINN saga flow.

The English summary is being prepared. Showing the original description.

navikt/melosys-api2Updated Oct 21, 2026

Expert knowledge of Employer/Employment integration (EREG/AAREG) in melosys-api. Use when: (1) Working with organization data from EREG (Enhetsregisteret), (2) Working with employment data from AAREG (Arbeidsforhold), (3) Understanding employer/organization lookup, (4) Debugging employer or employment issues, (5) Understanding the mapping between register data and domain models. Triggers: orgnummer, arbeidsforhold, EREG, AAREG, Enhetsregisteret, registeropplysninger, ansettelsesperiode, saksopplysning.

The English summary is being prepared. Showing the original description.

navikt/melosys-api2Updated Oct 21, 2026

Modular monolith architecture overview for melosys-api. Use when needing to understand module structure, dependencies between modules, where to place new code, or when changes in one module might affect others. Triggers: "architecture", "module dependencies", "where should I put", "which modules", "dependency graph".

The English summary is being prepared. Showing the original description.

navikt/melosys-api2Updated Oct 21, 2026

Expert knowledge of Behandling (case treatment) domain in melosys-api. Use when: (1) Understanding the behandling lifecycle and status transitions, (2) Debugging issues with behandling creation, status changes, or closure, (3) Understanding relationships between Fagsak, Behandling, and Behandlingsresultat, (4) Investigating why a behandling is stuck or has wrong status, (5) Understanding Behandlingstyper, Behandlingstema, Behandlingsstatus enums, (6) Debugging journalføring or SED-triggered behandling creation, (7) Understanding behandling creation via saksflyt sagas.

The English summary is being prepared. Showing the original description.

navikt/melosys-api2Updated Oct 21, 2026

Expert knowledge of Behandlingsresultat (treatment result) domain in melosys-api. Use when: (1) Understanding result types and their meaning (FASTSATT_LOVVALGSLAND, MEDLEM_I_FOLKETRYGDEN, etc.), (2) Working with periods - Lovvalgsperiode, Medlemskapsperiode, Anmodningsperiode, Utpekingsperiode, (3) Debugging vedtak/decision metadata, criteria evaluation, or social insurance charges, (4) Understanding EU/EEA coordination logic and Article 16 exception handling, (5) Working with trygdeavgift (social insurance charge) calculations.

The English summary is being prepared. Showing the original description.

navikt/melosys-api2Updated Oct 21, 2026

brev

Free

Expert knowledge of Brev (letter generation) in melosys-api. Use when: (1) Producing letters and decision documents (vedtaksbrev), (2) Understanding Dokgen templates and mapping, (3) Configuring letter recipients and distribution, (4) Debugging letter generation issues, (5) Adding new letter types or templates.

The English summary is being prepared. Showing the original description.

navikt/melosys-api2Updated Oct 21, 2026

See all skills by navikt

Report a problem with this skill