Shohruz Makhmudov — home / Drawing set 2026
W-04 ARDIFIT AI Engine — Clinical-safety rule engine and guard-railed GPT-4 coach (client work) AI & automation Delivered

ARDIFIT AI Engine

A training-program engine that puts injuries first: deterministic rules build the plan, a guard-railed GPT-4 coach explains it.

Generated four-week intermediate plan with goal and tier chips, clinical-safety chips for a moderate knee and a severe lower-back injury, key stats and a periodisation strip ending in a deload week.
Mobile questionnaire with the engine’s summary stats and a two-column grid of training goals.
  1. Clinical-safety layer
  2. Deterministic rule engine
  3. Guard-railed GPT-4 coach
  4. 5 languages incl. Arabic RTL
Client
ARDIFIT
Year
2025–26
Authorship
Own build
Status
Delivered
Role
Sole back-end engineer and AI integrator: engine, safety layers, coach, tests, deployment and handover.
Surfaces
REST API · demo and admin UI · desktop and mobile
Languages
EN · RU · AR · ES · DE
Stack
Python · FastAPI · Pydantic · SQLAlchemy · OpenAI GPT-4 · pytest · Docker · Render · Vanilla JS demo UI
W-04.1ARDIFIT AI Engine Sheet 1 of 7

Survey — context and problem.

The problem

Turn a questionnaire into a safe multi-week plan — injuries first — and add an AI coach that knows what it must refuse.

ARDIFIT is a fitness start-up building personalised training programs. Its users fill in a questionnaire on the client’s WordPress site — goals, experience, equipment, schedule, subscription tier and, crucially, injuries — and expect a safe multi-week plan in return.

Safety was the constraint that shaped everything. A user with a severe lower-back injury and a sore knee must never receive an exercise that loads either region, yet every training day still has to contain a real workout rather than a list of stretches. The client supplied the exercise data packs and the training-logic rules; they needed an engine that applies those rules exactly and predictably, and can prove it with tests.

The client also wanted an AI coach — but a bounded one. It had to explain why an exercise was chosen and suggest safe substitutions, while refusing medical diagnosis, nutrition planning and any attempt to redesign the program on its own. The front end would be built in WordPress by another developer, so the engine had to be a clean, documented API.

W-04.2ARDIFIT AI Engine Sheet 2 of 7

Authorship — who built what.

Own buildSole back-end engineer and AI integrator: engine, safety layers, coach, tests, deployment and handover.Client: ARDIFITVisibility: Demo data AI-assisted — I build with AI coding agents — Codex, Claude Code, Antigravity. Spec, architecture decisions, review, QA, deployment and handover are mine.

What was mine

  • Rule engine: goal-to-split mapping, exercise selection, progression and deloads
  • Clinical-safety layer and injury governance
  • GPT-4 coach with intent classification, refusals, response validation and tier limits
  • Data model and user onboarding API (FastAPI, SQLAlchemy)
  • 183 automated tests across safety, selection and the coach
  • Demo and admin UI in five languages, including Arabic RTL
  • Deployment configs and a client handover package

AI in the loop

I build with AI coding agents — Codex, Claude Code, Antigravity. Spec, architecture decisions, review, QA, deployment and handover are mine.

Agents on this project: Antigravity

Credits & notes

  • Exercise data packs and training-logic specifications: ARDIFIT.
  • The demo UI was redesigned in September 2026 for this walkthrough. The client’s production front end is WordPress, built by another developer.
  • Coach screens show the built-in fallback reply; no API key is used in the demo.
  • Exercise GIFs: ExerciseDB (RapidAPI).
W-04.3ARDIFIT AI Engine Sheet 3 of 7

Plan — the system, drawn first.

The solution

A FastAPI engine: clinical-safety layer, rule-based program generator with a minimum-workout guarantee, and a GPT-4 coach behind strict guardrails — covered by 183 tests.

The engine is a FastAPI service; the client’s documentation puts the split at roughly 90% deterministic rules and 10% language model. A questionnaire posted from WordPress goes through the clinical-safety layer first: severe injuries switch a region to an allow-list, moderate ones to a restricted list, and with several injuries an exercise must be safe for every injured region. The program generator maps goals and experience to a split and weekly volume, the selector matches movement patterns to available equipment with a three-tier fallback, and a minimum-workout guarantee keeps at least two genuine strength movements on every training day. Progression models and automatic deload weeks follow. Only then does GPT-4 come in — to explain the plan and suggest safe swaps, behind intent classification, refusals, tone sanitising and a response validator. A demo UI and Swagger docs make the whole flow testable.

System schematic · Not to scale W-04.3
Users & surfaces REST API · demo and admin UI · desktop and mobile EN · RU · AR · ES · DE
04 · Interface FastAPI · Swagger · demo UI in 5 languages
02 · Logic Python rule engine · clinical-safety layer · progression & deload
03 · Intelligence OpenAI GPT-4 behind guardrails
01 · Data SQLAlchemy · SQLite / Postgres · 300-exercise library
00 · Infra Docker · Render · Vercel / Railway configs · pytest

