How Ruby Powers One of the Most Complex Healthcare Systems in the World

Inside DENTIS, the cloud dental platform built by Medley, Inc.

In 2025, at RubyWorld Conference, Toshio Maki — Engineering Manager and Head of the Dental Clinic Business Unit at Medley, Inc. — presented one of the most impressive real-world applications of Ruby in modern healthcare p30-2.

The talk, titled:

“Ruby powering Dental DX – Development case of the cloud dental system DENTIS”

was not about frameworks or syntax. It was about how Ruby can be used to model one of the most complex regulatory, financial, and clinical systems in existence: Japanese dental healthcare.

Article content

What Is DENTIS?

DENTIS is a cloud-based dental clinic platform developed by Medley, Inc., a major Japanese healthcare technology company. It replaces legacy on-premise systems and unifies:

  • Appointment scheduling
  • Reception
  • Clinical records
  • Dental treatments
  • Insurance billing
  • Payments

into a single modern SaaS platform designed to improve both patient experience and clinic efficiency p30-2.


Why Japanese Dental Billing Is Exceptionally Complex

In Japan, medical billing is not a simple “insurance covers 80%” calculation.

A single visit can involve:

  • Multiple insurance systems
  • Age-based rules
  • Income-dependent copays
  • Public subsidies
  • National high-cost caps
  • Rare-disease funding

All of these overlap and change over time p30-2.

A real example

One case shown in the talk involves a 75+ year-old patient with rare-disease public funding:

Article content
Article content

How DENTIS Models Insurance in Ruby

Instead of storing a single “insurance” per patient, DENTIS models insurance as time-based records.

Each insurance and public funding entry contains:

  • Start date
  • End date
  • Copay rate
  • Income category
  • High-cost calculation rules

When billing occurs, DENTIS:

  1. Selects all insurance and subsidies active on that date
  2. Builds a payer combination
  3. Applies policy rules
  4. Allocates costs
  5. Computes the final patient amount

This is implemented as a Ruby-based domain engine that mirrors real-world policy logic p30-2.


Technical Deep Dive — Why ActiveRecord Callbacks Failed

Originally, DENTIS implemented its business logic using ActiveRecord callbacks.

This quickly collapsed.

A single medical action can trigger:

  • score recalculations
  • oral state changes
  • insurance re-evaluation
  • billing recomputation

Callbacks introduced:

  • hidden execution order
  • circular dependencies
  • side-effects that were impossible to reason about

Eventually, the team could no longer predict what would happen when one record changed p30-2.


Technical Deep Dive — Ruby as a Workflow Engine

DENTIS replaced callbacks with Interactor, a Clean Architecture orchestration layer.

Each business action becomes a transaction-safe pipeline:

Add treatment →
  validate →
  check insurance →
  update teeth →
  update prosthetics →
  recalc scores →
  apply modifiers →
  persist →
  notify

This gives:

  • explicit execution order
  • full rollback on failure
  • isolated business rules
  • predictable behavior

Ruby’s expressiveness makes these workflows readable and maintainable even as regulations change p30-2.


The Hardest Domain: Teeth

In dentistry, teeth are not static objects.

They can be:

  • extracted
  • filled
  • crowned
  • split
  • transplanted

And insurance depends on the exact state of each tooth on each date p30-2.


Why Snapshot Systems Failed

DENTIS first stored a full snapshot of all teeth after every change.

But when a past treatment was corrected, every future snapshot became wrong.

Fixing history became computationally and logically impossible p30-2.


Technical Deep Dive — Event-Based Teeth with SQL

The final solution was elegant.

Each tooth stores its own event history:

  • tooth id
  • status
  • timestamp
  • sequence
  • linked treatment

To reconstruct the mouth at any date, SQL selects the latest record per tooth before that date.

This is:

  • event sourcing
  • temporal querying
  • full historical accuracy

implemented entirely with Rails and PostgreSQL p30-2.


Why Ruby Is the Right Tool for This

DENTIS is:

  • highly regulated
  • constantly changing
  • extremely domain-heavy

Ruby excels at:

  • domain modeling
  • rule engines
  • clean architecture
  • refactoring under regulatory change

This system proves Ruby can power national-scale healthcare platforms, not just startups.

Article content

Final Thought

The DENTIS platform, built by Medley, Inc. and presented by Toshio Maki at RubyWorld Conference 2025, is one of the strongest examples of Ruby solving real-world complexity at scale.

It reminds us that:

When software must model human systems — laws, medicine, and policy — Ruby remains one of the most powerful tools we have.

Article content

Leave a comment