Skip to content

Add curriculum read models - #8

Merged
dragosandreibobu merged 1 commit into
mainfrom
feat/curriculum-read-models
Aug 4, 2026
Merged

Add curriculum read models#8
dragosandreibobu merged 1 commit into
mainfrom
feat/curriculum-read-models

Conversation

@dragosandreibobu

Copy link
Copy Markdown
Contributor

Summary

  • map the existing concept table to an unmanaged Django model
  • map the existing relation_type table to an unmanaged Django model
  • map the existing relation table and its foreign keys
  • expose explicit incoming, outgoing, and relation-type reverse relationships
  • represent relations using their semantic source-type-target form
  • document the semantic uniqueness constraint on source, type, and target

Database mapping

  • Concept.slug is the concept primary key
  • RelationType.slug is the relation-type primary key
  • Relation.source references Concept.slug
  • Relation.type references RelationType.slug
  • Relation.target references Concept.slug
  • Relation.id remains the technical UUID primary key
  • (source, type, target) remains semantically unique

Verification

  • uv run python manage.py check
  • uv run pytest
  • queried live Supabase data through the Django ORM
  • verified concept, relation-type, and relation counts
  • verified forward and reverse foreign-key navigation
  • inspected generated parameterized SQL

Database assumptions

The Supabase database is currently a prototype.

The schema changes applied during development are not included as repository migrations in this PR. These unmanaged models therefore assume that the connected database already contains the expected tables and constraints.

Database migration history and reproducible database provisioning will be introduced separately when the prototype schema is rebuilt.

Out of scope

  • REST API endpoints
  • serializers
  • Django admin registration
  • write operations
  • authentication and authorization
  • Supabase migration files
  • concept cleanup
  • PostgreSQL schema relocation

@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
curricula-live-api Ready Ready Preview Aug 4, 2026 3:19pm

@dragosandreibobu
dragosandreibobu marked this pull request as ready for review August 4, 2026 15:21
Copilot AI lite review requested due to automatic review settings August 4, 2026 15:21
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds unmanaged Django ORM “read models” for the existing curriculum tables (concept, relation_type, relation) so the API codebase can query the prototype Supabase schema with correct keys, relationships, and semantic identity.

Changes:

  • Introduces unmanaged models Concept, RelationType, and Relation with PK/FK mappings and explicit reverse relationship names.
  • Encodes the semantic uniqueness rule for relations via a UniqueConstraint on (source, type, target).
  • Adds tests that validate the ORM metadata mapping (PKs, columns, FKs, reverse names, on-delete behavior, constraint name/fields, and __str__ semantics).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
core/models.py Adds unmanaged Django models mapping to existing curriculum tables with PK/FK relationships and a semantic uniqueness constraint.
tests/test_curriculum_models.py Adds tests asserting the Django model metadata and string representation match the intended DB mapping/semantics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dragosandreibobu
dragosandreibobu merged commit ec7641c into main Aug 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants