DEV Community

Cover image for A keep-until date for every NDIS record: modelling the 7-year retention rule in Python and SQL
Rostery Team
Rostery Team

Posted on

A keep-until date for every NDIS record: modelling the 7-year retention rule in Python and SQL

Originally based on our guide to NDIS record keeping and the 7-year rule on rostery.com.au. This version is rewritten for developers, data people and anyone who looks after the systems that hold NDIS records. General information only, not legal advice. The date arithmetic and a few edge cases below are our reading of the Act; the NDIA hasn't published guidance on them.

Australia's National Disability Insurance Scheme (NDIS) pays providers for supports delivered to participants. In August 2026 Parliament added a new section 45B to the NDIS Act, which tells a provider how long to keep the records behind each claim. For most providers the answer is 7 years, counted from the day the claim is made.

That sounds like a policy for the filing cabinet. In practice it's a data problem. A single service agreement can back forty weekly claims. A shift note can be claimed, rejected and claimed again. A plan manager can make the claim for a support you delivered, on a day you never see. If your system deletes records on a simple "older than X" rule, it will get some of these wrong.

This post builds a small Python module that gives every record a keep-until date, plus a SQL view that does the same thing in a database, and a disposal check that says no unless every condition is met.

What the law says, as requirements

Here's section 45B, read as a list of requirements. Quotes and section numbers are from the amending Act as made.

  1. Who and what. An NDIS provider must keep a record that relates to a claim for an NDIS amount, or to the provision of a support that a claim relates to, "if the record is of a kind prescribed by the National Disability Insurance Scheme rules" (s45B(1)).
  2. How long. "The period of 7 years beginning on the day the claim is made", unless the rules prescribe a shorter period (s45B(2)).
  3. Other keepers. A participant who makes a claim keeps records for 3 years (s45B(5) and (6)). Anyone else who makes a claim and is neither a provider nor a participant keeps them for 5 years (s45B(7) and (8)).
  4. Language. The record must be in English, or be readily accessible and convertible into English (s45B(9)).
  5. Start date. Section 45B applies to claims made on or after the day it commenced (item 88 of the amending Act), which was 27 August 2026.
  6. Consequences. Failing to keep a required record is a civil penalty of 120 penalty units (s45B(3)). Separately, under the new s182(4), if you claimed and received an amount, didn't keep the record, and can't otherwise show you were entitled to it, an equal amount is a debt to the NDIA.

Two things are missing. The NDIS rules that prescribe which kinds of record are covered hadn't been made when we last checked, and nor had any rule setting a shorter period. So the code below treats every record linked to a claim as covered and uses the default periods. When the rules arrive, the change should be a filter on kind and a lookup table, not a rewrite.

The data model

The key design choice is that retention belongs to the link between a record and a claim, not to the record alone.

Data model for NDIS record retention: records such as shift notes, timesheets, service agreements and progress notes link many-to-many to claims, including re-claims; each claim has a claim day, which may be unknown when a plan manager made the claim; the keep-until date for a record is the latest period end across every linked claim made on or after 27 August 2026; records with no linked claim, or with a claim whose day is unknown, are kept

Three tables are enough:

  • records: one row per file or note, with its kind, where it lives, a SHA-256 hash taken when it was claimed, whether an English version exists, and a legal hold flag.
  • claims: one row per claim, including every re-claim of a rejected line, with the claim day and who made it.
  • record_claims: the many-to-many link.

A record's keep-until date is then the latest period end across all its linked claims. That one rule handles the awkward cases. A service agreement stays as long as the last claim made under it needs it. A rejected and re-claimed line is kept for 7 years from the re-claim, which is the advice in our original guide and the cautious reading, because the later claim is still a claim. And a record with no claim yet can't be dated at all, so it's kept.

The period length comes from who keeps the record, not who made the claim. A provider's records about a support that a plan manager claimed are still the provider's records under s45B(1)(b), so 7 years applies. The awkward part is that the 7 years start on the plan manager's claim day, which the provider may not know. Our code holds those records until a claim day is filled in, rather than guessing.

