Skip to main content
Rank & belt‑tracking templates: copy‑ready schemas, CSV export templates, rubric matrices and milestone‑trigger pseudocode for martial‑arts management systems

Rank & belt‑tracking templates: copy‑ready schemas, CSV export templates, rubric matrices and milestone‑trigger pseudocode for martial‑arts management systems

A hands‑on build brief for the product managers, engineers and ops staff who have to turn "promote the student, then bill them" into working tables, exports and rules

If you already read the parent piece on curriculum architecture that links progression, billing and retention, you know why rank, billing and retention belong in the same data model. This piece skips all of that. The goal here is narrow: give you the actual schema snippets, export column lists, rubric matrices and rules‑engine patterns you can paste into a migration file or a YAML config today.

Everything below assumes you're building (or heavily customizing) a system where a belt promotion can trigger a billing event, a stall in progress can flag a retention risk, and an instructor's assessment feeds both. No conceptual hand‑holding.

Start with the eight core tables, and get the keys right

The single most common schema mistake in martial‑arts systems isn't a missing table — it's treating rank as a string column on the student record. The moment you do that, you can't version a curriculum, you can't query "who's eligible for the next test," and you can't reconcile a promotion against a billing event without string matching. Promotions become untrackable history.

Here's a workable relational core. Postgres flavor, but the shape ports anywhere.

-- Rank: ordered, versioned, belongs to a curriculum version CREATE TABLE rank ( rankid BIGSERIAL PRIMARY KEY, curriculumversionid BIGINT NOT NULL REFERENCES curriculumversion(curriculumversionid), name TEXT NOT NULL, -- "Blue Belt", "1st Kyu" ordinal INT NOT NULL, -- strict sort order within a curriculum isterminal BOOLEAN DEFAULT FALSE, -- black belt / instructor rank mindaysinrank INT DEFAULT 0, -- time-in-grade floor minclasses INT DEFAULT 0, -- attendance floor colorhex TEXT, createdat TIMESTAMPTZ DEFAULT now(), UNIQUE (curriculumversionid, ordinal) ); -- CurriculumVersion: the thing that lets you change requirements without rewriting history CREATE TABLE curriculumversion ( curriculumversionid BIGSERIAL PRIMARY KEY, programname TEXT NOT NULL, -- "Youth BJJ", "Adult Karate" versionlabel TEXT NOT NULL, -- "2026.1" effectivefrom DATE NOT NULL, effectiveto DATE, -- null = current isactive BOOLEAN DEFAULT TRUE, UNIQUE (programname, versionlabel) ); -- Skill: an individual requirement, tied to a rank CREATE TABLE skill ( skillid BIGSERIAL PRIMARY KEY, rankid BIGINT NOT NULL REFERENCES rank(rankid), code TEXT NOT NULL, -- "KATA-01", "GUARD-PASS-03" name TEXT NOT NULL, category TEXT, -- "forms", "sparring", "terminology" iscritical BOOLEAN DEFAULT FALSE, -- fail-this = fail-the-test displayorder INT DEFAULT 0, UNIQUE (rankid, code) ); -- Assessment: a single test event for one student CREATE TABLE assessment ( assessmentid BIGSERIAL PRIMARY KEY, studentid BIGINT NOT NULL, targetrankid BIGINT NOT NULL REFERENCES rank(rankid), instructorid BIGINT NOT NULL REFERENCES instructor(instructorid), assessedat TIMESTAMPTZ NOT NULL, status TEXT NOT NULL DEFAULT 'scheduled', -- scheduled | inprogress | passed | failed | noshow overallscore NUMERIC(5,2), criticalfail BOOLEAN DEFAULT FALSE, notes TEXT, createdat TIMESTAMPTZ DEFAULT now() ); -- Assessment line items: one row per skill scored CREATE TABLE assessmentskillscore ( assessmentid BIGINT NOT NULL REFERENCES assessment(assessmentid), skillid BIGINT NOT NULL REFERENCES skill(skillid), score NUMERIC(5,2), -- raw score before weighting passed BOOLEAN, PRIMARY KEY (assessmentid, skillid) ); -- Attendance: the backbone of eligibility and stall detection CREATE TABLE attendance ( attendanceid BIGSERIAL PRIMARY KEY, studentid BIGINT NOT NULL, classinstanceid BIGINT NOT NULL, checkedinat TIMESTAMPTZ NOT NULL, currentrankid BIGINT REFERENCES rank(rankid), -- snapshot at check-in source TEXT DEFAULT 'kiosk' -- kiosk | manual | app ); -- Instructor CREATE TABLE instructor ( instructorid BIGSERIAL PRIMARY KEY, fullname TEXT NOT NULL, rankid BIGINT REFERENCES rank(rankid), canpromotetoordinal INT, -- highest ordinal they may sign off active BOOLEAN DEFAULT TRUE ); -- Billing event: where promotion meets money CREATE TABLE billingevent ( billingeventid BIGSERIAL PRIMARY KEY, studentid BIGINT NOT NULL, eventtype TEXT NOT NULL, -- testfee | promotionfee | beltfee | membership sourceref TEXT, -- e.g. assessmentid for idempotency amountcents INT NOT NULL, currency TEXT DEFAULT 'USD', status TEXT DEFAULT 'pending', -- pending | charged | failed | waived | refunded idempotencykey TEXT UNIQUE NOT NULL, createdat TIMESTAMPTZ DEFAULT now() ); -- Media: videos/photos tied to a skill or assessment CREATE TABLE media ( mediaid BIGSERIAL PRIMARY KEY, ownertype TEXT NOT NULL, -- 'assessment' | 'skill' | 'student' ownerid BIGINT NOT NULL, storageurl TEXT NOT NULL, mediatype TEXT, -- video | image | pdf capturedat TIMESTAMPTZ, uploadedby BIGINT REFERENCES instructor(instructor_id) );

