Skip to main content

Shared DepEd PSGC, hierarchy, territory, SQL, and Marimo primitives.

Project description

deped-primitives

Github CI

deped-primitives is the shared semantic contract layer for the DepEd data ecosystem. It centralizes reusable rules for PSGC identity, administrative hierarchies, boundaries, school vocabularies, access scopes, SQL construction, provider context, metrics, and review helpers.

It is intentionally small. Producer repos own source ingestion and artifacts; consumer repos own products, notebooks, dashboards, and runtime state. This package owns the deterministic interpretation rules that those repos should not copy locally.

Quick Start

from deped_primitives.identity import GeoType, ancestor_codes, normalize_code
from deped_primitives.identity.codes import normalize_boundary_pcode_to_psgc_id
from deped_primitives.schools.names import clean_school_name
from deped_primitives.selection.access import AccessScope, scope_locks_from_access

assert normalize_code(" 13-3900-0000 ") == "1339000000"
assert ancestor_codes("1380610001", GeoType.BGY) == [
    "1300000000",
    "1380600000",
    "1380610000",
]
assert normalize_boundary_pcode_to_psgc_id("PH0102801") == "0102801000"
assert clean_school_name("baliwag nhs") == "Baliwag National High School"
assert scope_locks_from_access(
    AccessScope(level="regional", psgc_region_id="1300000000")
).locked_levels == ("region",)

Import specialized semantics from their owner modules rather than from the root package:

from deped_primitives.areas.boundaries import usable_area_boundary_components
from deped_primitives.authority.legislative import legislative_child_rollups
from deped_primitives.selection.providers import provider_context_sql

Current shared semantics to check before copying local code:

  • deped_primitives.authority.governance for DepEd source governance area IDs, canonical division authority ID grammar, division/school match keys, historical division-label aliases, and resolution/status vocabularies.
  • deped_primitives.selection.providers and deped_primitives.selection.provider_contracts for school-keyed provider context and provider contract metadata.
  • deped_primitives.selection.marimo for notebook territory and area-scope controls. Use deped-runtime for CLI, SQLite, file, workbook, and other non-semantic runtime plumbing.

Documentation

  • Overview explains the domain flow and reading path.
  • Ecosystem explains sibling-repo ownership boundaries and what belongs in this package.
  • Status is the current capability map.
  • Package reference lists the curated package surface and owner-module references.
  • Migration to 0.1 covers the current public import layout.

Development

pre-commit run --all-files
just check

Useful narrower commands:

just test
uv run zensical build
uv run --extra marimo marimo check notebooks/*.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deped_primitives-0.10.1.tar.gz (616.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deped_primitives-0.10.1-py3-none-any.whl (189.3 kB view details)

Uploaded Python 3

File details

Details for the file deped_primitives-0.10.1.tar.gz.

File metadata

  • Download URL: deped_primitives-0.10.1.tar.gz
  • Upload date:
  • Size: 616.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for deped_primitives-0.10.1.tar.gz
Algorithm Hash digest
SHA256 1c604c72814d8836f44114ecb23a7012dd5ccd2d93212566e9343ec35c9a34b5
MD5 b6a2e39760250f563fe5a1374837248e
BLAKE2b-256 383027a8dcd020270aff27a16cc1be8b5e3c6faf8720330c697abfc9df97e09d

See more details on using hashes here.

File details

Details for the file deped_primitives-0.10.1-py3-none-any.whl.

File metadata

  • Download URL: deped_primitives-0.10.1-py3-none-any.whl
  • Upload date:
  • Size: 189.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for deped_primitives-0.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 40dfccf045fa4d736bab1e418b96efa442f5bf9abab6d4c1f67441674434ce32
MD5 8f03167c162ee24c0c254decf7677e62
BLAKE2b-256 1897f30548cd38f2717504103e3e3d431f7c16e8f852628c312759d457749c96

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page