跳到正文
cccskills
免费在 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.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(2)

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

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

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

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

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.

中文简介正在准备中。当前显示原文说明。

navikt/melosys-api22026年10月21日 更新

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.

中文简介正在准备中。当前显示原文说明。

navikt/melosys-api22026年10月21日 更新

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".

中文简介正在准备中。当前显示原文说明。

navikt/melosys-api22026年10月21日 更新

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.

中文简介正在准备中。当前显示原文说明。

navikt/melosys-api22026年10月21日 更新

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.

中文简介正在准备中。当前显示原文说明。

navikt/melosys-api22026年10月21日 更新

brev

免费

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.

中文简介正在准备中。当前显示原文说明。

navikt/melosys-api22026年10月21日 更新

查看 navikt 的全部技能

报告此技能的问题