A subdivision plan as rows: the schema (layers, figures, rings, vertices, street sections, norms with their public source, claims, checks, renders), the pure parse of a plan page into those rows, the pure checks that decide a verdict from a measured value and a stored parameter, and the SVG rendering of the drawings from rows. The database it owns is the plan's own; the writers are in this crate's repo module.
| Tier | domain |
| Role | bounded_context |
| Path | crates/domain/subdivision-plan |
| Edition | 2021 |
| Targets | domain_subdivision_plan, checks_live, ingest_live |
| Public items | 143 across 11 modules |
| Tests | 34 |
What it is for
A subdivision plan as rows.
The page this crate was drawn from carried every number as text and every drawing as a path in a script. Here the geometry is vertices, a norm is a parameter that names the public document and clause it came from, the page's statements are claims, and a check is a row holding a measured value, a required value and a verdict. The drawings and the page are rendered from the rows, never the other way round.
artifact: the pure parse of the page into the things the rows hold.checks: the decidable part of a check, with no database in sight.sources: the documents the page cites and the parameters it takes from them, as seeds.repo: the writers and readers over the plan's own database.evaluate: the check runner -- read rows, measure, compare, write check rows.MIGRATIONS: the schema, applied into the plan's own database byrepo::migrate.
Capabilities
crate root
A subdivision plan as rows.
| Item |
|---|
pub const MIGRATIONS: & (& str, & str) |
artifact (other)
The pure parse of a plan page into the things the rows hold.
| Item |
|---|
pub const MAX_INPUT_BYTES: usize |
fn parse(html : & str) -> Result <Artifact, ArtifactError> |
fn js_literal_to_json(js : & str) -> String |
fn clean_text(html : & str) -> String |
fn cell_value(text : & str) -> Option <Decimal> |
fn numbers(text : & str) -> Vec <Decimal> |
fn first_number(text : & str) -> Option <Decimal> |
Artifact
The pure parse of a plan page into the things the rows hold.
| Item |
|---|
pub struct Artifact |
ArtifactError
The pure parse of a plan page into the things the rows hold.
| Item |
|---|
pub enum ArtifactError |
ProseBlock
The pure parse of a plan page into the things the rows hold.
| Item |
|---|
pub struct ProseBlock |
SectionDef
The pure parse of a plan page into the things the rows hold.
| Item |
|---|
pub struct SectionDef |
Table
The pure parse of a plan page into the things the rows hold.
| Item |
|---|
pub struct Table |
cad_layers (other)
The plan's layer areas derived from the drawing file alone.
| Item |
|---|
pub const LOTS: & str |
pub const MULTI: & str |
pub const COMMERCIAL: & str |
pub const GREEN: & str |
pub const PLANT: & str |
pub const CYCLE: & str |
pub const SIDEWALK: & str |
pub const SITE: & str |
fn derive(cad : & FigureRow, arcs : Arcs) -> Option <Derived> |
Arcs
The plan's layer areas derived from the drawing file alone.
| Item |
|---|
pub enum Arcs |
fn polygon_points(v : & Vertex, arcs : Arcs) -> Vec <(f64, f64)> |
fn layer_region(cad : & FigureRow, layer : & str, min_area : f64, arcs : Arcs) ->(Region, usize) |
fn site_region(cad : & FigureRow, arcs : Arcs) -> Option <Region> |
Derived
The plan's layer areas derived from the drawing file alone.
| Item |
|---|
pub struct Derived |
Derived :: fn privativa(& self) -> f64 |
Derived :: fn roads(& self) -> f64 |
Derived :: fn tiling_gap(& self) -> f64 |
Derived :: fn raw_of(& self, layer : & str) -> Option <f64> |
checks (other)
The decidable part of a check: a measured value, a required value, a comparator, a tolerance
| Item |
|---|
fn compare(measured : Option <f64>, required : Option <f64>, comparator : Comparator, tolerance : f64, evidence : Evidence,) -> Outcome |
fn mean(values : & f64) -> Option <f64> |
fn parts_sum_difference(parts : & f64, width : f64) -> f64 |
fn parts_over(parts : & (String, f64, String), kind : & str, maximum : f64) -> Vec <(usize, f64)> |
fn dwellings(lots : u32, buildings : u32, per_level : u32, levels : u32) -> u32 |
fn density_per_ha(dwellings : u32, site_m2 : f64) -> f64 |
Comparator
The decidable part of a check: a measured value, a required value, a comparator, a tolerance
| Item |
|---|
pub enum Comparator |
Comparator :: fn as_str(self) -> & 'static str |
Comparator :: fn parse(s : & str) -> Option <Self> |
Evidence
The decidable part of a check: a measured value, a required value, a comparator, a tolerance
| Item |
|---|
pub enum Evidence |
Outcome
The decidable part of a check: a measured value, a required value, a comparator, a tolerance
| Item |
|---|
pub struct Outcome |
ShortLot
The decidable part of a check: a measured value, a required value, a comparator, a tolerance
| Item |
|---|
pub struct ShortLot |
fn short_lots(lots : & (i32, f64), minimum : f64) ->(Vec <ShortLot>, f64) |
Verdict
The decidable part of a check: a measured value, a required value, a comparator, a tolerance
| Item |
|---|
pub enum Verdict |
Verdict :: fn as_str(self) -> & 'static str |
dxf (other)
The drawing file, read into figures.
| Item |
|---|
pub const MAX_DXF_BYTES: usize |
fn parse(text : & str) -> Result <Drawing, DxfError> |
fn arc_points(p :(f64, f64), q :(f64, f64), b : f64, segments : usize) -> Vec <(f64, f64)> |
fn place(block : & Block, insert : & Shape, insert_ordinal : usize) -> Vec <Entity> |
fn resolved(d : & Drawing) -> Vec <Entity> |
Block
The drawing file, read into figures.
| Item |
|---|
pub struct Block |
Drawing
The drawing file, read into figures.
| Item |
|---|
pub struct Drawing |
DxfError
The drawing file, read into figures.
| Item |
|---|
pub enum DxfError |
Entity
The drawing file, read into figures.
| Item |
|---|
pub struct Entity |
Shape
The drawing file, read into figures.
| Item |
|---|
pub enum Shape |
Vertex
The drawing file, read into figures.
| Item |
|---|
pub struct Vertex |
fn polyline_signed_area(vertices : & Vertex) -> f64 |
fn ring_of(vertices : & Vertex) -> Ring |
Evaluation
The check runner: read the rows, measure, compare, write measurement and check rows.
| Item |
|---|
pub struct Evaluation |
Evaluation :: fn count(& self, verdict : Verdict) -> usize |
async fn run(pool : & PgPool) -> Result <Evaluation, RepoError> |
export (other)
The page, written from rows.
| Item |
|---|
pub const SLOT_KINDS: & str; 13 |
pub const STYLE_SECTION: & str |
pub const MAST_SECTION: & str |
pub const FOOTER_SECTION: & str |
fn table_html(claims : & ClaimRow, table : i32) -> String |
fn page_html(title : & str, prose : & ProseRow, claims : & ClaimRow, renders : & (String, String), analysis : & str,) -> String |
frames (other)
Two frames of the same plan, and the rigid transform between them.
| Item |
|---|
fn centroid_f64(ring : & Ring) ->(f64, f64) |
fn nearest(point :(f64, f64), to : & (f64, f64)) -> Option <(usize, f64)> |
Transform
Two frames of the same plan, and the rigid transform between them.
| Item |
|---|
pub struct Transform |
Transform :: fn apply(& self,(x, y) :(f64, f64)) ->(f64, f64) |
Transform :: fn mirrored(& self) -> bool |
fn fit_polygon(from : & (f64, f64), to : & (f64, f64), mirror : bool,) -> Option <(Transform, f64)> |
provenance (other)
Where each row came from, and the tests that prove it.
| Item |
|---|
fn tests_in(source : & str) -> Vec <(String, String)> |
fn parse_cargo_test_output(output : & str) -> Vec <(String, String)> |
Origin
Where each row came from, and the tests that prove it.
| Item |
|---|
pub enum Origin |
Origin :: fn as_str(self) -> & 'static str |
pub const ORIGINS: & TableOrigin |
TableOrigin
Where each row came from, and the tests that prove it.
| Item |
|---|
pub struct TableOrigin |
TestCase
Where each row came from, and the tests that prove it.
| Item |
|---|
pub struct TestCase |
fn tests_catalog() -> Vec <TestCase> |
fn analysis_html(counts : & (String, i64), outcomes : & (String, String, String), catalog : & TestCase,) -> String |
render (other)
The drawings, written from rows.
| Item |
|---|
pub const TOKENS: & (& str, & str) |
fn v(token : & str) -> String |
fn d_of(f : & FigureRow) -> String |
fn plan_svg(figs : & FigureRow, vbw : f64, vbh : f64) -> String |
fn block_svg(block : & FigureRow, w : f64, h : f64, caption : & str) -> String |
fn section_svg(sec : & SectionRow, px : f64) -> String |
fn iso_scene(figs : & FigureRow, levels : u32) -> String |
fn iso_svg(figs : & FigureRow, levels : u32, vb : f64; 4) -> String |
Inputs
The drawings, written from rows.
| Item |
|---|
pub struct Inputs |
fn inputs_from_rows(figs : Vec <FigureRow>, sections : Vec <SectionRow>, claims : & crate::repo::ClaimRow,) -> Result <Inputs, String> |
fn all_renders(i : & Inputs) -> Vec <(String, String)> |
Sheet
The drawings, written from rows.
| Item |
|---|
pub enum Sheet |
Sheet :: fn kind(self) -> & 'static str |
Sheet :: fn title(self) -> & 'static str |
fn sheet_svg(figs : & FigureRow, vbw : f64, vbh : f64, sheet : Sheet) -> String |
verb:connect
The writers and readers over the plan's own database.
| Item |
|---|
async fn connect(url : & str) -> Result <PgPool, sqlx::Error> |
verb:constants
The writers and readers over the plan's own database.
| Item |
|---|
pub const LAYERS: & (& str, & str, i32) |
verb:figures
The writers and readers over the plan's own database.
| Item |
|---|
fn figures_of(a : & Artifact) -> Result <Vec <NewFigure>, RepoError> |
verb:ingest
The writers and readers over the plan's own database.
| Item |
|---|
async fn ingest(pool : & PgPool, a : & Artifact) -> Result <IngestReport, RepoError> |
async fn ingest_dxf(pool : & PgPool, d : & crate::dxf::Drawing, sha256 : & str, byte_count : i64,) -> Result <IngestReport, RepoError> |
verb:latest
The writers and readers over the plan's own database.
| Item |
|---|
async fn latest_test_results(pool : & PgPool,) -> Result <Vec <(String, String, String)>, sqlx::Error> |
verb:layer
The writers and readers over the plan's own database.
| Item |
|---|
async fn layer_areas(pool : & PgPool) -> Result <Vec <(String, Decimal)>, sqlx::Error> |
verb:lot
The writers and readers over the plan's own database.
| Item |
|---|
async fn lot_areas(pool : & PgPool) -> Result <Vec <(i32, Decimal)>, sqlx::Error> |
verb:measurements
The writers and readers over the plan's own database.
| Item |
|---|
async fn measurements(pool : & PgPool,) -> Result <Vec <(String, Decimal, Option <String>, String)>, sqlx::Error> |
verb:migrate
The writers and readers over the plan's own database.
| Item |
|---|
async fn migrate(pool : & PgPool) -> Result <usize, sqlx::Error> |
verb:move
The writers and readers over the plan's own database.
| Item |
|---|
async fn move_vertex(pool : & PgPool, figure_id : Uuid, ring_ordinal : i32, vertex_ordinal : i32, x : Decimal, y : Decimal,) -> Result <bool, sqlx::Error> |
verb:origin
The writers and readers over the plan's own database.
| Item |
|---|
async fn origin_counts(pool : & PgPool) -> Result <Vec <(String, i64)>, sqlx::Error> |
verb:record
The writers and readers over the plan's own database.
| Item |
|---|
async fn record_fetch(pool : & PgPool, code : & str, http_status : Option <i32>, sha256 : Option <& str>, byte_count : Option <i64>, reason : Option <& str>,) -> Result <(), sqlx::Error> |
async fn record_test_run(pool : & PgPool, command : & str, started_at : chrono::DateTime <chrono::Utc>, exit_code : Option <i32>, output_bytes : i32, results : & (String, String),) -> Result <Uuid, sqlx::Error> |
verb:renders
The writers and readers over the plan's own database.
| Item |
|---|
async fn renders(pool : & PgPool) -> Result <Vec <(String, String, String)>, sqlx::Error> |
verb:seed
The writers and readers over the plan's own database.
| Item |
|---|
async fn seed_sources(pool : & PgPool, sources : & SourceSeed, norms : & NormSeed,) -> Result <(usize, usize), sqlx::Error> |
verb:upsert
The writers and readers over the plan's own database.
| Item |
|---|
async fn upsert_measurement(pool : & PgPool, key : & str, value : Decimal, unit : Option <& str>, method : & str,) -> Result <(), sqlx::Error> |
async fn upsert_render(pool : & PgPool, kind : & str, svg : & str) -> Result <String, sqlx::Error> |
CheckRowOut
The writers and readers over the plan's own database.
| Item |
|---|
pub struct CheckRowOut |
async fn upsert_check(pool : & PgPool, c : & CheckRowOut) -> Result <(), sqlx::Error> |
async fn checks(pool : & PgPool) -> Result <Vec <CheckRowOut>, sqlx::Error> |
ClaimRow
The writers and readers over the plan's own database.
| Item |
|---|
fn claims_of(a : & Artifact) -> Vec <ClaimRow> |
pub struct ClaimRow |
async fn claims(pool : & PgPool) -> Result <Vec <ClaimRow>, sqlx::Error> |
FigureRow
The writers and readers over the plan's own database.
| Item |
|---|
pub struct FigureRow |
FigureRow :: fn cad_vertices(& self) -> Vec <crate::dxf::Vertex> |
async fn figures(pool : & PgPool, frame : & str) -> Result <Vec <FigureRow>, sqlx::Error> |
IngestReport
The writers and readers over the plan's own database.
| Item |
|---|
pub struct IngestReport |
NewFigure
The writers and readers over the plan's own database.
| Item |
|---|
pub struct NewFigure |
NewFigure :: fn into_row(self) -> FigureRow |
fn cad_figures_of(d : & crate::dxf::Drawing) -> Vec <NewFigure> |
NormRow
The writers and readers over the plan's own database.
| Item |
|---|
pub struct NormRow |
async fn norms(pool : & PgPool) -> Result <Vec <NormRow>, sqlx::Error> |
ProseRow
The writers and readers over the plan's own database.
| Item |
|---|
pub struct ProseRow |
async fn prose(pool : & PgPool) -> Result <Vec <ProseRow>, sqlx::Error> |
RepoError
The writers and readers over the plan's own database.
| Item |
|---|
pub enum RepoError |
SectionDef
The pure parse of a plan page into the things the rows hold.
| Item |
|---|
SectionDef :: fn into_row(self) -> SectionRow |
SectionRow
The writers and readers over the plan's own database.
| Item |
|---|
pub struct SectionRow |
async fn sections(pool : & PgPool) -> Result <Vec <SectionRow>, sqlx::Error> |
SourceRow
The writers and readers over the plan's own database.
| Item |
|---|
pub struct SourceRow |
async fn sources(pool : & PgPool) -> Result <Vec <SourceRow>, sqlx::Error> |
NormSeed
The documents the page cites and the parameters it takes from them, as seed rows.
| Item |
|---|
pub struct NormSeed |
pub const NORMS: & NormSeed |
SourceSeed
The documents the page cites and the parameters it takes from them, as seed rows.
| Item |
|---|
pub struct SourceSeed |
pub const SOURCES: & SourceSeed |
How to use it
No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.
Module structure
domain_subdivision_plan
artifactcad_layerschecksdxfevaluateexportframesprovenancerenderreposources
flowchart TD n_domain_subdivision_plan["domain_subdivision_plan"] n_domain_subdivision_plan --> n_artifact["artifact"] n_domain_subdivision_plan --> n_cad_layers["cad_layers"] n_domain_subdivision_plan --> n_checks["checks"] n_domain_subdivision_plan --> n_dxf["dxf"] n_domain_subdivision_plan --> n_evaluate["evaluate"] n_domain_subdivision_plan --> n_export["export"] n_domain_subdivision_plan --> n_frames["frames"] n_domain_subdivision_plan --> n_provenance["provenance"] n_domain_subdivision_plan --> n_render["render"] n_domain_subdivision_plan --> n_repo["repo"] n_domain_subdivision_plan --> n_sources["sources"]
Public surface
`crate root`
| Item | What it is |
|---|---|
pub const MIGRATIONS: & (& str, & str) | The schema this crate owns |
`artifact`
| Item | What it is |
|---|---|
pub const MAX_INPUT_BYTES: usize | The page's own limit: the artifact is a few hundred kilobytes; anything past this is not it. |
pub enum ArtifactError | — |
pub struct SectionDef | One street section as the page defines it: a name, a width, a class line and its parts. |
pub struct Table | One table: where it sits, what it is captioned, its header row and its body rows, cells as text with tags removed and whitespace collapsed. |
pub struct ProseBlock | One section of prose with its drawings, tables and scripts replaced by slot comments (<!-- slot:svg:3 -->, <!-- slot:table:1 -->) so the export can put the renders back. |
pub struct Artifact | — |
fn parse(html : & str) -> Result <Artifact, ArtifactError> | Parse the page. |
fn js_literal_to_json(js : & str) -> String | Quote the bare keys of a JavaScript object literal so serde_json can read it |
fn clean_text(html : & str) -> String | Tags become a space, entities are decoded, whitespace collapses to one space. |
fn cell_value(text : & str) -> Option <Decimal> | The number a table cell states, when the whole cell is one number with at most a unit after it: 19,800.06 → 19800.06, 66% → 66, 12.00 m → 12.00 |
fn numbers(text : & str) -> Vec <Decimal> | Every number in a text, in order, thousands separators removed: 12,110 m² 65% de lo permitido → 12110, 65, ≥ 12.00 m → 12.00, 24.31 × 22.61 m → 24.31, 22.61. |
fn first_number(text : & str) -> Option <Decimal> | The first number in a text; None when there is none. |
`cad_layers`
| Item | What it is |
|---|---|
pub const LOTS: & str | The drawing's layers, in the order the page resolves their overlaps |
pub const MULTI: & str | — |
pub const COMMERCIAL: & str | — |
pub const GREEN: & str | — |
pub const PLANT: & str | — |
pub const CYCLE: & str | — |
pub const SIDEWALK: & str | — |
pub const SITE: & str | — |
pub enum Arcs | Whether an arc is expanded into chords or taken as its chord. |
pub struct Derived | One area per layer after the order is applied, plus the site and the remainder. |
Derived :: fn privativa(& self) -> f64 | — |
Derived :: fn roads(& self) -> f64 | — |
Derived :: fn tiling_gap(& self) -> f64 | The parts against the whole: zero when the order tiled the site exactly. |
Derived :: fn raw_of(& self, layer : & str) -> Option <f64> | — |
fn polygon_points(v : & Vertex, arcs : Arcs) -> Vec <(f64, f64)> | A polyline as points: with Arcs::Expanded, each arc becomes chords at half-degree steps (at least eight); with Arcs::AsChords, each arc is its chord. |
fn layer_region(cad : & FigureRow, layer : & str, min_area : f64, arcs : Arcs) ->(Region, usize) | Every polyline on layer with at least three vertices, closed as drawn or closed here, as one region; polygons under min_area (construction marks) are left out. |
fn site_region(cad : & FigureRow, arcs : Arcs) -> Option <Region> | The largest polygon on the site layer. |
fn derive(cad : & FigureRow, arcs : Arcs) -> Option <Derived> | Apply the order |
`checks`
| Item | What it is |
|---|---|
pub enum Comparator | — |
Comparator :: fn as_str(self) -> & 'static str | — |
Comparator :: fn parse(s : & str) -> Option <Self> | — |
pub enum Verdict | — |
Verdict :: fn as_str(self) -> & 'static str | — |
pub enum Evidence | Whether the parameter a check compares against rests on a fetched document. |
pub struct Outcome | — |
fn compare(measured : Option <f64>, required : Option <f64>, comparator : Comparator, tolerance : f64, evidence : Evidence,) -> Outcome | Decide one check |
pub struct ShortLot | A lot that falls short of a minimum area, with how far short. |
fn short_lots(lots : & (i32, f64), minimum : f64) ->(Vec <ShortLot>, f64) | The lots below minimum, smallest first, and the total deficit. |
fn mean(values : & f64) -> Option <f64> | Mean of a list of areas; None for an empty list. |
fn parts_sum_difference(parts : & f64, width : f64) -> f64 | How far the parts of a section are from its declared width. |
fn parts_over(parts : & (String, f64, String), kind : & str, maximum : f64) -> Vec <(usize, f64)> | Parts of a given kind wider than maximum, as (ordinal, width). |
fn dwellings(lots : u32, buildings : u32, per_level : u32, levels : u32) -> u32 | Dwellings in the plan: the single-family lots plus the buildings times dwellings per level times levels. |
fn density_per_ha(dwellings : u32, site_m2 : f64) -> f64 | Dwellings per hectare from a site area in square metres. |
`dxf`
| Item | What it is |
|---|---|
pub const MAX_DXF_BYTES: usize | A drawing file is a few megabytes at most. |
pub enum DxfError | — |
pub struct Vertex | One vertex of a polyline with the bulge of the segment that starts at it. |
pub enum Shape | — |
pub struct Entity | One entity, with the layer it sits on and, for a polyline placed by an INSERT, which one. |
pub struct Block | — |
pub struct Drawing | — |
fn parse(text : & str) -> Result <Drawing, DxfError> | Parse the file. |
fn polyline_signed_area(vertices : & Vertex) -> f64 | Signed area of a polyline with bulges: the chord polygon's shoelace plus each arc's circular segment, signed by the bulge |
fn ring_of(vertices : & Vertex) -> Ring | The vertices as a ring (chords only), for storage and for the chord-polygon area the SQL views compute. |
fn arc_points(p :(f64, f64), q :(f64, f64), b : f64, segments : usize) -> Vec <(f64, f64)> | The arc from p to q with bulge b, as segments chords |
fn place(block : & Block, insert : & Shape, insert_ordinal : usize) -> Vec <Entity> | Place a block's entities at an INSERT: scale, rotate, translate, base point subtracted. |
fn resolved(d : & Drawing) -> Vec <Entity> | Every top-level entity plus the entities each INSERT places, in file order. |
`evaluate`
| Item | What it is |
|---|---|
pub struct Evaluation | — |
Evaluation :: fn count(& self, verdict : Verdict) -> usize | — |
async fn run(pool : & PgPool) -> Result <Evaluation, RepoError> | Read the rows, run every check, and write the measurement and check rows. |
`export`
| Item | What it is |
|---|---|
pub const SLOT_KINDS: & str; 13 | The render kind that fills each drawing slot, in the order the page shows them. |
pub const STYLE_SECTION: & str | Sections that are not body sections: the page's own stylesheet, masthead and footer. |
pub const MAST_SECTION: & str | — |
pub const FOOTER_SECTION: & str | — |
fn table_html(claims : & ClaimRow, table : i32) -> String | One table from its claim rows: caption, header cells (row -1) and body cells, numeric cells carrying the page's n class. |
fn page_html(title : & str, prose : & ProseRow, claims : & ClaimRow, renders : & (String, String), analysis : & str,) -> String | The whole page |
`frames`
| Item | What it is |
|---|---|
pub struct Transform | x' = a x + b y + tx, y' = c x + d y + ty, with a b; c d orthogonal. |
Transform :: fn apply(& self,(x, y) :(f64, f64)) ->(f64, f64) | — |
Transform :: fn mirrored(& self) -> bool | — |
fn fit_polygon(from : & (f64, f64), to : & (f64, f64), mirror : bool,) -> Option <(Transform, f64)> | Fit from to to where both are the same polygon's corners in some rotation and either orientation: every cyclic shift and both directions are tried and the fit with the smallest worst-corner residual wins |
fn centroid_f64(ring : & Ring) ->(f64, f64) | — |
fn nearest(point :(f64, f64), to : & (f64, f64)) -> Option <(usize, f64)> | For each from point (already transformed), the index of the nearest to point and the distance; None when to is empty. |
`provenance`
| Item | What it is |
|---|---|
pub enum Origin | How a table's rows came to be. |
Origin :: fn as_str(self) -> & 'static str | — |
pub struct TableOrigin | One table, its origin, and what that means for a reader of the exported page. |
pub const ORIGINS: & TableOrigin | The origin of every table the exported page draws on. |
pub struct TestCase | One test, as written. |
fn tests_in(source : & str) -> Vec <(String, String)> | Every #test or #tokio::test function in source: the attribute line, the signature and the body up to the closing brace at the attribute's indentation. |
fn tests_catalog() -> Vec <TestCase> | The catalog: every test in these crates, in file order. |
fn parse_cargo_test_output(output : & str) -> Vec <(String, String)> | The `test <name> .. |
fn analysis_html(counts : & (String, i64), outcomes : & (String, String, String), catalog : & TestCase,) -> String | The analysis section of the exported page: the origins with their counts, then every test with its last recorded outcome and its source |
`render`
| Item | What it is |
|---|---|
pub const TOKENS: & (& str, & str) | The page's colour tokens, light theme. |
fn v(token : & str) -> String | var(--token, #hex). |
fn d_of(f : & FigureRow) -> String | The d a figure draws with: its source text while current, else its vertices. |
fn plan_svg(figs : & FigureRow, vbw : f64, vbh : f64) -> String | The plan: every layer in overlap order, the lots, the buildings, the roundabout, the site outline, the dimensions, the north arrow and the scale bar. |
pub enum Sheet | The four thematic sheets. |
Sheet :: fn kind(self) -> & 'static str | — |
Sheet :: fn title(self) -> & 'static str | — |
fn sheet_svg(figs : & FigureRow, vbw : f64, vbh : f64, sheet : Sheet) -> String | — |
fn block_svg(block : & FigureRow, w : f64, h : f64, caption : & str) -> String | The building's floor plan: the block's paths with a caption under it. |
fn section_svg(sec : & SectionRow, px : f64) -> String | A street cross-section: one band per part, trees on the green bands, a house on a lot band, dimension lines and figures under each band, the pavement line. |
fn iso_scene(figs : & FigureRow, levels : u32) -> String | The scene at levels storeys for the buildings, from the isometric-frame figures. |
fn iso_svg(figs : & FigureRow, levels : u32, vb : f64; 4) -> String | The isometric SVG over a viewBox x, y, w, h. |
pub struct Inputs | Everything the renderer needs, read from rows by the caller. |
fn inputs_from_rows(figs : Vec <FigureRow>, sections : Vec <SectionRow>, claims : & crate::repo::ClaimRow,) -> Result <Inputs, String> | Build the inputs from rows: figures of every frame, the sections, and the geometry claims (geo.vbw, geo.vbh, blk.w, blk.h, ren.vb, ren.win, the block caption's cells). |
fn all_renders(i : & Inputs) -> Vec <(String, String)> | Every drawing, as (kind, svg), in the order the page shows them. |
`repo`
| Item | What it is |
|---|---|
pub enum RepoError | — |
async fn connect(url : & str) -> Result <PgPool, sqlx::Error> | — |
async fn migrate(pool : & PgPool) -> Result <usize, sqlx::Error> | Apply every migration not yet recorded in schema_migration |
pub struct IngestReport | — |
pub const LAYERS: & (& str, & str, i32) | The layers, in the overlap priority the page states. |
pub struct NewFigure | One figure as the artifact defines it, before it has a row |
NewFigure :: fn into_row(self) -> FigureRow | The row form, for renders built without a database. |
fn figures_of(a : & Artifact) -> Result <Vec <NewFigure>, RepoError> | Every figure the artifact defines: the plan frame (layer paths, lots, buildings, roundabout, labels), the building block, and the isometric frame (rings and trees) |
fn claims_of(a : & Artifact) -> Vec <ClaimRow> | Every claim the artifact makes: the geometry facts that are not figures (geo.vbw, geo.vbh, blk.w, blk.h, ren.win, ren.vb), the areas object, and every table cell (the header row is row -1, the caption has no row) |
async fn ingest(pool : & PgPool, a : & Artifact) -> Result <IngestReport, RepoError> | Replace the plan rows with what the artifact holds |
async fn seed_sources(pool : & PgPool, sources : & SourceSeed, norms : & NormSeed,) -> Result <(usize, usize), sqlx::Error> | Seed the cited documents and the parameters taken from them |
async fn record_fetch(pool : & PgPool, code : & str, http_status : Option <i32>, sha256 : Option <& str>, byte_count : Option <i64>, reason : Option <& str>,) -> Result <(), sqlx::Error> | Record what a fetch of a source returned. |
pub struct SourceRow | — |
async fn sources(pool : & PgPool) -> Result <Vec <SourceRow>, sqlx::Error> | — |
pub struct NormRow | — |
async fn norms(pool : & PgPool) -> Result <Vec <NormRow>, sqlx::Error> | — |
async fn layer_areas(pool : & PgPool) -> Result <Vec <(String, Decimal)>, sqlx::Error> | Each plan-frame layer's area from the vertices, by layer code. |
async fn lot_areas(pool : & PgPool) -> Result <Vec <(i32, Decimal)>, sqlx::Error> | Each single-family lot's area from its vertices, by ordinal. |
pub struct FigureRow | — |
FigureRow :: fn cad_vertices(& self) -> Vec <crate::dxf::Vertex> | The figure's first ring as drawing-file vertices, bulges attached. |
async fn figures(pool : & PgPool, frame : & str) -> Result <Vec <FigureRow>, sqlx::Error> | Every figure of a frame, rings and vertices attached, in (kind, ordinal) order. |
pub struct SectionRow | — |
SectionDef :: fn into_row(self) -> SectionRow | The row form, for renders built without a database. |
async fn sections(pool : & PgPool) -> Result <Vec <SectionRow>, sqlx::Error> | — |
pub struct ClaimRow | — |
async fn claims(pool : & PgPool) -> Result <Vec <ClaimRow>, sqlx::Error> | — |
pub struct ProseRow | — |
async fn prose(pool : & PgPool) -> Result <Vec <ProseRow>, sqlx::Error> | — |
pub struct CheckRowOut | — |
async fn upsert_check(pool : & PgPool, c : & CheckRowOut) -> Result <(), sqlx::Error> | — |
async fn checks(pool : & PgPool) -> Result <Vec <CheckRowOut>, sqlx::Error> | — |
async fn upsert_measurement(pool : & PgPool, key : & str, value : Decimal, unit : Option <& str>, method : & str,) -> Result <(), sqlx::Error> | — |
async fn measurements(pool : & PgPool,) -> Result <Vec <(String, Decimal, Option <String>, String)>, sqlx::Error> | — |
async fn upsert_render(pool : & PgPool, kind : & str, svg : & str) -> Result <String, sqlx::Error> | — |
async fn renders(pool : & PgPool) -> Result <Vec <(String, String, String)>, sqlx::Error> | — |
async fn move_vertex(pool : & PgPool, figure_id : Uuid, ring_ordinal : i32, vertex_ordinal : i32, x : Decimal, y : Decimal,) -> Result <bool, sqlx::Error> | Move one vertex |
fn cad_figures_of(d : & crate::dxf::Drawing) -> Vec <NewFigure> | Every figure the drawing file defines, in frame cad: top-level entities and the ones each INSERT places, each carrying its DXF layer; polylines keep their bulges |
async fn ingest_dxf(pool : & PgPool, d : & crate::dxf::Drawing, sha256 : & str, byte_count : i64,) -> Result <IngestReport, RepoError> | Replace the cad frame with the drawing file's figures and mark the cad source row as fetched with the file's sha256. |
async fn record_test_run(pool : & PgPool, command : & str, started_at : chrono::DateTime <chrono::Utc>, exit_code : Option <i32>, output_bytes : i32, results : & (String, String),) -> Result <Uuid, sqlx::Error> | Record one run of the crates' tests: the command, when it ran, its exit code, and each named test's outcome. |
async fn latest_test_results(pool : & PgPool,) -> Result <Vec <(String, String, String)>, sqlx::Error> | Each test's latest recorded outcome: (name, outcome, finished_at as RFC 3339). |
async fn origin_counts(pool : & PgPool) -> Result <Vec <(String, i64)>, sqlx::Error> | The row count behind each table origin the analysis page lists. |
`sources`
| Item | What it is |
|---|---|
pub struct SourceSeed | A document row to seed |
pub struct NormSeed | One parameter a source fixes. |
pub const SOURCES: & SourceSeed | — |
pub const NORMS: & NormSeed | — |
Re-exports. Exported here, defined elsewhere.
| Export | Defined in |
|---|---|
sha256_hex | foundation_audit_log::hash::sha256_hex |
Boundary
Reaches into foundation.
Shares tier domain with 43 other crates: domain-agreements, domain-ai-report, domain-billing, domain-catalog, domain-classify, domain-comments, domain-competitive-intel, domain-contact, … (43 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | domain |
| Architectural role (taxonomy) | bounded_context |
| Location | crates/domain/subdivision-plan |
| Vocabulary in force (lexicon) | current |
Tier flow. Which tiers this crate's own edges cross.
flowchart LR n_domain["domain"] --> n_foundation["foundation"]
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `foundation-audit-log` | foundation | no | always |
| `foundation-planar-geometry` | foundation | no | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
chrono | ^0.4 | serde | no | always |
rust_decimal | ^1 | serde | no | always |
serde | ^1 | derive, derive | no | always |
serde_json | ^1 | — | no | always |
sqlx | ^0.8 | runtime-tokio, postgres, chrono, uuid, json, rust_decimal | no | always |
thiserror | ^2 | — | no | always |
uuid | ^1 | v4, v7, serde, js | no | always |
Development, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
rust_decimal_macros | ^1 | — | no | always |
tokio | ^1 | full | no | always |
Build. None.
Depended on by. 2 workspace crates.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR n_platform_subdivision_plan_api["platform-subdivision-plan-api"] -->|uses| SELF n_tools_subdivision_plan["tools-subdivision-plan"] -->|uses| SELF SELF["domain-subdivision-plan"] SELF -->|runtime| n_foundation_audit_log["foundation-audit-log"] SELF -->|runtime| n_foundation_planar_geometry["foundation-planar-geometry"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| lib | domain_subdivision_plan | `src/lib.rs` |
| test | checks_live | `tests/checks_live.rs` |
| test | ingest_live | `tests/ingest_live.rs` |
Error model
| Error type | Named by |
|---|---|
ArtifactError | parse |
DxfError | parse |
RepoError | figures_of, ingest, ingest_dxf, run |
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | yes |
| async runtime | none detected |
| database access | yes |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | none detected |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.
Related capabilities
2 workspace crates depend on this one: platform-subdivision-plan-api, tools-subdivision-plan.
Verification
| Kind | Count |
|---|---|
| Unit tests | 30 |
| Integration tests | 4 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
crate root | 1 | 0 | 0 |
artifact | 12 | 0 | 2 |
cad_layers | 14 | 0 | 2 |
checks | 12 | 0 | 1 |
dxf | 13 | 0 | 2 |
evaluate | 2 | 0 | 2 |
export | 6 | 0 | 2 |
frames | 4 | 0 | 0 |
provenance | 8 | 0 | 6 |
render | 13 | 0 | 5 |
repo | 38 | 0 | 32 |
sources | 4 | 0 | 2 |
What the tests establish, by name:
derived_figures_are_recomputed_and_disagreements_are_kept—tests/checks_live.rsingest_reproduces_the_artifacts_counts_in_rows—tests/ingest_live.rslayer_areas_are_recomputed_not_copied—tests/ingest_live.rssources_seed_and_a_norm_names_its_document—tests/ingest_live.rsa_cell_is_a_value_only_when_it_is_one_number—src/artifact.rsa_javascript_literal_becomes_json_without_touching_its_strings—src/artifact.rsa_page_without_its_geometry_is_refused—src/artifact.rsingest_reproduces_the_artifacts_counts—src/artifact.rstext_is_cleaned_of_tags_and_entities—src/artifact.rsthe_first_number_of_a_cell_is_read_past_its_words—src/artifact.rsan_arc_is_expanded_into_chords_that_keep_its_area—src/cad_layers.rseach_drawn_polygon_keeps_its_area_through_the_region_type—src/cad_layers.rsthe_layers_derived_from_the_drawing_tile_the_site—src/cad_layers.rsa_missing_value_is_indeterminate_and_says_which—src/checks.rsa_norm_without_a_fetched_source_cannot_satisfy_a_check—src/checks.rsdwellings_and_density_follow_the_pages_arithmetic—src/checks.rsmin_max_and_eq_decide_with_the_tolerance—src/checks.rssection_parts_sum_and_lane_maximum_is_decided—src/checks.rsthe_seven_short_lots_are_a_query_result—src/checks.rsan_arc_adds_its_segment_and_a_mirror_flips_it—src/dxf.rsthe_cad_decides_what_the_paths_could_not—src/dxf.rsthe_drawing_file_is_rows_in_its_own_frame—src/dxf.rsthe_site_polygon_measures_what_the_page_declares—src/dxf.rsexport_is_a_function_of_the_rows—src/export.rsa_square_rotated_mirrored_and_moved_is_recovered—src/frames.rsthe_migration_list_names_each_file_it_carries—src/lib.rscargo_test_lines_become_outcomes—src/provenance.rsevery_test_in_these_crates_is_in_the_catalog_with_its_source—src/provenance.rsthe_analysis_section_names_every_origin_and_every_test—src/provenance.rsrendered_paths_round_trip—src/render.rs- _… 4 more_
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 87 | 143 |
Public modules with a //! block | 11 | 11 |
pie showData
title Public items with rustdoc
"Documented" : 87
"No rustdoc detected" : 56
Metrics
| Metric | Value |
|---|---|
| Rust source files | 12 |
| Source lines | 7077 |
| Code lines | 6426 |
| Public API items | 143 |
| Public modules | 11 |
| Tests | 34 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 9 |
| Workspace reverse dependencies | 2 |
pie showData
title Public API by kind
"constant" : 20
"enum" : 10
"function" : 70
"method" : 16
"struct" : 27
pie showData
title Rust source composition
"Code" : 6426
"Blank or comment" : 651
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.