Skip to main content
Query Knowledge Graph for the prerequisite standards for a given Academic Standard. Generate practice questions using these prerequisite standards’ Learning Components.
Our current Learning Progressions dataset from Student Achievement Partners ↗ (SAP) maps Common Core State Standards for Mathematics into logical sequences. These sequences do not name definitive prerequisites – their relationships simply indicate what might be helpful in a given circumstance.

What you’ll do

  • Find prerequisite standards for a target CCSS standard using Learning Progressions
  • Unpack prerequisite standards into supporting Learning Components
  • Package Knowledge Graph data for an LLM to generate practice questions

What you’ll need

  • API key and base URL in the Learning Commons Platform ↗
  • OpenAI API key and SDK (pip install openai for Python or npm install openai for JavaScript)
  • curl ↗, Python, or Node

Steps

1

Set up environment variables

.env
API_KEY=your_api_key_here
BASE_URL=https://api.learningcommons.org/knowledge-graph/v0
OPENAI_API_KEY=your_openai_api_key_here
2

Get the prerequisite standards for 6.NS.B.4

Use the GET /academic-standards/search endpoint to find the 6.NS.B.4 standard.Then, use GET /academic-standards/{uuid}/prerequisites to get its prerequisites:
# Step 1: Find the target standard by statement code
curl -X GET \
  -H "x-api-key: YOUR_API_KEY" \
  "https://api.learningcommons.org/knowledge-graph/v0/academic-standards/search?statementCode=6.NS.B.4&jurisdiction=Multi-State"

# Step 2: Get prerequisites using the caseIdentifierUUID from Step 1
curl -X GET \
  -H "x-api-key: YOUR_API_KEY" \
  "https://api.learningcommons.org/knowledge-graph/v0/academic-standards/YOUR_UUID/prerequisites"
Response
[
  {
    "caseIdentifierUUID": "6b9ed00e-d7cc-11e8-824f-0242ac160002",
    "statementCode": "4.OA.B.4",
    "standardDescription": "A buildsTowards relationship indicates that proficiency in one entity supports the likelihood of success in another, capturing a directional progression without requiring strict prerequisite order."
  }
  // ...
]
3

Get Learning Components for the prerequisite standards

Use the GET /academic-standards/{uuid}/learning-components endpoint for each prerequisite standard:
# Get Learning Components for a prerequisite standard
# Replace PREREQ_UUID with each prerequisite's caseIdentifierUUID
curl -X GET \
  -H "x-api-key: YOUR_API_KEY" \
  "https://api.learningcommons.org/knowledge-graph/v0/academic-standards/PREREQ_UUID/learning-components"
Response
[
  {
    "caseIdentifierUUID": "6b9d5f43-d7cc-11e8-824f-0242ac160002",
    "statementCode": "5.OA.A.2",
    "standardDescription": "A buildsTowards relationship indicates that proficiency in one entity supports the likelihood of success in another, capturing a directional progression without requiring strict prerequisite order.",
    "learningComponentDescription": "Write simple expressions of two or more steps and with grouping symbols that record calculations with numbers"
  }
  // ...
]
You will use the prerequisiteLearningComponents array to generate practice questions in the next step.
4

Generate practice problems

Package the Academic Standards and Learning Components data to generate practice questions.
function packageContextData(targetStandard, prerequisiteLearningComponents) {
  // Package the Academic Standards and Learning Components data for text generation
  const standardsMap = new Map();

  // Group Learning Components by Academic Standard for context
  for (const row of prerequisiteLearningComponents) {
    if (!standardsMap.has(row.caseIdentifierUUID)) {
      standardsMap.set(row.caseIdentifierUUID, {
        statementCode: row.statementCode,
        description: row.standardDescription || "(no statement)",
        supportingLearningComponents: [],
      });
    }

    standardsMap.get(row.caseIdentifierUUID).supportingLearningComponents.push({
      description: row.learningComponentDescription || "(no description)",
    });
  }

  const fullStandardsContext = {
    targetStandard: {
      statementCode: targetStandard.statementCode,
      description: targetStandard.description || "(no statement)",
    },
    prereqStandards: Array.from(standardsMap.values()),
  };

  return fullStandardsContext;
}
Use that JSON in a prompt so the LLM has full context when creating practice questions:
const OpenAI = require("openai");

const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

const OPENAI_MODEL = "gpt-4";
const OPENAI_TEMPERATURE = 0.7;

async function generatePractice(fullStandardsContext) {
  console.log(
    `🔄 Generating practice questions for ${fullStandardsContext.targetStandard.statementCode}...`,
  );

  try {
    // Build prompt inline
    let prerequisiteText = "";
    for (const prereq of fullStandardsContext.prereqStandards) {
      prerequisiteText += `- ${prereq.statementCode}: ${prereq.description}\n`;
      prerequisiteText += "  Supporting Learning Components:\n";
      for (const lc of prereq.supportingLearningComponents) {
        prerequisiteText += `    • ${lc.description}\n`;
      }
    }

    const prompt = `You are a math tutor helping middle school students. Based on the following information, generate 3 practice questions for the target standard. Questions should help reinforce the key concept and build on prerequisite knowledge.

Target Standard:
- ${fullStandardsContext.targetStandard.statementCode}: ${fullStandardsContext.targetStandard.description}

Prerequisite Standards & Supporting Learning Components:
${prerequisiteText}`;

    const response = await openai.chat.completions.create({
      model: OPENAI_MODEL,
      messages: [
        {
          role: "system",
          content: "You are an expert middle school math tutor.",
        },
        { role: "user", content: prompt },
      ],
      temperature: OPENAI_TEMPERATURE,
    });

    const practiceQuestions = response.choices[0].message.content.trim();

    console.log(`✅ Generated practice questions:\n`);
    console.log(practiceQuestions);

    return {
      aiGenerated: practiceQuestions,
      targetStandard: fullStandardsContext.targetStandard.statementCode,
      prerequisiteCount: fullStandardsContext.prereqStandards.length,
    };
  } catch (err) {
    console.error("❌ Error generating practice questions:", err.message);
    throw err;
  }
}
Example response
Question 1:
Find the greatest common factor of 36 and 90. Then use the distributive property to express the sum of these two numbers as a multiple of a sum of two whole numbers with no common factor.

Question 2:
Write the expression "add 12 and 15, then multiply by 3" as an algebraic expression. After that, recognize that this expression is three times as large as 12 + 15, without having to calculate the indicated sum or product.

Question 3:
Determine whether the number 72 is a multiple of the digit 8. Find all factor pairs of 72. Recognize that 72 is a multiple of each of its factors and determine whether 72 is a prime or a composite number.
You can now integrate these practice questions into your product workflow!
5

Keep exploring

We scoped to a single standard for clarity, but you can also extend prerequisite chains across grade levels or explore other target standards and subject areas.For more comprehensive learning experiences, extend your queries to include lessons, assessments, or instructional routines.