The date arithmetic

"A period of 7 years beginning on" a day includes that day. So a claim made on Friday 20 November 2026 starts a period whose last day is Saturday 19 November 2033, and the earliest day a record could go is the anniversary itself. If you'd rather keep the anniversary too, add a margin. The function below is the whole of the calendar logic.

The one trap is 29 February. Python's date.replace raises a ValueError for 29 February in a non-leap year, so we roll to 1 March, which makes the period end on 28 February. SQLite's date() modifiers happen to normalise the same way, which keeps the Python and SQL results in step.

The module

from dataclasses import dataclass, field
from datetime import date, timedelta
import hashlib
from pathlib import Path

S45B_FROM = date(2026, 8, 27)          # s45B applies to claims made on or after this day (item 88)
YEARS = {"provider": 7, "participant": 3, "other": 5}   # s45B(2), (6), (8): set by who keeps the record


def add_years(d: date, years: int) -> date:
    """Same day and month `years` later; 29 February rolls to 1 March."""
    try:
        return d.replace(year=d.year + years)
    except ValueError:
        return date(d.year + years, 3, 1)


def period_end(claim_day: date, years: int) -> date:
    """Last day of a period of `years` years beginning on `claim_day` (our reading)."""
    return add_years(claim_day, years) - timedelta(days=1)


@dataclass
class Claim:
    claim_id: str
    claimed_by: str          # "us", "plan manager", "participant"...
    claim_day: date | None   # None if someone else claimed and you don't know the day yet


@dataclass
class Record:
    record_id: str
    kind: str
    path: Path
    sha256_at_claim: str | None = None
    in_english: bool = True
    legal_hold: bool = False
    claims: list[Claim] = field(default_factory=list)


def keep_until(rec: Record, keeper: str = "provider") -> tuple[date | None, str]:
    """Latest period end across every claim the record backs."""
    if not rec.claims:
        return None, "no claim linked yet: keep"
    ends = []
    for c in rec.claims:
        if c.claim_day is None:
            return None, f"claim {c.claim_id} has no claim day: keep"
        if c.claim_day < S45B_FROM:
            continue                      # outside s45B; other rules may still apply
        ends.append(period_end(c.claim_day, YEARS[keeper]))
    if not ends:
        return None, "all claims before 27 Aug 2026: check other obligations"
    return max(ends), "ok"


def sha256(path: Path) -> str:
    h = hashlib.sha256()
    with open(path, "rb") as f:
        for block in iter(lambda: f.read(1 << 20), b""):
            h.update(block)
    return h.hexdigest()


def can_dispose(rec: Record, today: date, keeper: str = "provider",
                margin_days: int = 0) -> tuple[bool, list[str]]:
    reasons = []
    if rec.legal_hold:
        reasons.append("legal hold")
    end, why = keep_until(rec, keeper)
    if end is None:
        reasons.append(why)
    elif today <= end + timedelta(days=margin_days):
        reasons.append(f"keep until {end.isoformat()}")
    if not rec.in_english:
        reasons.append("no English version on file")
    if rec.sha256_at_claim and rec.path.exists() and sha256(rec.path) != rec.sha256_at_claim:
        reasons.append("file changed since claim: investigate before anything else")
    return (not reasons), reasons
Enter fullscreen mode Exit fullscreen mode

A few notes on the choices.

  • Unknown always means keep. Every path where the code can't work out a date returns None and a reason, and can_dispose treats that as a no. A retention job should fail closed.
  • Pre-27 August claims are skipped, not cleared. Section 45B doesn't reach them, but other obligations might, so the function says "check other obligations" instead of returning a date.
  • The hash is a tripwire. If a file's SHA-256 no longer matches the value taken at claim time, something edited it after the claim. That's not a reason to delete it. It's a reason to find out what happened, because altering or disposing of a required record with intent to defraud or to obstruct an audit or investigation is a separate offence under the new s59AE.
  • English is a check, not a translation. The flag just records whether an English version exists. For notes written in another language, the fix is a process, not code.

Tests

