Local Setup
Fast-moving development ahead!
We strive to keep our documentation accurate and up to date. However, our development cycles move quickly, and occasionally the docs may fall slightly behind. If you run into any issues or something doesn’t work as expected, please don’t hesitate to reach out — we’re here to help!
Table of Contents
Setup Instructions
- Install direnv.
- If you are using
zsh, then addeval "$(direnv hook zsh)"to the end of your~/.zshrcfile. If you are usingbash, then addeval "$(direnv hook bash)"to the end of your~/.bashrc(or~/.bash_profile) file. Ensure you reload the file by runningsource ~/.zshrcorsource ~/.bashrc(orsource ~/.bash_profile). - Install the latest version of uv using:
curl -LsSf https://astral.sh/uv/install.sh | sh - Install pre-commit globally using:
uv tool install pre-commit - Run
git clone git@github.com:IDinsight/KGForEdGlobal.gitand cd into the root directory of the repo. - Run
pre-commit installto set up the git hooks. - In the root
.envrcfile, ensurePROJECT_ENVis set tolocal. - Copy the root
.template.envto.envand update the following environment variables in.env:ANTHROPIC_API_KEY: Your Anthropic API key if you plan on using Anthropic models in the pipeline.OPENAI_API_KEY: Your OpenAI API key if you plan on using OpenAI models in the pipeline.PATHS_PROJECT_DIR: The absolute path to the root directory of the project.
- Copy the root
.template.env.localto.env.local. - Allow
direnvto load the root environment variables by runningdirenv allow. - Create a
datafolder in the root directory. This is where you should place the curriculum PDF files you want to process. - Create a
resultsfolder in the root directory. This is where the output files for each step in the pipeline will be saved. - cd into the backend directory of the repo and:
- Copy
.template.env.localto.env.local. - Allow
direnvto load the backend environment variables by runningdirenv allow.
- Copy
Local Startup Instructions
- cd into the
backenddirectory of the repo and:- Run
make fresh-env. This will create a new virtual environment for the backend and install all dependencies. - Run
source .venv/bin/activate: This will activate the virtual environment created bymake fresh-env.
- Run
- See The Pipeline section for instructions on how to run each step of the pipeline.
Local Clean up Instructions
- In the backend directory, run
deactivate. This will exit out of the virtual environment created byuv.
The Pipeline
The curriculum-document processing pipeline converts a source curriculum PDF into a validated knowledge graph. It has five conceptual stages implemented through four main CLI entry points. The first three stages reconstruct the source document; the final two stages construct the Academic Standards and Learning Components layers.
All commands below are run from the backend directory and consume the same runtime
configuration JSON file. For a detailed description of each stage and its artifacts,
see the Pipeline Overview.
Step 1: Extract Page IR
Render the configured PDF pages and extract one structured PageIR per page:
Step 2: Verify Page IR continuity
Evaluate plausible continuations across adjacent page boundaries and produce the verified PageIR set:
Step 3: Construct Document IR
Deterministically stitch the verified PageIRs into one provenance-preserving
DocumentIR:
Step 4: Construct the knowledge graph
Build and validate the Academic Standards KG first, then construct Learning Components from the validated Academic Standards layer:
create_kgs.py therefore implements the final two conceptual stages of the
pipeline: Academic Standards KG construction followed by Learning Components
construction.