Module key

  1. Questionnaire schema: 8 goals, 3 experience levels, 10 equipment types, 9 injury regions × 3 severities
  2. Allow-list and restricted-list injury modes; volume governance for severe injuries
  3. Program generator with progression models and automatic deload weeks
  4. 300-exercise master library built from the client’s data packs
  5. GPT-4 coach with intent classification, refusals and response validation
  6. Tier limits of 5, 20 and 100 coach questions a day
  7. Exercise GIFs via ExerciseDB, with fallbacks when the API fails
  8. Demo UI and API tester in EN, RU, AR (RTL), ES and DE; Swagger docs

Key decisions

  1. Why 90% rules and 10% language model

    Safety and repeatability cannot depend on sampling. Rules generate the plan and tests pin down its behaviour; the model only explains it.

  2. Why safety runs before selection

    Filtering unsafe exercises first, then selecting, means no later step can reintroduce a risky movement. With several injuries, an exercise must clear every injured region.

  3. Why every day keeps a minimum workout

    Restrictive profiles could otherwise collapse a day into mobility drills. The guarantee keeps at least two intentional strength, isometric or tempo movements.

  4. Why the coach refuses by design

    Diagnosis, nutrition plans and self-directed program changes are out of scope. Refusals, a banned-phrase cleaner, fallback replies and daily limits per tier keep it inside the client’s brief.

W-04.4ARDIFIT AI Engine Sheet 4 of 7

Elevations — the desktop screens.

Questionnaire with goal, experience and equipment selection beside a live athlete-profile panel that previews the engine input.
Mobile questionnaire with the engine’s summary stats and a two-column grid of training goals.

All elevations 04

  1. Fig. 4.1 Day cards of the generated program: each exercise with sets × reps, rest and tags for the injured regions it is cleared for.
  2. Fig. 4.2 Exercise library with search, filters and difficulty counts; cards show movement pattern, target muscles, default volume, progression level and coaching cues.
  3. Fig. 4.3 Built-in API tester calling the exercise-templates endpoint and showing the HTTP status, latency and a highlighted JSON response.
  4. Fig. 4.4 FastAPI Swagger documentation listing the rule-engine, OpenAI text and user-onboarding endpoints.
W-04.5ARDIFIT AI Engine Sheet 5 of 7

Details — the mobile screens.

Mobile athlete-profile panel summarising the inputs and the injury-driven safety rules before the program is generated.
Mobile questionnaire with the engine’s summary stats and a two-column grid of training goals.
A generated training day on the phone, with exercises, sets × reps, rest and injury-safe tags.

Every mobile screen 06

Mobile questionnaire with the engine’s summary stats and a two-column grid of training goals.
Fig. 5.1 Mobile questionnaire with the engine’s summary stats and a two-column grid of training goals.
Mobile athlete-profile panel summarising the inputs and the injury-driven safety rules before the program is generated.
Fig. 5.2 Mobile athlete-profile panel summarising the inputs and the injury-driven safety rules before the program is generated.
A generated training day on the phone, with exercises, sets × reps, rest and injury-safe tags.
Fig. 5.3 A generated training day on the phone, with exercises, sets × reps, rest and injury-safe tags.
Mobile coach chat: a request for a diagnosis gets a safety-first reply recommending a healthcare professional.
Fig. 5.4 Mobile coach chat: a request for a diagnosis gets a safety-first reply recommending a healthcare professional.
Mobile exercise library with search, filters and difficulty counts above the exercise cards.
Fig. 5.5 Mobile exercise library with search, filters and difficulty counts above the exercise cards.
The athlete-profile and safety-rules panel in Arabic with a right-to-left layout — one of the five interface languages.
Fig. 5.6 The athlete-profile and safety-rules panel in Arabic with a right-to-left layout — one of the five interface languages.
1 / 6
W-04.6ARDIFIT AI Engine Sheet 6 of 7

Materials schedule — the stack, and why.

W-04.6 · Materials schedule
LayerMaterialWhy
01DataSQLAlchemy · SQLite / Postgres · 300-exercise libraryClient data packs loaded into a relational model that runs locally and in production.
02LogicPython rule engine · clinical-safety layer · progression & deloadDeterministic, testable decisions: the same profile always yields the same safe plan.
03IntelligenceOpenAI GPT-4 behind guardrailsNatural-language explanations without letting the model diagnose or redesign.
04InterfaceFastAPI · Swagger · demo UI in 5 languagesA documented JSON API for the client’s WordPress front end, plus a demo to walk through it.
05InfraDocker · Render · Vercel / Railway configs · pytestPortable deployment options, with 183 tests handed over together with the code.

Stack

  • Python
  • FastAPI
  • Pydantic
  • SQLAlchemy
  • OpenAI GPT-4
  • pytest
  • Docker
  • Render
  • Vanilla JS demo UI
W-04.7ARDIFIT AI Engine Sheet 7 of 7

Completion — outcome and links.

Verified facts

automated tests
183
Source: from the repository, Sep 2026
exercises in the master library
300
Source: from the repository, Sep 2026
injury regions × severity levels
9 × 3
Source: from the repository, Sep 2026
UI languages, incl. Arabic RTL
5
Source: from the repository, Sep 2026

Want to see it running?

I can walk you through the live system on demo data and explain the decisions behind it.

Request a walkthrough
Next sheet W-05 HOOP Redesigned personal build of the open-source OpenStrap Edge Mobile 2026