domain tier

domain-subdivision-plan

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.

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.

Tierdomain
Rolebounded_context
Pathcrates/domain/subdivision-plan
Edition2021
Targetsdomain_subdivision_plan, checks_live, ingest_live
Public items143 across 11 modules
Tests34

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.

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

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`

ItemWhat it is
pub const MIGRATIONS: & (& str, & str)The schema this crate owns

`artifact`

ItemWhat it is
pub const MAX_INPUT_BYTES: usizeThe page's own limit: the artifact is a few hundred kilobytes; anything past this is not it.
pub enum ArtifactError
pub struct SectionDefOne street section as the page defines it: a name, a width, a class line and its parts.
pub struct TableOne 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 ProseBlockOne 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) -> StringQuote the bare keys of a JavaScript object literal so serde_json can read it
fn clean_text(html : & str) -> StringTags 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`

ItemWhat it is
pub const LOTS: & strThe 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 ArcsWhether an arc is expanded into chords or taken as its chord.
pub struct DerivedOne 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) -> f64The 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`

ItemWhat 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 EvidenceWhether 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,) -> OutcomeDecide one check
pub struct ShortLotA 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) -> f64How 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) -> u32Dwellings 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) -> f64Dwellings per hectare from a site area in square metres.

`dxf`

ItemWhat it is
pub const MAX_DXF_BYTES: usizeA drawing file is a few megabytes at most.
pub enum DxfError
pub struct VertexOne vertex of a polyline with the bulge of the segment that starts at it.
pub enum Shape
pub struct EntityOne 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) -> f64Signed 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) -> RingThe 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`

ItemWhat 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`

ItemWhat it is
pub const SLOT_KINDS: & str; 13The render kind that fills each drawing slot, in the order the page shows them.
pub const STYLE_SECTION: & strSections 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) -> StringOne 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,) -> StringThe whole page

`frames`

ItemWhat it is
pub struct Transformx' = 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`

ItemWhat it is
pub enum OriginHow a table's rows came to be.
Origin :: fn as_str(self) -> & 'static str
pub struct TableOriginOne table, its origin, and what that means for a reader of the exported page.
pub const ORIGINS: & TableOriginThe origin of every table the exported page draws on.
pub struct TestCaseOne 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,) -> StringThe analysis section of the exported page: the origins with their counts, then every test with its last recorded outcome and its source

`render`

ItemWhat it is
pub const TOKENS: & (& str, & str)The page's colour tokens, light theme.
fn v(token : & str) -> Stringvar(--token, #hex).
fn d_of(f : & FigureRow) -> StringThe d a figure draws with: its source text while current, else its vertices.
fn plan_svg(figs : & FigureRow, vbw : f64, vbh : f64) -> StringThe 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 SheetThe 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) -> StringThe building's floor plan: the block's paths with a caption under it.
fn section_svg(sec : & SectionRow, px : f64) -> StringA 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) -> StringThe scene at levels storeys for the buildings, from the isometric-frame figures.
fn iso_svg(figs : & FigureRow, levels : u32, vb : f64; 4) -> StringThe isometric SVG over a viewBox x, y, w, h.
pub struct InputsEverything 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`

ItemWhat 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 NewFigureOne figure as the artifact defines it, before it has a row
NewFigure :: fn into_row(self) -> FigureRowThe 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) -> SectionRowThe 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`

ItemWhat it is
pub struct SourceSeedA document row to seed
pub struct NormSeedOne parameter a source fixes.
pub const SOURCES: & SourceSeed
pub const NORMS: & NormSeed

Re-exports. Exported here, defined elsewhere.

ExportDefined in
sha256_hexfoundation_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
Locationcrates/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.

CrateTierOptionalOnly on
`foundation-audit-log`foundationnoalways
`foundation-planar-geometry`foundationnoalways

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
chrono^0.4serdenoalways
rust_decimal^1serdenoalways
serde^1derive, derivenoalways
serde_json^1noalways
sqlx^0.8runtime-tokio, postgres, chrono, uuid, json, rust_decimalnoalways
thiserror^2noalways
uuid^1v4, v7, serde, jsnoalways

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
rust_decimal_macros^1noalways
tokio^1fullnoalways

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

KindNameSource
libdomain_subdivision_plan`src/lib.rs`
testchecks_live`tests/checks_live.rs`
testingest_live`tests/ingest_live.rs`

Error model

Error typeNamed by
ArtifactErrorparse
DxfErrorparse
RepoErrorfigures_of, ingest, ingest_dxf, run

Operational characteristics

PropertyEvidence
async public surfaceyes
async runtimenone detected
database accessyes
network I/Onone detected
unsafe codenone detected
environment variablesnone 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.

2 workspace crates depend on this one: platform-subdivision-plan-api, tools-subdivision-plan.

Verification

KindCount
Unit tests30
Integration tests4
Examples0
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
crate root100
artifact1202
cad_layers1402
checks1201
dxf1302
evaluate202
export602
frames400
provenance806
render1305
repo38032
sources402

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc87143
Public modules with a //! block1111
pie showData
    title Public items with rustdoc
    "Documented" : 87
    "No rustdoc detected" : 56

Metrics

MetricValue
Rust source files12
Source lines7077
Code lines6426
Public API items143
Public modules11
Tests34
Examples0
Cargo features0
Direct runtime dependencies9
Workspace reverse dependencies2
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.

All domain · Manual