A cross-language command-line application that analyses student participation, academic performance and attendance using a rule-based decision engine.
OCaml is responsible for parsing the data, calculating indicators and applying the decision rules. Java provides the interactive interface, starts the OCaml executable through ProcessBuilder, presents the results and generates individual JSON reports.
Completed academic project
This repository contains a portfolio-oriented version of the original submission, with reorganised source files, synthetic sample data and expanded technical documentation.
- Parse Prolog-formatted facts directly in OCaml
- List students alphabetically with activity and attendance indicators
- Calculate forum participation, task average, quiz average and combined average
- Calculate attendance percentages and evaluate self-assessment consistency
- Apply a deterministic rule-based classification process
- Sort students by final status and name
- Invoke the OCaml decision engine from Java using
ProcessBuilder - Generate an individual student report in JSON format
- List students with consistent self-assessments as an additional feature
- Handle missing files, malformed input, invalid arguments and unknown student IDs
- OCaml
- Java
- Java
ProcessBuilder - Functional programming
- Regular expressions and data parsing
- Rule-based decision logic
- JSON file generation
The application separates data processing from user interaction:
- OCaml: data parsing, indicator calculations, decision rules, sorting and formatted output
- Java: command-line interface, process execution, input validation and JSON report generation
- Sample data: synthetic facts stored in a Prolog-style text format
flowchart TD
U[User] -->|Selects an operation| J[Java CLI]
J -->|Requests analysis| I[IntegradorOCaml]
I -->|Starts process and passes command| O[OCaml Decision Engine]
O -->|Reads and parses facts| D[(sample_database.pl)]
D -.->|Returns facts| O
O -.->|Writes result to stdout| I
I -.->|Returns captured output| J
J -->|Displays result| C[Console Output]
J -->|Creates report| B[BoletimJson]
B -->|Writes file| R[(JSON Report)]
| Rule | Condition | Result |
|---|---|---|
| R1 | At least 3 forum participations | Adequate participation |
| R2 | Combined task and quiz average of at least 10 | Positive performance |
| R3 | Attendance of at least 75% | Regular attendance |
| R4 | Self-assessment within 2 points of the combined average | Consistent self-assessment |
The final state is determined from the first three rules and can be improved by one level when R4 is satisfied. A Retido result is never upgraded.
Possible final states:
AprovadoCondicionadoEm ObservacaoEm RiscoRetido
student-performance-decision-engine/
├── data/
│ └── sample_database.pl
├── src/
│ ├── java/
│ │ ├── Aplicacao.java
│ │ ├── BoletimJson.java
│ │ ├── IntegradorOCaml.java
│ │ └── Menu.java
│ └── ocaml/
│ └── main.ml
├── .gitignore
└── README.md
The OCaml executable accepts the following commands:
listar_alunos
indicadores <id>
avaliar <id>
listar_estados
listar_coerentes
- OCaml with the standard
Strlibrary - Java Development Kit 8 or later
Open PowerShell in the repository root.
cd src\ocaml
ocamlc -custom -I +str -o main.exe str.cma main.mlTest it directly:
.\main.exe listar_alunos
.\main.exe indicadores 1
.\main.exe avaliar 2
.\main.exe listar_estados
.\main.exe listar_coerentescd ..\java
javac *.java
java AplicacaoThe Java application automatically looks for ../ocaml/main.exe. A different executable path can be supplied explicitly:
java Aplicacao "C:\path\to\main.exe"Open a terminal in the repository root.
cd src/ocaml
ocamlc -I +str -o main str.cma main.ml
chmod +x maincd ../java
javac *.java
java AplicacaoThe Java application automatically looks for ../ocaml/main on non-Windows systems.
The Java interface can create a file named:
boletim_aluno_<id>.json
The report stores the calculated indicators and the detailed rule evaluation returned by the OCaml engine.
Developed for the Programming Languages course of the Bachelor's Degree in Informatics Engineering at Universidade Aberta.
The project explores functional programming in OCaml, object-oriented programming in Java and communication between independent processes.
- Functional data transformation with
List.map,List.filterandList.fold_left - Parsing structured text with regular expressions
- Modelling deterministic decision rules as pure functions
- Sorting records by multiple criteria
- Integrating Java with an external executable through
ProcessBuilder - Capturing standard output and process exit codes
- Separating processing logic from the user interface
- Generating and escaping JSON content
- Designing input validation and error handling across two languages
- Add automated tests for the OCaml rules and parsers
- Replace manual JSON construction with a dedicated JSON library
- Add CSV and JSON data import options
- Provide an English-language interface
- Add a graphical or web-based interface
- Configure continuous integration after validating OCaml and Java toolchains
Bruna Landgraff
Informatics Engineering Student
GitHub · LinkedIn