from datetime import date
from pathlib import Path
from retention import Claim, Record, keep_until, period_end, can_dispose, sha256

def test_period_end_basic():
    assert period_end(date(2026, 11, 20), 7) == date(2033, 11, 19)

def test_leap_day():
    assert period_end(date(2028, 2, 29), 7) == date(2035, 2, 28)

def test_reclaim_extends():
    r = Record("N1", "shift note", Path("n1.pdf"), claims=[
        Claim("C1", "us", date(2026, 12, 4)),
        Claim("C1-R", "us", date(2027, 1, 15))])   # rejected, claimed again
    assert keep_until(r) == (date(2034, 1, 14), "ok")

def test_unknown_claim_day_holds():
    r = Record("N2", "shift note", Path("n2.pdf"), claims=[Claim("PM7", "plan manager", None)])
    assert keep_until(r)[0] is None

def test_before_s45b():
    r = Record("N3", "timesheet", Path("t.csv"), claims=[Claim("C0", "us", date(2026, 8, 10))])
    assert keep_until(r)[0] is None

def test_changed_file_blocks(tmp_path):
    p = tmp_path / "a.txt"; p.write_text("original")
    r = Record("D1", "agreement", p, sha256_at_claim=sha256(p),
               claims=[Claim("C9", "us", date(2026, 9, 1))])
    p.write_text("edited")
    ok, why = can_dispose(r, date(2040, 1, 1))
    assert not ok and any("changed" in w for w in why)
Enter fullscreen mode Exit fullscreen mode

The re-claim test is the one worth reading twice. Claim C1 on 4 December 2026 would end on 3 December 2033. The re-claim on 15 January 2027 pushes the record to 14 January 2034, and max() is what makes that happen.

A worked report

Here are five invented records run through the module. R1 is a service agreement behind forty weekly claims from Monday 7 September 2026 to Monday 7 June 2027.

from datetime import date, timedelta
from pathlib import Path
from retention import Claim, Record, keep_until

weekly = [Claim(f"SA-{i:02d}", "us", date(2026, 9, 7) + timedelta(weeks=i)) for i in range(40)]
records = [
    Record("R1", "service agreement", Path("r1.pdf"), claims=weekly),
    Record("R2", "shift note", Path("r2.pdf"), claims=[
        Claim("C1", "us", date(2026, 12, 4)), Claim("C1-R", "us", date(2027, 1, 15))]),
    Record("R3", "shift note (plan-managed)", Path("r3.pdf"), claims=[Claim("PM-118", "plan manager", None)]),
    Record("R4", "timesheet", Path("r4.csv"), claims=[Claim("C0", "us", date(2026, 8, 10))]),
    Record("R5", "progress note", Path("r5.pdf")),
]
for r in records:
    end, why = keep_until(r)
    print(f"{r.record_id}  {r.kind:<27} claims={len(r.claims):<3} keep_until={end}  {why}")
Enter fullscreen mode Exit fullscreen mode
R1  service agreement           claims=40  keep_until=2034-06-06  ok
R2  shift note                  claims=2   keep_until=2034-01-14  ok
R3  shift note (plan-managed)   claims=1   keep_until=None  claim PM-118 has no claim day: keep
R4  timesheet                   claims=1   keep_until=None  all claims before 27 Aug 2026: check other obligations
R5  progress note               claims=0   keep_until=None  no claim linked yet: keep
Enter fullscreen mode Exit fullscreen mode

Example NDIS record retention report from the module: R1, a service agreement behind 40 weekly claims ending 7 June 2027, is kept until 6 June 2034; R2, a shift note claimed on 4 December 2026, rejected and claimed again on 15 January 2027, is kept until 14 January 2034; R3, a plan-managed shift note whose claim day is unknown, is kept until the day is known; R4, a timesheet claimed on 10 August 2026, is outside section 45B so other obligations need checking; and R5, a progress note with no claim yet, is kept

Notice that only two of the five get a date. That's normal. In a live system most of the work is filling in links and claim days, not computing dates.

The same rule in SQL

