-
Notifications
You must be signed in to change notification settings - Fork 0
Schema Contract
This page defines the minimum contract that all GitPKM implementations should follow.
Stable IDs are mandatory in all source tables and notes.
^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$Examples:
person_alexorg_learning_hubprog_career_mentorship
Rules:
- lowercase only
- segments separated by
_ - no spaces
- no hyphens
- no uppercase
- no leading numeric character
Each CSV table must include an id column.
- required:
id,name - optional: additional metadata columns
- required:
id, one or more foreign-key columns ending in_id - optional: relationship metadata (
role,year,region, etc.)
Example:
id,person_id,program_id,role
part_alex_mentee,person_alex,prog_career_mentorship,menteeAll foreign keys must:
- end with
_id - reference IDs in another table
- use the same ID format as primary IDs
Examples:
-
organization_id->organizations.csv:id -
person_id->people.csv:id -
program_id->programs.csv:id
Entity notes should include frontmatter with matching ID:
---
id: person_alex
type: person
---Recommended file naming:
notes/<entity_type_plural>/<id>.md
Frontmatter type should use an allowed entity type inferred from entity tables.
Example with people.csv, organizations.csv, programs.csv:
personorganizationprogram
Accepted entity link forms in Markdown:
- relative Markdown link:
[entity_id](relative/path/to/entity_id.md)
Generators should emit links as relative Markdown paths so links resolve both locally and on GitHub.
Scripts may only write within explicit generated markers:
<!-- GENERATED START -->
...
<!-- GENERATED END -->Any content outside markers is user-authored and must not be modified by generators.
Validation should classify failures as:
- invalid ID format
- missing required column
- duplicate primary ID
- unresolved foreign key
- unresolved entity link target
- frontmatter ID mismatch when note exists
- invalid frontmatter type for entity note
- invalid generated marker structure (nested, unmatched start/end)
- note missing for an existing entity row
- orphan note with no matching row
- display column mismatch (for optional name helper columns)
Generators and validators should be deterministic:
- stable output ordering
- idempotent reruns (running twice should not create extra diffs)
When changing schema rules:
- update this contract first
- update validators and scripts
- provide migration notes for existing datasets