<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Behaviour-Driven Development for Computer-Interpretable Clinical Guidelines</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Reinhard Hatko</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Stefan Mersmann</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Frank Puppe</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Drger Medical GmbH</institution>
          ,
          <addr-line>Lbeck</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Institute of Computer Science, University of Wrzburg</institution>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>In this paper, we propose an approach for specication and analysis of Computer-Interpretable Clinical Guidelines (CIGs) that was inspired by Behaviour-Driven Development. The expected behaviour of a CIG is specied by requirements in natural language. On the one hand, those requirements are used as design input for guideline development. On the other hand, they can be checked against time-oriented data recorded during testing sessions of the implemented CIG.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>Behaviour-Driven Development (BDD) is an agile Software Engineering (SE)
methodology, that conforms to the Test-First principle: Test cases are
developed previous to the software system itself. In BDD, executable test cases are
directly derived from requirements stated in natural language, by employing a
pattern matching approach. This enables stakeholders to actively participate in
the denition of requirements, which are a fundamental design input for the
system under development.</p>
      <p>In contrast to other Test-First approaches (like Test-Driven Development),
BDD focuses on the creation of acceptance tests rather than unit tests. The
former ones assure the acceptance of the system by its users, as the system’s
ability to fulll their needs with respect to a business value is tested. The latter
ones perform testing on a lower system level by checking individual program
constructs. This has the potential to reduce the number of defects at an early
stage of the software development process.</p>
      <p>Scenario : t r a d e r i s not a l e r t e d below t h r e s h o l d</p>
      <p>Given a s t o c k o f symbol STK1 a t a t h r e s h o l d o f 1 0 . 0
When t h e s t o c k i s t r a d e d a t 5 . 0</p>
      <p>Then t h e a l e r t s t a t u s s h o u l d be OFF
Scenario : t r a d e r i s a l e r t e d above t h r e s h o l d</p>
      <p>Given a s t o c k o f symbol STK1 a t a t h r e s h o l d o f 1 0 . 0
When t h e s t o c k i s t r a d e d a t 1 1 . 0</p>
      <p>Then t h e a l e r t s t a t u s s h o u l d be ON</p>
      <p>
        BDD frameworks exist for several programming languages, e.g. JBehave 3
