Validate¶
import laterite
# Validate a file. read(...).validate() returns the Ags4File (so it chains);
# the Report is on the .report property.
ags = laterite.read("examples/sample_site.ags").validate()
r = ags.report
print(
f"is_valid={r.is_valid} count={r.count} "
f"dict_version={r.dict_version!r} resolution={r.resolution!r}"
)
assert r.is_valid is True
assert r.count == 0
assert r.dict_version == "4.1.1" # auto-selected from TRAN_AGS
read(path).validate() runs the numbered-rules engine and hands back the
Ags4File — so it chains. The verdict itself rides on .report:
is_valid and count are the headline, while dict_version and resolution
tell you which AGS edition the rules came from.
The edition selects itself
You never pass an edition. dict_version is read straight from the file's
TRAN_AGS field; resolution='exact' means that edition was matched
on the nose (otherwise laterite falls back to the nearest dictionary it
ships). Here the file declared 4.1, so the 4.1.1 rules ran.
Because .validate() returns the file, you keep going on the same handle —
query it, slice a group, or emit it — without re-reading from disk.
Next → Query across groups