Repository navigation
Propose ADR-0003 for imports, with the unit import contract - #32
Merged
Merged
Conversation
How units, and later people and locations, come in from the authoritative source (NF-07): the sender POSTs a full snapshot as CSV, Saman validates every row, stores the file as an import run and answers 202, and a job in Payload's jobs queue applies it in one transaction. docs/integrations/ holds the contract for whoever writes the PowerShell script. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposes how data from Digdir's authoritative source gets into Saman (NF-07), starting with units (LO-01, LO-02, FO-02). This PR is documentation only. Per CLAUDE.md, the implementation waits until ADR-0003 is Accepted.
Please discuss it here, as review comments.
ADR-0003: Imports from the authoritative source (Proposed)
The sender runs PowerShell, POSTs a CSV file, and shouldn't have to wait for database updates. The proposal:
POST /api/enheter/importtakes the CSV file as the body.integration, limited to the import endpoints.400, listing every error with its line number.importkjoringer), which administrators can see in the admin panel. The response is202 Accepted, with a status URL.importUnits) in Payload's jobs queue applies the file in one transaction:exclusive+supersedes) means one import at a time, and a newer file replaces an older one that hasn't started.autoRunevery 10 seconds in the CMS.The ADR also lists the options that weren't chosen, and why: importing during the request, a separate pipeline, sending only changes, multipart, an Entra ID app with client credentials, and a separate worker.
Still to agree (checklist in the ADR):
docs/integrations/unit-import.mdThe contract to send to whoever writes the PowerShell script:
The script covers the pitfalls with
Export-Csv(ASCII by default in 5.1, and the#TYPEline) and withInvoke-RestMethod(-InFile, not a string in-Body).Other
docs/adr/README.md.architecture.md: its open question about the batch endpoint's contract now points to ADR-0003.docs/integrations/.🤖 Generated with Claude Code