Code Monkey home page Code Monkey logo

dailymath's Issues

Backend: Create CI

ToDo

To validate our Python code we need to build a CI to test the code.

It's important to run mypy too, since it is a type checher, it will validate if the infered types are the same as the annotaded ones.

https://github.com/python/mypy

Frontend: Layout planning

ToDo

The layout doesn't have a specific line of thought, so be creative.
All you need to do is follow the points below:

Exercise page

  • Display the exercise and interpret the LaTeX on it
  • If the exercise is proof-based, it displays a text box so that the user can write LaTeX in real time.
  • If the exercise is multiple choice, show the options and user should be able to select one
  • A button to submit the solution (some validations should be done here e.g verify if it's not empty)

Solution page

  • After submitting the answer, a flag validating the submitted answer and a LaTex solution should be received by frontend. It should be displayed and LaTex should be parsed
  • If the flag validating the submitted answe is false or not set, then user didn't submit a valid answer and the solution will not be sent nor displayed. A informative text should be displayed, saying the answer was not valid and a redirect button should be placed for the user being able to return to the exercise page.

Backend: Create database programmatically

ToDo

Create a script or a class which should be executed when the server starts, createing the tables and populating them.

A csv file will be added later where you should use to populate the DB. However, if you have a better idea to keep the database populated comment it out, please.

Backend: Generate the daily exercise

ToDo

  • The daily exercise should be selected every day at 12AM UTC
  • The exercise should be always available, probably request from the database everytime is not a good way

Backend: FastAPI Cache system

ToDo

We implemented a singleton to prevent to made unnecessary queries to the database since the exercise is the same during the day.

@bugelseif suggest to use FastAPI cache instead of the singleton instance and the functions to select a new exercise everyday.

Backend: Request for exercise

ToDo

  • Backend should has some URI to send the daily exercise
  • You should get the exercise from the right table
  • If the exercise is multiple choice, the possible options should be sent together with the exercise

Problems

  • We need to think about a way to normalize how we will sent proof-based and multiple choice exercises, since the first one doesn't have options and the second has

Backend: Get rid off global variables and functions

ToDo

In main.py we have some global variables and some functions which are not FastAPI routes. If we have global variables means we can encapsulate them in a class and use an instance of that class instead of global variables. Same for the functions that are about selecting exercises.
You can create a class ConfigExercise or something like that to encapsulate those variables and functions.

Database: Creating the schema for database

#ToDo
Before starting to develop databases, we need to create the database format.
I think 2 tables are enough.

Exercise table

  • ID (INT, UNIQUE, NOT NULL, auto-incremental) => Primary Key
  • type (VARCHAR, NOT NULL) => Represents the type of exercise (Linear Algebra, Calculus etc)
  • source (VARCHAR, NOT NULL) => Represents the author of the exercise
  • exercise (BLOB or TEXT, NOT NULL) => Represents the exercise itself
  • is_multiple_choice (BOOL, NOT NULL) => Represents if the exercise is multiple choice
  • ID_solution (INT, UNIQUE, NOT NULL) => Foreign Key

Multiple choice table

  • ID (INT, UNIQUE, NOT NULL, auto-incremental) => Primary Key
  • ID_exercise (INT, UNIQUE, NOT NULL, auto-incremental) => Foreign Key
  • options (VARCHAR or TEXT, NOT NULL) => Options to be chosen by the user

Solution table

  • ID (INT, UNIQUE, NOT NULL, auto-incremental) => Primary Key
  • solution (BLOB or TEXT, NOT NULL) => Solution for the exercise

Explanations

Probably you're asking: "Why the multiple choice table doesn't have some flag saying what is the right answer?". Well, since all the exercises will have a detailed solution, the author will say, in the beggining, what solution is correct.

⚠️Warning ⚠️

Probably, because options will be a string with all options, some pattern will be developed to parse the options, but that's a back-end problem

Backend: Request solution

ToDo

  • URI to respond to request for solution
  • Check if the user's answer is a valid
  • Get the solution from the right table
  • Probably we should save the solution instead of requesting it from the database everytime
  • The response should send a flag saying if it's a valid answer or not

Backend: Check the solution

ToDo

  • Parse the LaTeX solution sent by frontend
  • Verify if any math expression was really sent
  • Verification flag should be set if answer is valid or not set if not valid

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.