본문으로 건너뛰기
cccskills
무료GitHub에 공개

fagsak

Expert knowledge of Fagsak (case) domain in melosys-api. Use when: (1) Understanding the fagsak lifecycle and status transitions, (2) Working with actors (aktører) - citizens, employers, authorities, (3) Debugging case creation, closure, or type/theme changes, (4) Understanding relationship between fagsak and behandling, (5) Working with EU/EEA authorities or bilateral treaty authorities. Triggers: "fagsak", "saksnummer", "MEL-", "aktør", "sakstype", "sakstema", "avslutt sak".

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(4)

  • SKILL.md7.3 KB
  • references/actors.md4.0 KB
  • references/debugging.md3.7 KB
  • references/status.md3.9 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Fagsak Domain

Fagsak (case/dossier) is the top-level entity representing a social security case in melosys-api. Each fagsak contains one or more behandlinger (treatments) and multiple aktører (actors).

Quick Reference

Module Structure

domain/
├── Fagsak.kt              # Main entity (saksnummer, type, tema, status) - Kotlin
├── Aktoer.java            # Actor entity (citizen, employer, authority) - Java
└── Behandling.kt          # Treatment entity (child of Fagsak) - Kotlin

repository/
└── FagsakRepository.java  # CRUD + custom queries

service/sak/
└── FagsakService.java     # Business operations

The kodeverk enums (Sakstyper, Sakstemaer, Saksstatuser, Aktoersroller) are not local source files - they ship from the external melosys-internt-kodeverk dependency in package no.nav.melosys.domain.kodeverk:

  • Sakstyper - EU_EOS, TRYGDEAVTALE, FTRL, etc.
  • Sakstemaer - MEDLEMSKAP_LOVVALG, TRYGDEAVGIFT, etc.
  • Saksstatuser - OPPRETTET, ANNULLERT, OPPHØRT, HENLAGT, VIDERESENDT, etc.
  • Aktoersroller - BRUKER, VIRKSOMHET, ARBEIDSGIVER, TRYGDEMYNDIGHET, FULLMEKTIG, etc.

Entity Relationships

Fagsak (1)
├── (1:*) Aktoer
│   ├── BRUKER (citizen) - identified by aktørId
│   ├── VIRKSOMHET (company) - identified by orgnr
│   ├── ARBEIDSGIVER (employer) - identified by orgnr
│   ├── TRYGDEMYNDIGHET (foreign authority) - institusjonID or land
│   └── FULLMEKTIG (representative)
└── (1:*) Behandling
    ├── Saksopplysninger
    ├── Behandlingsnotater
    └── MottatteOpplysninger

Key Attributes

AttributeTypeDescription
saksnummerStringPrimary key, format "MEL-{sequence}"
gsakSaksnummerLong?Archive case ID (Joark/GSAK)
typeSakstyperEU_EOS, TRYGDEAVTALE, FTRL, etc.
temaSakstemaerMEDLEMSKAP_LOVVALG, TRYGDEAVGIFT, etc.
statusSaksstatuserOPPRETTET, ANNULLERT, OPPHØRT, HENLAGT, etc.
betalingsvalgBetalingstype?Payment choice

Common Operations

Creating a Case

val request = OpprettSakRequest.Builder()
    .medAktørID("2512489212185")
    .medSakstype(Sakstyper.EU_EOS)
    .medSakstema(Sakstemaer.MEDLEMSKAP_LOVVALG)
    .medBehandlingstype(Behandlingstyper.FØRSTEGANG)
    .medBehandlingstema(Behandlingstema.MEDLEMSKAP)
    .medMottaksdato(LocalDate.now())
    .build()

val fagsak = fagsakService.nyFagsakOgBehandling(request)

Finding a Case

// By saksnummer
val fagsak = fagsakService.hentFagsak("MEL-12345")

// By GSAK/archive ID
val fagsak = fagsakService.hentFagsakFraArkivsakID(123456L)

// By actor
val fagsaker = fagsakService.hentFagsakerMedAktør(Aktoersroller.BRUKER, "2512489212185")
val fagsaker = fagsakService.hentFagsakerMedOrgnr(Aktoersroller.ARBEIDSGIVER, "912345678")

Accessing Actors

