99
Matheus Saleh
Back to inventory
Case study · Expert system#04

AutoLab

  • Java
  • Spring Boot
  • Drools
  • React
  • TypeScript
  • Vite
  • Docker
  • Nginx
  • GitHub Actions

An automotive diagnosis simulator with 28 Drools rules across six vehicle areas. It shows which answers support each hypothesis. The project started in 2025 as the Automotive Diagnosis Expert System, a terminal app, and became AutoLab in 2026.

Timeline
2025 → 2026
Knowledge base
28 rules · 6 areas · 37 symptoms
Interface
Responsive web (was: terminal)
Hosting
VPS with Docker and Nginx
AutoLab home screen with an animated radar, six sample scenarios, and the 28-rule catalog button

The project

An expert system stores a specialist's knowledge as “if… then” rules. Here, the Drools engine receives symptoms as facts and fires the rules whose conditions are met: an engine that cranks but won't start with a low tank points to running out of fuel; suspension noise past 100,000 km calls for a suspension check.

The first version worked, but only in the terminal and without explaining its output. AutoLab turns that rule base into a lab: pick a case, change an answer, and see which rule produced each hypothesis and what changed between two simulations.

Screenshots

See the explained simulation, the rule catalog, the phone layout and, for comparison, the original 2025 version running in the terminal.

Explainable simulation(2)

  • Explained hypothesis and a follow-up question
  • Comparing two simulations

Catalog and explanation(2)

  • Rule catalog filtered by area
  • “How it works” panel

Home and phone(2)

  • Home with sample scenarios and the catalog
  • Responsive phone layout

Before · 2025 version(1)

  • Original terminal version (2025)

The web screenshots were taken on the live AutoLab, using the simulator's own fictional scenarios. The terminal screenshot shows the real output of the April 2025 code, with the full symptom list shortened. The AutoLab interface is in Portuguese.

Features

What came from the 2025 version and what was built for AutoLab in 2026.

  • 2025 · 2026

    Drools rule base

    DRL rules cover starting, cooling, fuel injection, brakes, suspension, and maintenance. The base grew from 10 to 28 rules.

  • 2026

    Why did this appear?

    Each hypothesis shows the rule name and the answers that fired it. Before, the diagnosis was a single line printed to the console.

  • 2026

    Follow-up questions

    When a single piece of evidence is missing to evaluate a rule that fits the answers, the simulator suggests the question.

  • 2026

    Before and after

    After you change an answer, the panel marks each hypothesis as new, kept, updated, or removed.

  • 2026

    Rule catalog

    Filter the 28 rules by area, read each rule's conditions, and test any rule with sample data.

  • 2026

    Sample scenarios

    Six ready-made cases, such as the 365-day service threshold and a comparison between two fuel levels.

  • 2025 · 2026

    Terminal mode

    The terminal question flow is still available with the --cli flag, now backed by the same service as the API.

  • 2026

    Responsive interface

    A form grouped by vehicle area, accessible <dialog> panels, and a layout adapted to phones.

  • 2026

    Validated input

    The server only accepts known symptoms and values, rejects extra fields, and caps the request body at 16 KiB.

Architecture

React and the API are served by the same Spring Boot jar. On the VPS, Nginx forwards HTTPS to the container through a Unix socket, with no published port.

frontendReact 19 · TypeScript · Vite
  • Loads the catalog from GET /api/regras and builds the form from the returned fields
  • Sends answers to POST /api/diagnosticos and keeps the previous simulation for comparison
  • Sample scenarios, the catalog, and the “How it works” panel use native dialogs
API and rulesJava 17 · Spring Boot 4.1 · Drools 10.2
  • The DRL base is compiled once with the executable model, and each request gets its own Drools session
  • Rules insert hypotheses with their evidence instead of printing to the console
  • Rule metadata (@id, @categoria, @quando) drives the catalog and the follow-up questions
  • A filter sets a strict Content-Security-Policy and other security headers

Technical decisions

DecisionReasonConsideration
Rules insert hypotheses as factsThe API returns each hypothesis with the rule and the evidence that fired it.Every rule must declare which symptoms count as evidence.
Metadata on the rules themselvesThe catalog, examples, and follow-up questions all come from the same DRL file.Annotations must match the conditions; the tests check both.
One Drools session per requestNo facts are shared between users or between simulations.A new session per call, offset by compiling the rule base only once.
Frontend served by the jarOne deployment, same origin, and a CSP that only allows the site's own resources.Changing the interface requires building a new image.
Network-less container behind a Unix socketAutoLab shares the VPS with other services without exposing ports or reaching other networks.The proxy needs group permission on the socket directory.
Explore the code on GitHub

From 2025 to 2026

Expert System · 2025

  • Terminal app: each symptom and value typed as free text
  • 10 rules that only printed the diagnosis to the console
  • No indication of the rule or evidence behind the result
  • No validation: an invalid mileage crashed the run
  • Spring Boot 3.4 and Drools 7.74 with kmodule.xml
  • Only the default contextLoads test

AutoLab · 2026

  • React web interface live at autolab.matheussaleh.com.br
  • 28 rules across six areas, each with evidence and metadata
  • Per-hypothesis explanations, follow-up questions, and comparison
  • 37 symptoms with server-side value validation
  • Spring Boot 4.1 and Drools 10.2 with the executable model
  • Tests for every rule, GitHub Actions CI, and an isolated deployment

Rules and tests

Drools rules
28
vehicle areas
6
automated tests
37

The 37 integration tests exercise each of the 28 rules with its positive example, with one piece of evidence missing, and with answers that prevent it from firing. They also cover simultaneous hypotheses, numeric thresholds, both answers to the follow-up case, security headers, and rejection of invalid input. GitHub Actions CI runs npm audit, the frontend build, and mvn verify.

Demo scope

  • This is an educational simulation with fictional scenarios. Its hypotheses do not replace a mechanic's inspection.
  • The AutoLab interface is in Portuguese.
  • The container runs with no network, a read-only file system, no Linux capabilities, and CPU, memory, and process limits.

Try AutoLab

Open a sample scenario, change an answer, and see which rules explain the new result.

Achievement Unlocked!