feat(proceeding-type): explicit ערר/בל"מ field for cases + corpus
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m40s

Same case_number can exist as both a regular appeal (ערר) and an
extension-of-time request (בל"מ), and we were inferring the difference
from appeal_subtype prefixes — fragile, and case-number lookups
weren't disambiguated. Now stored as a first-class field on both
case_law (corpus) and cases (live cases), with partial unique indexes
on (case_number, proceeding_type).

- SCHEMA_V15: column + CHECK constraints + backfill from
  appeal_subtype LIKE 'extension_request_%' + partial unique indexes
  replace the old global UNIQUE(case_number).
- derive_proceeding_type() centralizes the inference rule
  (extension_request_* → בל"מ; subject regex fallback; default ערר).
- Metadata extractor prompt asks Claude to populate the new field
  explicitly; apply_to_record writes it for internal_committee rows.
- internal_decision_upload, case_create, case_update accept an
  optional proceeding_type; FastAPI request models expose it.
- Wizard + edit dialog get a sided Select; case header renders the
  resolved label (ערר / בל"מ).
- Uploaded the 2 staged בל"מ decisions on betterment levy:
  8126/24 (סופר נוח, 13 chunks), 8047/23 (הרנון, 48 chunks).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-26 09:17:33 +00:00
parent 1645653ba9
commit d359ab9884
15 changed files with 308 additions and 14 deletions

View File

@@ -54,6 +54,8 @@ export type Case = {
respondents?: string[] | null;
property_address?: string | null;
permit_number?: string | null;
/* 'ערר' = regular appeal, 'בל"מ' = extension-of-time request */
proceeding_type?: "ערר" | 'בל"מ';
};
export type CaseDocument = {

View File

@@ -40,6 +40,15 @@ export const expectedOutcomes = [
{ value: "betterment_levy", label: "היטל השבחה" },
] as const;
/* proceeding_type — distinguishes a regular appeal (ערר) from an
* extension-of-time request (בל"מ). The same case_number can exist as
* both, so this is a separate axis from appeal_subtype/practice_area. */
export const proceedingTypes = [
{ value: "ערר", label: "ערר" },
{ value: 'בל"מ', label: 'בל"מ' },
] as const;
export type ProceedingType = (typeof proceedingTypes)[number]["value"];
export const caseCreateSchema = z.object({
case_number: z
.string()
@@ -75,6 +84,7 @@ export const caseCreateSchema = z.object({
"extension_request_compensation",
"unknown",
] as const satisfies readonly AppealSubtype[]),
proceeding_type: z.enum(["ערר", 'בל"מ'] as const),
});
export type CaseCreateInput = z.infer<typeof caseCreateSchema>;
@@ -100,6 +110,7 @@ export const caseUpdateSchema = z.object({
.optional(),
property_address: z.string().trim().max(200).optional(),
permit_number: z.string().trim().max(100).optional(),
proceeding_type: z.enum(["ערר", 'בל"מ'] as const).optional(),
});
export type CaseUpdateInput = z.infer<typeof caseUpdateSchema>;