// Citizen (bruker) - Fagsak.kt returns Kotlin nullable types, not Java Optional
val bruker: Aktoer? = fagsak.hentBruker()
val aktørId: String = fagsak.hentBrukersAktørID()  // throws if not found
val aktørIdEllerNull: String? = fagsak.finnBrukersAktørID()

// Company/Employer
val virksomhet: Aktoer = fagsak.hentVirksomhet()  // throws if not found
val orgnr: String? = fagsak.finnVirksomhetsOrgnr()
val arbeidsgiver: Aktoer? = fagsak.hentUnikArbeidsgiver()

// Authorities (EU/EEA)
val myndigheter: List<Aktoer> = fagsak.hentMyndigheter()

Accessing Treatments

// Active treatment (non-årsavregning)
val behandling: Behandling? = fagsak.finnAktivBehandlingIkkeÅrsavregning()
val behandling: Behandling = fagsak.hentAktivBehandling()  // throws if not found

// Annual reconciliations
val årsavregninger: List<Behandling> = fagsak.hentAktiveÅrsavregninger()

// Closed treatments
val inactive: List<Behandling> = fagsak.hentInaktiveBehandlinger()

// Sorted
val newest: List<Behandling> = fagsak.hentBehandlingerSortertSynkendePåRegistrertDato()

Type Checking

fagsak.erLovvalg()              // Is lovvalg case
fagsak.erSakstypeEøs()          // Is EU_EOS
fagsak.erSakstypeTrygdeavtale() // Is TRYGDEAVTALE
fagsak.erSakstypeFtrl()         // Is FTRL
fagsak.erSakstemaTrygdeavgift() // Is TRYGDEAVGIFT theme

Closing a Case

fagsakService.avsluttFagsakOgBehandling(fagsak, Saksstatuser.OPPHØRT)

Important Gotchas

1. Single Active Treatment Assumption

Current implementation assumes max 1 active treatment per case (excluding årsavregning).

// Throws TekniskException if multiple active treatments found
val behandling = fagsak.hentAktivBehandling()

TODO: MELOSYS-6520 - refactor for multi-treatment support.

2. Actor Role Uniqueness

Only one actor per role type allowed (except TRYGDEMYNDIGHET which can be multiple).

// Throws: "Det finnes mer enn en aktør med rollen X for sak Y"

3. Eager Loading

Both aktører and behandlinger use FetchType.EAGER - all loaded with case.

4. EU/EEA vs Treaty Authorities

// Both methods take saksnummer (String), not a Fagsak object - they look up the fagsak internally.

// EU/EEA: use institusjonID (format: "landkode:institusjonskode")
fagsakService.oppdaterMyndigheterForEuEos(saksnummer, listOf("SE:1234", "DK:5678"))

// Treaty: use land code
fagsakService.oppdaterMyndighetForTrygdeavtale(saksnummer, Land_iso2.US)

5. Type/Theme Change Constraints

// Returns false if multiple treatments or no active non-annual treatment
if (!fagsak.kanEndreTypeOgTema()) {
    throw FunksjonellException("Kan ikke endre type/tema")
}

Debugging

NOTE: both aktoer and behandling reference fagsak via a column named saksnummer (the FK is named saksnummer, not fagsak_saksnummer). The behandling type column is beh_type and ÅRSAVREGNING is stored verbatim (with Å). There is no LUKKET behandlingsstatus - the closed status is AVSLUTTET.

Find Case by Saksnummer

SELECT * FROM fagsak WHERE saksnummer = 'MEL-12345';

Find Cases for a Person

SELECT f.* FROM fagsak f
JOIN aktoer a ON a.saksnummer = f.saksnummer
WHERE a.rolle = 'BRUKER' AND a.aktoer_id = '2512489212185';

Find Cases with Multiple Active Treatments (problematic)

SELECT f.saksnummer, COUNT(*) as count
FROM fagsak f
JOIN behandling b ON b.saksnummer = f.saksnummer
WHERE b.status != 'AVSLUTTET'
AND b.beh_type != 'ÅRSAVREGNING'
GROUP BY f.saksnummer
HAVING COUNT(*) > 1;

See Debugging Guide for more SQL queries, common issues, log greps, and key code locations.

Detailed Documentation

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 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월 22일 업데이트

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월 22일 업데이트

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월 22일 업데이트

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월 22일 업데이트

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월 22일 업데이트

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월 22일 업데이트

navikt의 스킬 모두 보기

이 스킬의 문제 신고