If your records already sit in a database, a view gives you the same answer without moving data around. This is SQLite; the date() modifiers do the year arithmetic.

CREATE VIEW record_keep_until AS
SELECT r.record_id,
       r.kind,
       r.legal_hold,
       COUNT(c.claim_id)                            AS s45b_claims,
       SUM(c.claim_id IS NOT NULL AND c.claim_day IS NULL) AS claims_without_day,
       MAX(date(c.claim_day, '+7 years', '-1 day')) AS keep_until
FROM records r
LEFT JOIN record_claims rc ON rc.record_id = r.record_id
LEFT JOIN claims c
       ON c.claim_id = rc.claim_id
      AND (c.claim_day IS NULL OR c.claim_day >= '2026-08-27')
GROUP BY r.record_id, r.kind, r.legal_hold;

-- Records that could be reviewed for disposal today
SELECT record_id, kind, keep_until
FROM record_keep_until
WHERE s45b_claims > 0
  AND claims_without_day = 0
  AND legal_hold = 0
  AND keep_until < date('now', 'localtime');
Enter fullscreen mode Exit fullscreen mode

Pre-27 August claims are filtered out in the join, so a record backed only by older claims shows zero s45B claims and falls out of the disposal list, the same as the Python version. We checked both against the same test rows, including a 29 February claim day, and they agree.

The disposal gate

Putting it together, nothing should be deleted unless every one of these is true.

Disposal gate for an NDIS record: the record is not on legal hold; every linked claim has a known claim day; today is after the keep-until date plus any margin you choose; an English version is on file; and the file's SHA-256 still matches the hash taken at claim time. If any check fails, keep the record and log the reason

Run it as a report first, not as a job that deletes things. A monthly list of "eligible for review" records that a person signs off is easier to defend than an automatic purge, and nothing claimed under s45B can be eligible before 27 August 2033 anyway. Until then, the useful output is the opposite list: records with no claim link, no claim day or a hash mismatch.

Where the hashes come from

The hash only helps if it's taken close to the claim. Two practical sources:

  • Your claim files. In Rostery's plan management module, each NDIA claim file is stored with a fingerprint, so a re-download is exactly what you lodged. Whatever system you use, hash the file you uploaded on the day you upload it.
  • Your exports. Rostery can produce a full data export of your account as a password-protected Excel workbook, and its own guidance says to download uploaded documents separately, from each record. That's a good moment to hash both: the workbook and every document beside it.

And for the question a hash can't answer, which is who changed a record and when, the activity log shows who did what and when, and exports up to the newest 20,000 matching entries to CSV. Note that it never stores the contents of health and personal records, so it proves the change, not what the note said.

What we'd add next

  • A kind filter and a period lookup table, ready for the NDIS rules when they're made.
  • A job that asks plan managers for claim days, or reads them from whatever they send back, so plan-managed records stop sitting in the "unknown" pile.
  • A yearly restore test: pick five records at random, open them from the backup, and compare hashes.

If you're working on the claiming side, our earlier dev.to post on modelling the NDIS 90-day claim limit in Python uses the same approach for deadlines.

Sources

  • National Disability Insurance Scheme Amendment (Securing the NDIS for Future Generations) Act 2026 (No. 66, 2026), as made: section 2 (commencement table, item 7) and Schedule 2, Part 4 (items 83, 86 and 88: new s45B, new s182(4) and the application rule) and Part 9 (new s59AE). Read on the Federal Register of Legislation, 18 November 2026.
  • Rostery, NDIS record keeping 2026: keep claim records for 7 years, checked by Rostery 13 November 2026.
  • No NDIS rules prescribing kinds of records, or a shorter period, had been made when we last checked. All names, records and dates in the examples are invented.

Top comments (1)

Collapse
 
alexshev profile image
Alex Shev •

The many-to-many record-to-claim link is the key modelling choice here. It keeps the retention decision explainable when a record supports re-claims, while the “unknown means keep” default prevents date arithmetic from turning incomplete operational data into an accidental disposal rule. I’d also store the policy/rule version used for each disposal decision so historical outcomes remain auditable after the rules change.