currentrankid snapshot on attendance. Don't resolve a student's rank by joining to their current record at report time. Store the rank at check‑in. Otherwise your historical "classes in current rank" counts silently rewrite themselves every promotion, and your eligibility logic breaks for anyone mid‑cycle.

idempotency_key is NOT NULL and UNIQUE on billing. The number of duplicate test‑fee charges traced back to a retry loop firing twice is not small. Make the database refuse the second insert. More on that in the retry section.

{ "rankid": "rblue01", "curriculumversionid": "cvyouthbjj20261", "name": "Blue Belt", "ordinal": 4, "isterminal": false, "mindaysinrank": 180, "minclasses": 60, "skills": [ { "code": "GUARD-PASS-03", "name": "Knee slice pass", "category": "sparring", "iscritical": true }, { "code": "SUB-07", "name": "Triangle from guard", "category": "sparring", "iscritical": false }, { "code": "TERM-02", "name": "Positional terminology", "category": "terminology", "is_critical": false } ] }

Just know that embedding skills means you re‑write the document on every curriculum edit, and you lose the clean join for "which students have ever been scored on GUARD‑PASS‑03." For most studios the relational version ages better.

Export templates: the five reports ops actually pulls every month

Schemas are invisible to the front desk. Exports aren't. These are the CSV/Excel column templates that keep showing up as recurring operational needs, with the exact columns and a note on how each is used. Build these as saved views so nobody rebuilds them by hand.

1. Eligibility roster (who can test) This is the one instructors argue about most. Give them a flat, sortable file.

ColumnTypeNotes
student_idint
student_nametext
current_ranktextresolved name
curriculum_versiontextso you know which ruleset applied
daysinrankinttoday − last promotion date
classesinrankintcount of attendance since last promotion
mindaysrequiredintfrom rank
minclassesrequiredintfrom rank
skills_passedintdistinct skills with passed=true
skills_totalintfrom target rank
eligibleboolcomputed, all floors met
blocking_reasontext"needs 8 more classes", "outstanding fees"
outstandingbalancecentsint

That blocking_reason column is worth more than the eligible flag alone. "No" with no reason generates five front‑desk questions per test cycle. "No — 8 classes short" ends the conversation.

2. Stall report (retention early‑warning) A "stall" is a student who's attending but not progressing, or who was progressing and went quiet. This export is the raw material for retention outreach.

ColumnNotes
student_id
student_name
current_rank
daysinrank
mediandaysinrankforthisrankbenchmark, computed across the cohort
classeslast30d
classesprev30d
attendance_trend"rising" | "flat" | "declining"
lastattendedat
dayssincelast_class
assessmentlastresultpassed | failed | none
stall_flagsee rules engine below

3. Cohort retention Tracks a start cohort over time. One row per cohort, columns per month‑since‑join.

ColumnNotes
cohort_monthe.g. 2026-01
starting_count
activem1, activem3, activem6, activem12
retentionm3pct, retentionm6pct, retentionm12pct
promotionswithincohorttotal belts earned by the cohort
avgclassesperactivemember

4. Test participation Who got invited, who showed, who passed. The gap between "eligible" and "tested" is a retention signal most people ignore.

ColumnNotes
assessment_date
target_rank
invited_count
registered_count
attended_count
passed_count
criticalfailcount
noshowcount
participationratepctattended / eligible
passratepctpassed / attended

5. Outstanding fees (promotion‑linked) Because promotion fees and test fees fail differently than membership dues.

