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. Producer repositories publish artifacts and source-specific contracts; consumer repositories build maps, datasets, notebooks, and dashboards. This package owns the reusable value rules and interpretation semantics between those layers.

It is intentionally not an application framework. It does not load source workbooks, dissolve geometry, persist databases, run downstream build CLIs, write artifacts, or host dashboards. It gives every DepEd repo one small, tested place to import the rules that should not be reimplemented locally.

Mental Model

Read the package top-down:

  • places get one canonical identity across PSGC IDs, legacy codes, boundary PCODEs, and source names;
  • regions can be read through geography, congressional, and school-admin lenses;
  • areas carry boundary geometry, PSGC classifications, shapefile metrics, and school-observation properties;
  • users drill down a lens tree to an area, access scopes gate the visible subtree, and metrics/outliers measure the selected population.

The root package exposes only __version__ and the seven domain packages. Helper symbols live in their owner modules so their contracts remain explicit. See the documentation overview for the domain flow and ecosystem guide for the sibling-repo ownership map.

Ecosystem

deped-primitives interprets across the ecosystem data flow:

Provider repositories such as deped-web, deped-hr, deped-equipment, and deped-exams keep their own domain artifacts and public tables. The ecosystem guide explains why those sibling repos remain separate and which shared rules belong here.

Quick Start

from deped_primitives.identity import GeoType, ancestor_codes, breakdown, 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
from deped_primitives.selection.sql import (
    SCHOOL_OBSERVATIONS_ADAPTER,
    FilterSpec,
    summary_sql,
)

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

Import specialized semantics from owner modules:

from deped_primitives.areas.boundaries import (
    area_component_rollups,
    usable_area_boundary_components,
)
from deped_primitives.authority.legislative import legislative_child_rollups
from deped_primitives.areas.frames import normalized_psgc_group_rows

groups = normalized_psgc_group_rows(canonical_psgc_units)
usable_components = usable_area_boundary_components(area_boundary_components)
display_components = area_component_rollups(area_boundary_components, canonical_psgc_units)
children = legislative_child_rollups(coverage, barangay_context)

Owned Surfaces

The status page is the capability map. The generated package reference shows the seven root packages, and the module reference pages show complete owner-module surfaces.

Documentation

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.1.1.tar.gz (231.2 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.1.1-py3-none-any.whl (137.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: deped_primitives-0.1.1.tar.gz
  • Upload date:
  • Size: 231.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","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.1.1.tar.gz
Algorithm Hash digest
SHA256 9d9582abb61f4bdbc7b7417243e41236658a2aeb38c1ff1951a72bcf925f03a1
MD5 2bd81389c52c720b93a43cb0ea909779
BLAKE2b-256 f49780eec2e9bb2f0313a124d67dc42466e6bc72bc9b3b127bb77ef86fe6ca63

See more details on using hashes here.

File details

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

File metadata

  • Download URL: deped_primitives-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 137.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e286f83d39df9b8c32f9bfea7a6fd7dbe26fbfc685f950e927e81c5b156a6685
MD5 91bc3152288f50784f545341b95f7942
BLAKE2b-256 7c2e12e42d15666dae7d46bac41b28e8215206a9ac95dab35f5a5d77e9f2df32

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