Is there an alogrithm that analyses mistakes and increses weighting of a certain subject based on the mistake?

I am building a program that analyses a students mistakes and that mistake is linked to a topic. Then the program gets the information that a certain person has made x mistakes on some topic. I want an algorithm that can sort out the topic that the student made the most mistakes in and give them a weighting. Then I want to use that data and plan a personalised revision plan for the student.
What is the best way of going about my goal? Thank you