ColumnNotes
student_id
student_name
event_typetestfee | promotionfee | belt_fee
relatedassessmentid
amount_cents
status
days_outstanding
retry_count
nextretryat
blocks_promotionbool, whether this unpaid item should freeze the rank change

One practical rule worth encoding: never let a beltfee (the physical belt) block a promotion record. It's a $6 item. Blocking a rank change over it creates an angry parent and a confused instructor. Block on testfee if you must block on anything.

Rubric matrices: weights, thresholds, and the critical‑fail trap

A rank test score isn't a simple average, and when studios try to make it one, they get nonsense results — a student who botched the one sparring requirement that actually matters still "passes" at 78% because terminology dragged them up.

The fix is a weighted matrix plus critical‑fail gating that sits above the math. Here's a template for one rank, as a config block you can store per curriculum version:

rubric: targetrank: "Blue Belt" curriculumversion: "cvyouthbjj20261" pass_threshold: 70 # weighted overall must be >= this categories:

  1. - name

    "sparring" weight: 0.45 mincategoryscore: 60 # category floor, independent of overall skills: - code: "GUARD-PASS-03" weight: 0.5 critical: true # score below criticalthreshold = auto-fail criticalthreshold: 60 - code: "SUB-07" weight: 0.5 critical: false

  2. - name

    "forms" weight: 0.35 mincategoryscore: 65 skills: - code: "KATA-01" weight: 1.0 critical: true critical_threshold: 65

  3. - name

    "terminology" weight: 0.20 mincategoryscore: 50 skills: - code: "TERM-02" weight: 1.0 critical: false

The evaluation order matters, and this is the part people get backwards. Check gates before you trust the overall number:

  1. Critical‑fail check first. Any skill marked critical scoring below its criticalthreshold → the whole assessment is failed, criticalfail = true. Stop. Don't compute an overall score that implies "close."
  2. Category floor check. Any category below mincategoryscore → fail, even if the weighted overall clears the bar. This stops the terminology‑carries‑sparring problem.
  3. Weighted overall. Only now sum (skillscore × skillweight × categoryweight) and compare to passthreshold.

A worked example makes the gating obvious. Say a student scores:

  1. GUARD‑PASS‑03

    55 (critical, threshold 60)

  2. SUB‑07

    90

  3. KATA‑01

    80

  4. TERM‑02

    95

Naive weighted overall lands around 76 — a comfortable pass. But GUARD‑PASS‑03 is a critical skill scored below threshold, so step 1 fails the test outright. The student retests the pass, not the whole curriculum. That's the correct outcome, and it's invisible if you only store an average.

One more field worth carrying: critical_fail = true on the assessment lets your retention export treat a critical fail differently from a general fail. A kid who failed one critical move tends to come back if invited back promptly; a kid who scored low across the board often needs a different conversation.

Rules‑engine patterns: triggers, debounce, idempotency and retries

This is where curriculum‑linked billing either works quietly or generates support tickets forever. The schemas above are static; these patterns are the moving parts.

Milestone trigger (promotion → billing) The event you care about is a rank change. When an assessment flips to passed, you want to write the promotion, enqueue the belt fee, and update retention state. Do it as an idempotent handler, not inline in the "save assessment" code path.

trigger: assessment.statuschanged when: newstatus: "passed" oldstatus: ["inprogress", "scheduled"] actions:

  1. - createpromotion

    fromrank: student.currentrankid torank: assessment.targetrankid effectiveat: assessment.assessed_at

  2. - enqueuebilling

    eventtype: "promotionfee" idempotencykey: "promo:{assessmentid}" # one fee per assessment, ever amountcents: rank.promotionfeecents skipif: student.promotionfee_waived

  3. - updateretentionstate

    clearflag: "stall" set: lastpromotionat = assessment.assessedat

The idempotencykey: "promo:{assessmentid}" is the whole game. If the handler runs twice — a double‑click, a webhook redelivery, a worker that didn't ack — the second enqueue_billing collides with the UNIQUE constraint and does nothing. No duplicate charge.

Debounce on stall detection Stall flags are noisy. A student who misses one week around a holiday shouldn't trigger a "we miss you" email on the eighth day, then another when they miss the ninth. Debounce by state, not by timer alone.

on attendancegapcheck (runs nightly): for each active student: gap = dayssincelastclass(student) if gap >= STALLTHRESHOLDDAYS (e.g. 14): if student.stallflag != true: set student.stallflag = true set student.stallflaggedat = today emit event: student.stalled # outreach subscribes here # already flagged -> do nothing, no re-emit else: if student.stallflag == true: set student.stall_flag = false emit event: student.returned

