Skip to content

AI-CDSS

Clinical Decision Support System for the Rehabilitation Gaming System (RGS). Scores rehabilitation protocols per patient from clinical condition + gameplay data, and recommends a weekly protocol schedule.

  • How the CDSS works


    The closed adaptive loop: measure patient status, score and select protocols, monitor the response, then adjust the plan (MVT swap + therapeutic interchange). Walk through the four stages.

    Overview

  • API reference


    Every public class + function, generated from source docstrings.

    API

  • Try it


    A no-database recommendation in ~30 lines via the dict substrate.

    Quickstart

Quickstart

Production path (DB-backed):

from ai_cdss import RecommendationService

service = RecommendationService()
result = service.recommend_for_study(study_id=[2], n=12, days=7, protocols_per_day=5)

No-database demo (dict substrate — runs anywhere, see examples/recommend_usage.py). The block below is executed when these docs are built — the output underneath is real, not pasted:

from ai_cdss.engine import DictPatientState, DictSimilarity, ProtocolRow
from ai_cdss.recommender import Recommender

# A patient with two prescribed protocols (one low-scoring) plus a
# higher-scoring unused alternative to swap toward.
state = DictPatientState.from_rows(1, [
    ProtocolRow(1, 200, score=0.30, days=[0, 1], usage_week=2),
    ProtocolRow(1, 201, score=0.90, days=[2, 3], usage_week=2),
    ProtocolRow(1, 204, score=0.80),
    ProtocolRow(1, 205, score=0.75),
])
similarity = DictSimilarity({(200, 204): 0.91, (200, 205): 0.40})

result = Recommender(scoring=state, n=4, days=5, protocols_per_day=2).recommend(
    patient_id=1, protocol_similarity=similarity,
)
print("branch:      ", result.branch)
print("mvt_mean:    ", round(result.mvt_mean, 3))
print("swaps:       ", result.n_swaps)
print("final set:   ", result.final_protocols)
branch:       update
mvt_mean:     0.688
swaps:        1
final set:    [201, 204]

result is a RecommendationResult — every intermediate artifact (swaps, top-ups, MVT mean, trace) is a public attribute.