code wiki / (root) / nx_efile_lib.nx

nx_efile_lib.nx source

↩ module page · 98 lines · 4701 B

1// nx_efile_lib.nx -- COURT E-FILING: submission, acceptance, rejection, and relation back. 2// u2605THE TRAP THIS EXISTS FOR: SUBMISSION IS NOT FILING. A brief uploaded at 11:47pm on the deadline and 3// REJECTED at 9am the next morning for a caption defect, a missing signature block or a bad PDF profile 4// was NEVER FILED. The clerk's rejection does not stop the clock, does not extend the deadline, and does 5// not preserve the date. Firms lose motions -- and occasionally entire claims -- to this, because the 6// confirmation email says "submitted" and everyone reads it as "filed". 7// 8// So the filing date is the ACCEPTANCE date, never the submission date, unless a jurisdiction's 9// relation-back rule expressly returns it. Relation back is modelled as an EXPLICIT jurisdictional 10// permission plus a cure window, never as a default -- a default here would silently recreate the trap. 11// 12// u2605THE SECOND TOOTH: a rejected submission that is corrected and RE-submitted after the deadline is 13// timely ONLY if (a) the jurisdiction allows relation back, (b) the original submission was itself 14// before the deadline, and (c) the correction lands inside the cure window. All three, or it is late. 15// A correction that relates back to an ALREADY-LATE original relates back to a late date -- still late. 16// 17// u2605FAIL-CLOSED: an unknown acceptance date is NOT filed. Pending is not filed. Only an acceptance 18// counts, because only an acceptance is what the docket will show. 19// 20// STRUCTURE: pure decision core, zero I/O. license_tier: ORIGINAL LIB. 21 22import "nx_matter_lib.nx" 23 24const EFL_UNSET: i64 = 0 - 2000000002 25 26const EFL_NOT_FILED: i64 = 0 27const EFL_PENDING: i64 = 1 28const EFL_FILED_TIMELY: i64 = 2 29const EFL_FILED_LATE: i64 = 3 30const EFL_REJECTED: i64 = 4 31 32func efl_is1(v: i64) -> i64 { 33 if v == 1 { return 1 } 34 return 0 35} 36 37// u2605THE OPERATIVE FILING DATE. Acceptance governs. Relation back returns the SUBMISSION date only when 38// the jurisdiction allows it AND the correction landed inside the cure window. 39func efl_filing_date_pure(submitted: i64, accepted: i64, relation_back_allowed: i64, cure_days: i64) -> i64 { 40 if accepted == EFL_UNSET { return EFL_UNSET } 41 if efl_is1(relation_back_allowed) == 0 { return accepted } 42 if submitted == EFL_UNSET { return accepted } 43 if cure_days == EFL_UNSET { return accepted } 44 if accepted > (submitted + cure_days) { return accepted } 45 return submitted 46} 47 48// u2605THE STATUS. A rejected filing is REJECTED, not filed -- regardless of when it was submitted. 49func efl_status_pure(submitted: i64, accepted: i64, rejected: i64, deadline: i64, relation_back_allowed: i64, cure_days: i64) -> i64 { 50 if efl_is1(rejected) == 1 { 51 if accepted == EFL_UNSET { return EFL_REJECTED } 52 } 53 if accepted == EFL_UNSET { 54 if submitted == EFL_UNSET { return EFL_NOT_FILED } 55 return EFL_PENDING 56 } 57 if deadline == EFL_UNSET { return EFL_NOT_FILED } 58 let fd: i64 = efl_filing_date_pure(submitted, accepted, relation_back_allowed, cure_days) 59 if fd == EFL_UNSET { return EFL_NOT_FILED } 60 if fd <= deadline { return EFL_FILED_TIMELY } 61 return EFL_FILED_LATE 62} 63 64// 1 only when the court record will show a timely filing. 65func efl_timely_pure(status: i64) -> i64 { 66 if status == EFL_FILED_TIMELY { return 1 } 67 return 0 68} 69 70// u2605A SUBMISSION IS NOT A FILING: this predicate exists so the distinction is callable, not just implied. 71func efl_on_docket_pure(status: i64) -> i64 { 72 if status == EFL_FILED_TIMELY { return 1 } 73 if status == EFL_FILED_LATE { return 1 } 74 return 0 75} 76 77// days by which a filing missed its deadline; 0 if timely, UNSET if not on the docket at all. 78func efl_days_late_pure(filing_date: i64, deadline: i64) -> i64 { 79 if filing_date == EFL_UNSET { return EFL_UNSET } 80 if deadline == EFL_UNSET { return EFL_UNSET } 81 if filing_date <= deadline { return 0 } 82 return filing_date - deadline 83} 84 85// a rejection leaves the party exposed until re-accepted; count anything not timely as exposure. 86func efl_exposure_pure(rejected: i64, pending: i64, late: i64) -> i64 { 87 return rejected + pending + late 88} 89 90func efl_status_label(s: i64, out: *u8) -> i64 { 91 if s == EFL_FILED_TIMELY { mt_catcopy(out, 0, "FILED-TIMELY" as *u8); out[12] = 0 as u8; return 12 } 92 if s == EFL_FILED_LATE { mt_catcopy(out, 0, "FILED-LATE" as *u8); out[10] = 0 as u8; return 10 } 93 if s == EFL_REJECTED { mt_catcopy(out, 0, "REJECTED-NOT-FILED" as *u8); out[18] = 0 as u8; return 18 } 94 if s == EFL_PENDING { mt_catcopy(out, 0, "PENDING-NOT-FILED" as *u8); out[17] = 0 as u8; return 17 } 95 mt_catcopy(out, 0, "NOT-FILED" as *u8) 96 out[9] = 0 as u8 97 return 9 98}