math-problems-structure

This repository provides functions for generating all types of math problems, ranging from graphical exercises to text-based ones.

Installation

This project uses uv for dependency management. To set up the environment, run the following command in your terminal:

uv sync

Usage

Run the backend server using the following command:

uv run uvicorn main:app --reload

This will start the server, and you can access the API documentation at http://localhost:8000/docs to explore the available endpoints for generating math problems.

API Endpoints

The API is organized by grade level and problem type. For example, to generate a grade 1 problem that involves joining pictures with quantities, you can send a POST request to the following endpoint:

curl -X POST "http://127.0.0.1:8000/math/grade_1/join_pictures_with_quantity" \
  -H "Content-Type: application/json" \
  -d '{
    "available_pictures": [
      {"id": "picture-1", "name": "Apple", "image_path": "/images/apple.png"},
      {"id": "picture-2", "name": "Banana", "image_path": "/images/banana.png"},
      {"id": "picture-3", "name": "Car", "image_path": "/images/car.png"},
      {"id": "picture-4", "name": "Dog", "image_path": "/images/dog.png"},
      {"id": "picture-5", "name": "Elephant", "image_path": "/images/elephant.png"},
      {"id": "picture-6", "name": "Fish", "image_path": "/images/fish.png"},
      {"id": "picture-7", "name": "Grape", "image_path": "/images/grape.png"},
      {"id": "picture-8", "name": "Hat", "image_path": "/images/hat.png"},
      {"id": "picture-9", "name": "Ice Cream", "image_path": "/images/ice-cream.png"},
      {"id": "picture-10", "name": "Juice", "image_path": "/images/juice.png"}
    ],
    "container_count_per_side": 5,
    "min_quantity": 1,
    "max_quantity": 10,
    "seed": 1
  }'

Test

To run the tests, use the following command:

uv run python -m unittest
Description
This repository provides functions for generating all types of math problems, ranging from graphical exercises to text-based ones.
Readme 1.5 MiB
Languages
Python 100%