[3] LawNet PostgreSQL ingestion and artifacts #38
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Objective
Implement LawNet ingestion against PostgreSQL using the storage/schema shape established by #37.
After this slice, real or fixture-backed LawNet catalog and document ingestion should populate the Postgres-backed store that the BFF/frontend already knows how to read.
Dependencies
Depends on #37.
Scope
Out of scope
Done when
[3] LawNet document ingestion and case detailto [3] LawNet PostgreSQL ingestion and artifactsImplementation plan update from discussion:
date-desclisting order.page_size = 20andknown_overlap_required = 20.docid.last_seen_atfor known records encountered.docids.consecutive_known >= known_overlap_required, normally one full known page.first_seen_atandlast_seen_attocatalog.lawnet_judgment.ingest.lawnet_discovery_staterow for LawNet with last incremental/full timestamps, last total/error, and configurableknown_overlap_requireddefaulting to 20.discovery_run/discovery_page/discovery_recordaudit checkpoint tables until we actually need resumable full scans or detailed drift diagnostics.Additional scheduler persistence update:
ingest.lawnet_discovery_statenow also owns the full LawNet listing scan schedule.full_scan_interval, default 14 days.full_scan_retry_delay, default 1 hour.next_full_scan_at, defaultnow()for the initial scheduled full scan.last_full_at,last_reported_total, andlast_error.next_full_scan_atfrom Postgres on each poll and only runs a full listing scan when the DB says it is due.next_full_scan_atby the DB-configured interval.next_full_scan_atby the DB-configured retry delay, avoiding immediate repeated attempts after restart.Current scope note: the implemented full scan upserts LawNet listing records and updates scan state. Availability/disappearance reconciliation remains deferred to the fuller reconciliation work.
Additional incremental schedule update:
ingest.lawnet_discovery_statenow also tracks the next incremental head scan.incremental_scan_interval, default 1 hour.incremental_scan_retry_delay, default 15 minutes.next_incremental_scan_at, defaultnow().next_full_scan_atandnext_incremental_scan_atfrom Postgres.next_incremental_scan_at, so the scheduler does not immediately run a duplicate head scan after refreshing the full listing.next_incremental_scan_atby the DB-configured incremental interval.next_incremental_scan_atby the DB-configured incremental retry delay.This keeps both periodic scan types restart-safe and DB-driven.
Schema follow-up:
ingest.lawnet_discovery_stateso it stores durable state only:next_incremental_scan_atnext_full_scan_atupdated_atknown_overlap_requiredincremental_scan_intervalincremental_scan_retry_delayfull_scan_intervalfull_scan_retry_delay--known-overlap, default 20) instead of DB state.