(Java) or RSpec [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] (Ruby). As a commonality, those frameworks oer some kind
of Domain-Specic Language (DSL) for dening scenarios, and a mechanism to
derive executable test code by some sort of pattern matching, usually regular
expressions. One such DSL which is employed in multiple frameworks is called
the Gherkin language [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. Figure 1 shows an exemplary usage of Gherkin. The
scenarios consist of the following three groups:
      </p>
      <p>The keyword GIVEN sets up the test environment by creating the specic
context which is necessary to execute the test.</p>
      <p>Second, the functionality under test is executed (keyword WHEN).
Lastly, the outcome of the previous step is compared against the expected
one (keyword THEN).</p>
      <p>Each group can contain several steps that are joined together using the
keyword AND. Each step in turn, is backed by a step template (also called support
code ), that converts the text into executable program code using regular
expressions, e.g. to extract method parameters. Figure 2 shows the step templates
needed to execute both scenarios shown in Figure 1.</p>
      <p>As each step is individually backed by support code, steps can arbitrarily
be combined to create new acceptance tests. Thanks to the comprehensibility
of Gherkin and the use of natural language, scenarios can easily be created also
3 http://jbehave.org
p u b l i c c l a s s T r a d e r S t e p s {
p r i v a t e Stock s t o c k ;
@Given ( "a s t o c k o f symbol $sym at a t h r e s h o l d o f $ t h r " )
p u b l i c v o i d aStock ( S t r i n g sym , double t h r ) {</p>
      <p>s t o c k = new Stock ( sym , t h r ) ; }
@When( " the s t o c k i s t r a d e d at $ p r i c e " )
p u b l i c v o i d theStockIsTradedAt ( double p r i c e ) {</p>
      <p>s t o c k . tradeAt ( p r i c e ) ; }
@Then( " the a l e r t s t a t u s s h o u l d be $ s t a t " )
p u b l i c v o i d t h e A l e r t S t a t u s S h o u l d B e ( S t r i n g s t a t ) {</p>
      <p>
        ensureThat ( s t o c k . g e t S t a t u s ( ) . name ( ) , equalTo ( s t a t ) ) ; }
}
by non-programmers, e.g. the future users of the software themselves. That way,
a ubiquitous language [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] is created, that improves communication between all
participants involved in the software development process, e.g., product owner,
software engineers, testers, and users.
3
      </p>
    </sec>
    <sec id="sec-2">
      <title>Specication of Clinical Guidelines</title>
      <p>In the remainder of this section, we describe an approach for the specication of
automated CIGs following the BDD methodology. The CIG behaviour is
specied as a set of scenarios expressed in the Gherkin language:</p>
      <p>The GIVEN group of a scenario describes the precondition in terms of the
patient’s current state, and possibly also its past progression.</p>
      <p>The expected therapeutic action, i.e. the output of the CIG for the given
patient state, is expressed in the WHEN part of the scenario.</p>
      <p>The THEN group contains assumptions about the future (improved) patient
state, based on the therapeutic action. As the eects will take some time
until they are measurable, usually a temporal annotation is included.</p>
      <p>There is a main dierence between the SE acceptance tests as described in
the previous section and the CIG scenarios. While the former ones are actively
preparing the test context and executing the function under test, the latter ones
can only passively be evaluated on data a patient delivered. The CIG scenarios
are interpretable descriptions of patterns that are supposed to occur in patient
data, given that the CIG has correctly been implemented based on an error-free
specication.</p>
      <p>
        After implementing the CIG based on the dened scenarios, test cases can be
recorded, e.g. using a patient simulator [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. The data consists of time-stamped
recordings of the patient state and the according therapy over the course of
the session. Therapeutic actions are changes of the medical device’s settings
applied automatically according to the underlying CIG. By checking the scenarios
against a test case, two types of errors can be discovered: First, the designated
therapeutic action ( WHEN-group) may not occur due to a bug in the
implementation (error of omission), although the current patient state fullls the
precondition of the scenario ( GIVEN-group). Second, if the precondition as well as the
action of a scenario are met, but not the expected change in the patient’s state,
the assumptions about the state may not be correct in the rst place. While the
rst error is most likely rooted in the implementation of the CIG, the second
kind of error may arise from an improper specication itself.
4
      </p>
    </sec>
    <sec id="sec-3">
      <title>Case Study</title>
      <p>
        We have implemented an extension for the Semantic Wiki KnowWE that
supports the described approach. Each step template consists of a regular expression
containing capturing groups enriched by a type system, and a formal condition
with the according placeholders. When using step templates, the placeholders are
lled with terms from a predened ontology, that contains the data denitions
of the CIG (cf. Figure 3, left side). The ontology is created as the foundation for
the fully formalized CIG [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. Scenarios are expressed by arbitrarily combining
steps. If a step can not be matched against a template, an error is reported. This
leads to the denition of new templates, incrementally increasing the range of
expressible scenarios as needed (cf. Figure 3, right side).
      </p>
      <p>The results of the scenario analysis with respect to a test case are
visualized on an interactive timeline, that can be panned and zoomed, cf. Figure 4.
Each band corresponds to exactly one scenario. At each instant of time, an icon
represents the result, if the scenario’s precondition is fullled: omitted
therapeutic action (red warning sign), unfullled postcondition (yellow warning sign),
and fully satised scenario (green checkmark), respectively. The timeline is
integrated into KnowWE’s testing framework. Replaying the test case to any instant
in time is possible to introspect CIG execution for debugging purposes.</p>
      <p>
        For the evaluation of the presented approach, we are currently working on a
case study with a real world CIG and patient data from a previous study
conducted at the Department of Anesthesiology and Intensive Care Medicine,
University Medical Center Schleswig-Holstein, Campus Kiel [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. During this study,
150 patients have been automatically weaned from mechanical ventilation by the
automatic weaning system SmartCare/PS R [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. SmartCare/PS is a
knowledgebased software option for Drger’s mechanical ventilators Evita XL and Evita
Innity V500. SmartCare/PS stabilizes the patient’s spontaneous breathing in
a respiratory comfort zone, while gradually reducing the inspiratory support of
the ventilator until the patient is ready for extubation. The system’s underlying
CG is further depicted in [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ].
      </p>
      <p>This study does not investigate the usage of the derived specication as a
design input. It focuses on the applicability of the approach in terms of usability
and expressiveness, and its usage for analysing the test cases regarding the
scenarios. The CIG behaviour has been specied using natural language scenarios
as described herein. By exploiting strict naming conventions regarding the
labeling of related data, e.g. measurements and their corresponding upper and lower
limits, only a rather limited set of about 15 step templates needed to be
dened. This allows for fast requirements elicitation and also reduces maintenance
eorts.
5</p>
    </sec>
    <sec id="sec-4">
      <title>Conclusion</title>
      <p>In this paper, we have described an approach inspired by Behaviour-Driven
Development for specication and analysis of Computer-Interpretable Clinical
Guidelines. Requirements stated by medical experts in natural language are
used as design input for the development of CIGs and their analysis using test
cases. We demonstrated the applicability of Behaviour-Driven Development for
CIGs using an extension for the Semantic Wiki KnowWE. Currently, we are
conducting a case study focusing on the analysis aspect. A real world CIG and
test cases from a real patient study are used for evaluation. So far, the approach
has shown its applicability in terms of usability and expressiveness. In the near
future, the results of the scenarios will be analysed by medical experts.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Chelimsky</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Astels</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dennis</surname>
            ,
            <given-names>Z.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hellesoy</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Helmkamp</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>North</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          :
          <article-title>The RSpec Book: Behaviour Driven Development with RSpec, Cucumber, and</article-title>
          <string-name>
            <given-names>Friends. The</given-names>
            <surname>Pragmatic</surname>
          </string-name>
          <string-name>
            <given-names>Programmers</given-names>
            , United
            <surname>States</surname>
          </string-name>
          (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Evans</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          :
          <string-name>
            <surname>Domain-Driven</surname>
            <given-names>Design</given-names>
          </string-name>
          :
          <article-title>Tackling Complexity in the Heart of Software</article-title>
          .
          <string-name>
            <surname>Addison-Wesley</surname>
            <given-names>Longman</given-names>
          </string-name>
          , Amsterdam,
          <volume>1</volume>
          <fpage>edn</fpage>
          . (
          <year>2003</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Hatko</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Baumeister</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Belli</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Puppe</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          :
          <article-title>DiaFlux: A graphical language for computer-interpretable guidelines</article-title>
          . In: Riaaeo,
          <string-name>
            <given-names>D.</given-names>
            , ten
            <surname>Teije</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            ,
            <surname>Miksch</surname>
          </string-name>
          , S. (eds.)
          <source>Knowledge Representation for Health-Care, Lecture Notes in Computer Science</source>
          , vol.
          <volume>6924</volume>
          , pp.
          <fpage>94107</fpage>
          . Springer, Berlin / Heidelberg (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Hatko</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schdler</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mersmann</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Baumeister</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Weiler</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Puppe</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          :
          <article-title>Implementing an Automated Ventilation Guideline Using the Semantic Wiki KnowWE</article-title>
          . In: ten Teije,
          <string-name>
            <given-names>A.</given-names>
            ,
            <surname>Vlker</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            ,
            <surname>Handschuh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            ,
            <surname>Stuckenschmidt</surname>
          </string-name>
          , H.,
          <string-name>
            <surname>d'Aquin</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nikolov</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Aussenac-Gilles</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hernandez</surname>
          </string-name>
          , N. (eds.)
          <source>EKAW. Lecture Notes in Computer Science</source>
          , vol.
          <volume>7603</volume>
          , pp.
          <fpage>363372</fpage>
          . Springer (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Lellouche</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mancebo</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Jolliet</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Roeseler</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schortgen</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dojat</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Cabello</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bouadma</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rodriguez</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Maggiore</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Reynaert</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mersmann</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Brochard</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          :
          <article-title>A multicenter randomized trial of computer-driven protocolized weaning from mechanical ventilation</article-title>
          .
          <source>American journal of respiratory and critical care medicine 174(8)</source>
          ,
          <volume>894900</volume>
          (Oct
          <year>2006</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Mersmann</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dojat</surname>
            ,
            <given-names>M.:</given-names>
          </string-name>
          <article-title>SmartCare/PS-Automated Clinical Guidelines in Critical Care</article-title>
          . In: de MÆntaras, R.L.,
          <string-name>
            <surname>Saitta</surname>
            ,
            <given-names>L</given-names>
          </string-name>
          . (eds.)
          <source>Proceedings of the 16th Eureopean Conference on AI, ECAI'2004</source>
          . pp.
          <fpage>745749</fpage>
          . IOS Press 2004, Valencia, Spain (
          <year>2004</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Neumann</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schmidt</surname>
          </string-name>
          , H.: SmartCare R /PS The automated weaning protocol (
          <year>2010</year>
          ), http://www.draeger.net/media/10/01/35/10013505/ smartcare_auto_weaning_protocol_booklet.pdf
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Schdler</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Engel</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Elke</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Pulletz</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Haake</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Frerichs</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zick</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Scholz</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Weiler</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          :
          <article-title>Automatic control of pressure support for ventilator weaning in surgical intensive care patients</article-title>
          .
          <source>American journal of respiratory and critical care medicine 185(6)</source>
          ,
          <volume>63744</volume>
          (Mar
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>