Engineering · Legal tech

A legal matter is a graph, not a checklist

Case management software usually models a matter as a list of stages. Real matters fork, wait and run in parallel. How we built a process engine for law firms that branches on outcomes, closes the paths not taken, and works out its own deadlines.

Pikabyte Engineering 5 min read

10

Malaysian legal procedures modelled as branching graphs in CaseWork's process library

Ask a litigator where a matter stands and you will not get a stage number. You will get something like: the expert report is back and it is supportive, the letter of demand went out last week, we are waiting twenty-one days for a response, and in the meantime the records request is still outstanding.

That is not a checklist. It is a graph: several things in motion, some waiting on others, some never going to happen because of a decision already made.

Most case management tools flatten this into a list of stages. We are building CaseWork, a case management platform for law firms, around the graph instead. This is how it works and why the details matter.

Steps and dependencies

A procedure is a set of steps joined by dependencies: this step cannot start until that one is done. Every step has a type, because not everything on a matter is the firm’s own action.

  • Action by the firm: draft, file, serve
  • Waiting period: time that simply has to pass
  • Awaiting the other side: an appearance, a defence
  • Court event: a hearing, case management
  • External milestone: such as close of pleadings

Separating these changes what the system can tell a partner. “Fourteen matters are waiting on the other side” is a different fact from “fourteen matters are waiting on us”.

Forks: outcomes decide the route

Some steps end in a decision. An expert report is supportive, or it is not. A demand produces a settlement offer, or silence.

In CaseWork a step can declare its possible outcomes, and it must then be completed with one of them. A dependency can require a specific outcome. So “issue the letter of demand” depends on the expert report with the outcome supportive, and “advise the client there is no viable claim” depends on the same step with the outcome not supportive.

Complete the report as supportive and one branch opens. The other needs handling too, and this is where a naive design goes wrong.

The path not taken has to close itself

If the unsupportive branch simply stays blocked, the matter can never look finished. Fourteen steps, eight that will never happen, and a progress bar stuck forever.

So the engine resolves every dependency into one of four states:

  • Satisfied. The earlier step finished with the outcome this route asked for.
  • Dead. The earlier step finished with a different outcome. This route was rejected.
  • Vacuous. The earlier step never happened on this matter at all.
  • Pending. Not finished yet.

The difference between dead and vacuous is subtle and it is what makes joins behave.

Take a step that needs both a supportive expert report and a pre-action notice served on the Attorney General. The notice only applies when the defendant is a government hospital. For a private hospital, that notice step is not applicable, so its edge is vacuous: nothing was rejected, the requirement just does not exist here. The joined step should still run.

If the report comes back unsupportive, that edge is dead. The step must not run.

So a step that waits for all its predecessors ignores vacuous edges and is killed by a dead one. A step that waits for any one predecessor needs a single satisfied edge, and is closed only when none can ever arrive. A step nothing can reach becomes not applicable, and that status flows forward through everything that depended on it.

The result is a progress counter that says six of fourteen and means it.

Deadlines from rules

Lawyers live by dates, and most dates follow from other dates. Each step carries a duration and an anchor: what the duration is counted from.

  • When the steps before it were completed
  • When the process started
  • When the step itself was started
  • A date entered by hand, such as a hearing date

Durations can be in calendar days or working days. That is not a nicety. Some regimes, such as adjudication under CIPAA 2012, count working days, and a tool that quietly treats them as calendar days is wrong at every stage.

We made one deliberate limitation and state it in the product. Working days skip weekends. They do not skip public holidays, because Malaysian holidays differ by state, and again in Sabah and Sarawak. A national holiday table would be wrong for most firms. A limitation the user can see is better than an inaccuracy they cannot.

Each step also has an alert window. Live steps show a countdown, and overdue and due-soon steps reach the lawyer through a notification bell and a My Work page that lists everything assigned to them across all matters, most urgent first.

The same case, two views

The graph is drawn as an interactive diagram: nodes coloured by state, outcome labels on the forks, a minimap for long procedures. For daily work there is also a timeline view of the same data. People switch between them depending on whether they are asking “what next?” or “how did we get here?”.

A library, so nobody starts from nothing

Building a graph for a whole procedure is real work, so CaseWork ships with ten Malaysian procedures already modelled, including medical negligence, debt collection, defamation, probate, divorce and construction adjudication. A firm previews one as a graph, adopts it, and gets its own editable copy that records which library version it came from.

The periods in the library are the statutory or rules-based ones where they exist and working estimates otherwise. They are starting points for a firm to check and adjust, not legal advice.

Variables without a developer

The second half of the design is data. Every firm, and every matter type, needs different fields. In CaseWork a firm adds its own: text, number, date or financial. The same definition does three jobs:

  1. It appears on the case form.
  2. It can become a filter on the case list.
  3. Its code is a variable in the firm’s Word templates.

Add a field called “Hospital name” and {{ hospital_name }} works in a letter immediately. If a template uses a variable the case has not filled, the placeholder is left in the document and reported, so a blank never goes out unnoticed.

What this is for

The point of all of it is that a firm can take on a new kind of work without commissioning software. Define the matter type, add the fields, adopt or draw the procedure, upload the templates.

CaseWork is in development and not yet in production. The engine described here is built and tested. We are writing about it now because the modelling problem is interesting, and because the idea transfers. Any business whose work branches on decisions, from insurance claims to construction approvals, is running a graph whether its software admits it or not.

Written by

Pikabyte Engineering

Pikabyte builds custom business systems, applied AI and secure cloud infrastructure from Malaysia. Talk to us.

The work behind this article

Platform · Legal · Case management

In development

Every matter as a living graph: what is done, what is due, and which way the case went.

A case management platform for law firms of any practice. Each firm defines its own matter types, its own data fields and its own document templates, then runs every case against a process graph that branches on outcomes, works out its own deadlines and shows each lawyer what is due.

10
Malaysian procedures in the built-in process library
5
kinds of step: firm action, waiting period, other side, court event, milestone
4
field types a firm can add: text, number, date, financial
183
automated backend tests
Tour CaseWork A Pikabyte product for law firms · Malaysia

Start a conversation

Want this applied to your business?

Tell us what is slowing the business down. You will talk to an engineer, not a salesperson, and get a straight answer on whether software is the right fix.