The pattern: the flag transition emits the event, not the condition being true. A condition that's true for 20 nights in a row emits once, on night one. This eliminates the most common "the system spammed my members" complaint.

Billing edge cases to encode explicitly These are the cases that bite after go‑live. Write them as rules, not as tribal knowledge sitting in someone's head.

Promotion reversed. Instructor fixes a mis‑entered pass. If a promotion_fee already charged, create a linked refund event — don't delete the original. Your reconciliation needs the trail.

Student promoted while membership is in failed (dunning) state. Decide and encode: either hold the promotion fee until dues clear, or charge it and let it land in the same dunning queue. Pick one. Silence here means a student tests, "passes," gets no belt‑fee charge, and nobody notices for two months.

Mid‑cycle curriculum version change. A student started under 2026.1 but tests after 2026.2 goes live. Pin the assessment to the curriculum version that was effective at scheduling time, not test time. Store curriculumversionid on the assessment row so this isn't ambiguous.

Waived test fee, then promotion. If testfee was waived, don't let the promotion handler quietly re‑bill it under a different eventtype. The skip_if clause above exists for this.

Retry logic that doesn't double‑charge Failed promotion‑fee charges need retries, but retries are exactly where duplicate charges are born. The safe pattern separates the attempt from the intent:

retrypolicy: eventtype: "promotionfee" maxattempts: 4 backoff: [0, "2d", "4d", "7d"] # first attempt immediate, then spaced oneachattempt: reuseidempotencykey: true # same key every retry chargevia: paymentprocessor onsuccess: setstatus: "charged" emit: billing.succeeded onfinalfailure: setstatus: "failed" emit: billing.failed action: flagformanualreview # do NOT block the promotion record

The non‑negotiable line is reuseidempotencykey: true. The processor sees the same key on attempt 2, 3 and 4. If attempt 1 actually succeeded but the ack got lost — which is why you're retrying — the processor returns the original result instead of charging again. Generate a fresh key per retry and you've built a double‑charge machine.

Note also what final failure does not do: it doesn't revoke the belt. A student earned the rank in the room. A card problem is a billing problem. Keep them separate or you'll be un‑revoking ranks and apologizing.

Here's a simple workflow diagram showing the promotion → billing → retry process with idempotency keys and the debounce step.

Process diagram

This workflow keeps promotion intent separate from charging attempts, prevents double charges via idempotency, and makes stall/outreach emission occur only on state transitions.

A short real scenario

A two‑location kids' program with roughly 310 active students was running promotions on a spreadsheet plus a separate payments tool. Two problems kept repeating. Test fees occasionally double‑charged when the front desk re‑ran a "sync" after a crash — maybe three or four parents per cycle, each one a refund, an apology, and a dinged review risk. And the "eligible to test" list was eyeballed, so a handful of kids got invited who were a dozen classes short, tested, failed, and a couple quietly stopped showing up after that.

Moving to the model above — snapshotting rank on attendance, generating a computed eligibility roster with blocking_reason, and keying billing events by assessment ID — the double‑charges went to zero because the database simply refused the duplicate insert. The eligibility export meant invitations matched reality, and failed‑test attrition around each cycle dropped noticeably over the next two testing rounds.

Nothing exotic. The rules just stopped depending on someone remembering them.

When to build this vs. buy it

Not every studio should hand‑roll these tables. A rough guide:

  1. Build or customize if you run a non‑standard curriculum, multiple programs with different rank structures, or you're integrating promotion fees into existing billing you can't replace. The schema and rules here are your spec.
  2. Buy if a studio platform already models rank, attendance and billing together and exposes the exports above. Re‑implementing idempotent billing correctly is more work than it looks, and getting it wrong costs real money and goodwill.
  3. Don't build a half‑version — rank tracking in software, billing on paper. The gap between them is precisely where the double‑charges, missed fees and mis‑invites live.

Whatever you implement, the test for "did we get it right" is straightforward: can you run a promotion twice and charge once, flag a stall once and email once, and hand the front desk an eligibility list with a reason attached to every "no"? If those three hold, the rest of the system has something solid to stand on. For how these pieces connect to the broader progression‑and‑retention model, the curriculum architecture piece covers the layer above these tables.

Whatever you implement, the test for "did we get it right" is straightforward: can you run a promotion twice and charge once, flag a stall once and email once, and hand the front desk an eligibility list with a reason attached to every "no"? If those three hold, the rest of the system has something solid to stand on. For how these pieces connect to the broader progression‑and‑retention model, the curriculum architecture piece covers the layer above these tables.

Built for Dojos Tailored for martial arts studio workflows and operations
Save Time Streamline class bookings, instructor coordination & daily management
Engage Students Faster class registration and improved communication
Grow Membership Increase retention and maximize class attendance