feat: initial stats-cohort-size v0.1.0 (stats.cohort_size@0.1.0)

Resolve the size of an addressee cohort (e.g. "Berliner KMU",
"Gastronomie deutschlandweit").

v0.1.0 ships a five-entry built-in lookup for the F∆I Law-Heatmap
pilot corpus:

  berlin-kmu, de-kmu, gastro-de, handwerk-be, bauwirtschaft-be

Each entry carries (count, year, source, tier). Tier follows the
Studie §6.7 Regel-der-niedrigsten-Stufe: T1 when from DESTATIS
Unternehmensregister, T2 when from a Verband source.

Reuse-lens: any quantitative analysis that needs cohort sizing —
market research, audience targeting, public-health tracking.

Pure in-WASM, zero filesystem, zero network.

Reserved for next versions:

  - 0.2: DESTATIS GENESIS-API adapter — requires
         net: ["genesis.destatis.de"] permission. Interface stays
         the same; the static lookup becomes the fallback when
         the API is unreachable.
  - 0.3: WZ-Code-resolved sub-cohorts (e.g. "berlin-kmu-wz56").

Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
flemming-it 2026-06-18 11:25:19 +02:00
commit 3630d8f4d1
6 changed files with 620 additions and 0 deletions

36
Cargo.toml Normal file
View file

@ -0,0 +1,36 @@
[package]
name = "stats_cohort_size"
version = "0.1.0"
edition = "2024"
authors = ["Dr. Stefan Flemming <chain@flemming.ai>"]
license = "Apache-2.0"
publish = false
description = "F∆I module — resolve cohort sizes for addressee populations"
repository = "https://git.flemming.ws/chain-modules/stats-cohort-size"
rust-version = "1.85"
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
chain-module-sdk = { git = "https://git.flemming.ai/fai/chain-module-sdk-rust.git", branch = "main" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
[profile.release]
opt-level = "s"
lto = true
codegen-units = 1
strip = "symbols"
[lints.rust]
unsafe_op_in_unsafe_fn = "warn"
[lints.clippy]
unwrap_used = "deny"
expect_used = "deny"
panic = "deny"
print_stdout = "deny"
print_stderr = "deny"
[workspace]