Instruction State Machine


From Figure 25. in the specifications about the ISM, it appears that an activity is always in state initial as long as there is no associated action for it. In order to transfer it e.g. into planned state, it seems that at least one action is required. In order to reach the completed state, at least two actions seem to be required. Is that correct? If so, should the initial action to transfer into state planned be in the archetype containing the instruction, or should it be submitted separately?

1 Like

Can you add the link to the specification that you are looking at?

Sorry, here it is:

Firstly here’s a useful quick link to the ISM state machine.

Secondly, yes, the normal action that causes the activity (say, an order, like a prescription) to transition to planned is the creation of the Instruction, which represents the order. But you can also schedule an activity (usually = order + booking), and even just start it (no order at all, e.g. ICU medication).

1 Like

Thank you for your quick answer.

If I understand correctly, all transitions you describe require an action. That action can already be part of the archetype containing the instruction?

The Actions will be described in an ACTION archetype, not the INSTRUCTION archetype, which always seems counter-intuitive initially (why aren’t the possible actions to do with the order I modelled in this Instruction archetype not also in that archetype?), but is sort of obvious when you understand:

  • the Instruction type corresponds to an order; one order can lead to a lot of actions; therefore an Instruction (say, for medication order, or radiology order) have just that one thing in it
  • the Action typed corresponds to the many actions that may flow from an order. Therefore, the possible actions for a particular kind of order will almost always be found in a matching Action archetype.

Have a look on CKM to see examples.

1 Like

Thank you for clarifying this. This really helps. Maybe I should have asked more precisely: a template containing an INSTRUCTION archetype could also already contain some ACTION archetypes for actions that have been taken?

That’s certainly true, but the experts who can answer in more detail include people who do such modelling in real projects. If you pose this question (and link to here) in the clinical category you will certainly get some response.

Hello Thomas,

You write that the creation of an instruction can put the activity in the planned state. That would make sense, as some activities are more like items in a to-do list, where you create the activity, and the only action you ever perform is to complete or to cancel it. For this you need the activity to be in the planned state, as there is no direct transition from initial to completed.
However, there is no way to specify any transition in the instruction or activity class, and initial state is specified to always be ‘initial’ - not planned.

So how does one solve that? Add an immediate action to the template? Record two actions at once when completing, even though the user sees only one? Ignore the state machine in the spec and just start these things in planned automatically? Add an extra annotation in the archetype detailing what to do? All of these seem a bit less than ideal solutions, and this sounds like a problem that has been solved before :slight_smile:

Well, here the ‘planned’ state refers to the state of the real-world activity, e.g. it is planned (i.e. intended) that patient 157 receive medication abc starting on date D, dose x, … etc.

Usually Instructions area created in the first instance in this state. Now, it is possible that you could create an Instruction representing a ‘draft’ prescription, or an incomplete order, waiting to be completed before it is considered real, in which case the initial state would be initial. I don’t know if any systems allow such Instructions, but it would be be interesting to ask the implementers.

For the more normal Instructions I think I would just create them in the Planned state, i.e. as if a transition from Initial to Planned had been magically done.