Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
gerardvanhulzen committed Sep 9, 2022
1 parent 003c458 commit 912dab7
Show file tree
Hide file tree
Showing 31 changed files with 163 additions and 187 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Type: Package
Title: Rule-Based Conformance Checking of Business Process Event Data
Version: 0.1.2
Date: 2019-11-05
Authors@R: person("Gert","Janssenswillen", email = "[email protected]",
role = c("aut","cre"))
Authors@R: c(person("Gert", "Janssenswillen", email = "[email protected]", role = c("aut","cre")),
person("Gerard", "van Hulzen", email = "[email protected]", role = c("ctb")))
Description: Check compliance of event-data from (business) processes with respect to specified rules. Rules supported are of three types: frequency (activities that should (not) happen x number of times), order (succession between activities) and exclusiveness (and and exclusive choice between activities).
License: MIT + file LICENSE
Encoding: UTF-8
Expand Down
4 changes: 1 addition & 3 deletions R/absent.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
#' @param n \code{\link{numeric}} (default \code{0}): The allowed number of occurences of the activity, e.g. `n = 0` means the activity should be absent,
#' `n = 1` means it is allowed to occur once.
#'
#' @family Existence rules
#'
#' @seealso \code{\link{contains}},\code{\link{contains_between}},\code{\link{contains_exactly}}
#' @family Cardinality rules
#'
#' @examples
#' library(bupaR)
Expand Down
4 changes: 1 addition & 3 deletions R/and.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
#' @param activity_a \code{\link{character}}: Activity A. This should be an activity of the log supplied to \code{\link{check_rule}}.
#' @param activity_b \code{\link{character}}: Activity B. This should be an activity of the log supplied to \code{\link{check_rule}}.
#'
#' @family Relation rules
#'
#' @seealso \code{\link{xor}}
#' @family Exclusiveness rules
#'
#' @examples
#' library(bupaR)
Expand Down
15 changes: 9 additions & 6 deletions R/check_rule.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,25 @@
#' \code{\link[bupaR]{eventlog}}, \code{\link[bupaR]{activitylog}}, etc.). and (a) `rule`(s).
#' Rules can be made with the following templates:
#' \itemize{
#' \item \emph{Existence}:
#' \item \emph{Cardinality}:
#' \itemize{
#' \item \code{\link{absent}}: Check if the specified activity is absent from a case,
#' \item \code{\link{contains}}: Check if the specified activity is present (contained) in a case,
#' \item \code{\link{contains_between}}: Check if the specified activity is present (contained) in a case between the minimum and maximum number of times,
#' \item \code{\link{contains_exactly}}: Check if the specified activity is present (contained) in a case for exactly `n` times,
#' \item \code{\link{ends}}: Check if cases end with the specified activity,
#' \item \code{\link{starts}}: Check if cases start with the specified activity.
#' \item \code{\link{contains_exactly}}: Check if the specified activity is present (contained) in a case for exactly `n` times.
#' }
#' \item \emph{Relation}:
#' \itemize{
#' \item \code{\link{and}}: Check for co-existence of two activities,
#' \item \code{\link{ends}}: Check if cases end with the specified activity,
#' \item \code{\link{starts}}: Check if cases start with the specified activity.
#' \item \code{\link{precedence}}: Check for precedence between two activities,
#' \item \code{\link{response}}: Check for response between two activities,
#' \item \code{\link{responded_existence}}: Check for responded existence between two activities,
#' \item \code{\link{succession}}: Check for succession between two activities,
#' \item \code{\link{succession}}: Check for succession between two activities.
#' }
#' \item \emph{Exclusiveness}:
#' \itemize{
#' \item \code{\link{and}}: Check for co-existence of two activities,
#' \item \code{\link{xor}}: Check for exclusiveness of two activities.
#' }
#' }
Expand Down
4 changes: 1 addition & 3 deletions R/contains.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
#' @param n \code{\link{numeric}} (default `1`): The minimum number of times the activity should be present.
#' Should be greater than or equal to `1`. Use \code{\link{absent}} instead to check for absent (i.e. `n = 0`) activities.
#'
#' @family Existence rules
#'
#' @seealso \code{\link{absent}},\code{\link{contains_between}},\code{\link{contains_exactly}}
#' @family Cardinality rules
#'
#' @examples
#' library(bupaR)
Expand Down
4 changes: 1 addition & 3 deletions R/contains_between.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
#' @param max \code{\link{numeric}} (default `1`): The maximum number of times the activity should be present (inclusive).
#' Should be greater than or equal to `min`.
#'
#' @family Existence rules
#'
#' @seealso \code{\link{absent}},\code{\link{contains}},\code{\link{contains_exactly}}
#' @family Cardinality rules
#'
#' @examples
#' library(bupaR)
Expand Down
4 changes: 1 addition & 3 deletions R/contains_exactly.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
#' @param n \code{\link{numeric}} (default `1`): The exact number of times the activity should be present.
#' Should be greater than or equal to `1`. Use \code{\link{absent}} instead to check for absent (i.e. `n = 0`) activities.
#'
#' @family Existence rules
#'
#' @seealso \code{\link{absent}},\code{\link{contains}},\code{\link{contains_between}}
#' @family Cardinality rules
#'
#' @examples
#' library(bupaR)
Expand Down
2 changes: 1 addition & 1 deletion R/ends.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#'
#' @param activity \code{\link{character}}: The end activity. This should be an activity of the log supplied to \code{\link{check_rule}}.
#'
#' @family Existence rules
#' @family Ordering rules
#'
#' @examples
#' library(bupaR)
Expand Down
15 changes: 9 additions & 6 deletions R/filter_rules.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,25 @@
#' \code{\link[bupaR]{eventlog}}, \code{\link[bupaR]{activitylog}}, etc.). and a set of `rules`.
#' Rules can be made with the following templates:
#' \itemize{
#' \item \emph{Existence}:
#' \item \emph{Cardinality}:
#' \itemize{
#' \item \code{\link{absent}}: Check if the specified activity is absent from a case,
#' \item \code{\link{contains}}: Check if the specified activity is present (contained) in a case,
#' \item \code{\link{contains_between}}: Check if the specified activity is present (contained) in a case between the minimum and maximum number of times,
#' \item \code{\link{contains_exactly}}: Check if the specified activity is present (contained) in a case for exactly `n` times,
#' \item \code{\link{ends}}: Check if cases end with the specified activity,
#' \item \code{\link{starts}}: Check if cases start with the specified activity.
#' \item \code{\link{contains_exactly}}: Check if the specified activity is present (contained) in a case for exactly `n` times.
#' }
#' \item \emph{Relation}:
#' \itemize{
#' \item \code{\link{and}}: Check for co-existence of two activities,
#' \item \code{\link{ends}}: Check if cases end with the specified activity,
#' \item \code{\link{starts}}: Check if cases start with the specified activity.
#' \item \code{\link{precedence}}: Check for precedence between two activities,
#' \item \code{\link{response}}: Check for response between two activities,
#' \item \code{\link{responded_existence}}: Check for responded existence between two activities,
#' \item \code{\link{succession}}: Check for succession between two activities,
#' \item \code{\link{succession}}: Check for succession between two activities.
#' }
#' \item \emph{Exclusiveness}:
#' \itemize{
#' \item \code{\link{and}}: Check for co-existence of two activities,
#' \item \code{\link{xor}}: Check for exclusiveness of two activities.
#' }
#' }
Expand Down
4 changes: 1 addition & 3 deletions R/precedence.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
#'
#' @inherit and params
#'
#' @family Relation rules
#'
#' @seealso \code{\link[edeaR]{filter_precedence}},\code{\link{responded_existence}},\code{\link{response}},\code{\link{succession}}
#' @family Ordering rules
#'
#' @examples
#' library(bupaR)
Expand Down
4 changes: 1 addition & 3 deletions R/responded_existence.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
#'
#' @inherit and params
#'
#' @family Relation rules
#'
#' @seealso \code{\link{precedence}},\code{\link{response}},\code{\link{succession}}
#' @family Ordering rules
#'
#' @examples
#' library(bupaR)
Expand Down
4 changes: 1 addition & 3 deletions R/response.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
#'
#' @inherit and params
#'
#' @family Relation rules
#'
#' @seealso \code{\link{precedence}},\code{\link{responded_existence}},\code{\link{succession}}
#' @family Ordering rules
#'
#' @examples
#' library(bupaR)
Expand Down
2 changes: 1 addition & 1 deletion R/starts.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#'
#' @param activity \code{\link{character}}: The start activity. This should be an activity of the log supplied to \code{\link{check_rule}}.
#'
#' @family Existence rules
#' @family Ordering rules
#'
#' @examples
#' library(bupaR)
Expand Down
4 changes: 1 addition & 3 deletions R/succession.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
#'
#' @inherit and params
#'
#' @family Relation rules
#'
#' @seealso \code{\link{precedence}},\code{\link{responded_existence}},\code{\link{response}}
#' @family Ordering rules
#'
#' @examples
#' library(bupaR)
Expand Down
4 changes: 1 addition & 3 deletions R/xor.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
#'
#' @inherit and params
#'
#' @family Relation rules
#'
#' @seealso \code{\link{and}}
#' @family Exclusiveness rules
#'
#' @examples
#' library(bupaR)
Expand Down
47 changes: 28 additions & 19 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,53 +18,62 @@ knitr::opts_chunk$set(
[![CRAN status](https://www.r-pkg.org/badges/version/processcheckR)](https://CRAN.R-project.org/package=processcheckR)
[![R-CMD-check](https://github.com/bupaverse/processcheckR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/bupaverse/processcheckR/actions/workflows/R-CMD-check.yaml)
[![Codecov](https://codecov.io/gh/bupaverse/processcheckR/branch/master/graph/badge.svg)](https://app.codecov.io/gh/bupaverse/processcheckR?branch=master)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
<!-- badges: end -->

The goal of processcheckR is to support rule-based conformance checking. Currently the following declarative rules can be checked:
The goal of **processcheckR** is to support rule-based conformance checking. Currently the following declarative rules can be checked:

Cardinality rules:

* `exists`: activity occurs n times or more
* `exists_exactly`: activity occurs exactly n times
* `absent`: activity does not occur more than n - 1 times
* `absent`: activity does not occur more than `n - 1` times,
* `contains`: activity occurs `n` times or more,
* `contains_between`: activity occurs between `n` and `m` times,
* `contains_exactly`: activity occurs exactly `n` times.

Ordering rules:

* `starts`: case starts with activity
* `ends`: case ends with activity
* `succession`: if activity A happens, B should happen after. If B happens, A should have happened before.
* `response`: if activity A happens, B should happen after
* `precedence`: if activity B happens, A should have happend before
* `responded_existence`: if activity A happens, B should also (have) happen(ed) (i.e. before or after A)
* `starts`: case starts with activity,
* `ends`: case ends with activity,
* `succession`: if activity A happens, B should happen after. If B happens, A should have happened before,
* `response`: if activity A happens, B should happen after,
* `precedence`: if activity B happens, A should have happened before,
* `responded_existence`: if activity A happens, B should also (have) happen(ed) (i.e. before or after A).

Exclusiveness:

* `and`: two activities always exist together
* `xor`: two activities are not allowed to exist together
* `and`: two activities always exist together,
* `xor`: two activities are not allowed to exist together.

Rules can be checked using the `check_rule` and `check_rules` functions (see example below). It will create a new logical variable to indicate for which cases the rule holds. The name of the variable can be configured using the `label` argument in `check_rule`.

Rules can be checked using the `check_rule` function (see example below). It will create a new logical variable to indicate for which cases the rule holds. The name of the variable can be configured using the `label` argument in `check_rule`.

## Installation

You can install processcheckR from github with:
You can install **processcheckR** from [CRAN](https://cran.r-project.org/) with:

```{r cran-installation, eval = FALSE}
install.packages("processcheckR")
```

### Development Version

You can also install the latest (stable) development version with bugfixes and new features directly from GitHub:

```{r gh-installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("gertjanssenswillen/processcheckR")
devtools::install_github("bupaverse/processcheckR")
```

## Example

## Example

```{r example}
library(bupaR)
library(processcheckR)
sepsis %>%
# check if cases starts with "ER Registration"
# Check if cases starts with "ER Registration".
check_rule(starts("ER Registration"), label = "r1") %>%
# check if activities "CRP" and "LacticAcid" occur together
# Check if activities "CRP" and "LacticAcid" occur together.
check_rule(and("CRP","LacticAcid"), label = "r2") %>%
group_by(r1, r2) %>%
n_cases()
Expand Down
59 changes: 35 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,57 @@ status](https://www.r-pkg.org/badges/version/processcheckR)](https://CRAN.R-proj
[![R-CMD-check](https://github.com/bupaverse/processcheckR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/bupaverse/processcheckR/actions/workflows/R-CMD-check.yaml)
[![Codecov](https://codecov.io/gh/bupaverse/processcheckR/branch/master/graph/badge.svg)](https://app.codecov.io/gh/bupaverse/processcheckR?branch=master)
[![Lifecycle:
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
<!-- badges: end -->

The goal of processcheckR is to support rule-based conformance checking.
Currently the following declarative rules can be checked:
The goal of **processcheckR** is to support rule-based conformance
checking. Currently the following declarative rules can be checked:

Cardinality rules:

- `exists`: activity occurs n times or more
- `exists_exactly`: activity occurs exactly n times
- `absent`: activity does not occur more than n - 1 times
- `absent`: activity does not occur more than `n - 1` times,
- `contains`: activity occurs `n` times or more,
- `contains_between`: activity occurs between `n` and `m` times,
- `contains_exactly`: activity occurs exactly `n` times.

Ordering rules:

- `starts`: case starts with activity
- `ends`: case ends with activity
- `succession`: if activity A happens, B should happen after. If B
happens, A should have happened before.
- `response`: if activity A happens, B should happen after
- `precedence`: if activity B happens, A should have happend before
- `responded_existence`: if activity A happens, B should also (have)
happen(ed) (i.e. before or after A)
- `starts`: case starts with activity,
- `ends`: case ends with activity,
- `succession`: if activity A happens, B should happen after. If B
happens, A should have happened before,
- `response`: if activity A happens, B should happen after,
- `precedence`: if activity B happens, A should have happened before,
- `responded_existence`: if activity A happens, B should also (have)
happen(ed) (i.e. before or after A).

Exclusiveness:

- `and`: two activities always exist together
- `xor`: two activities are not allowed to exist together
- `and`: two activities always exist together,
- `xor`: two activities are not allowed to exist together.

Rules can be checked using the `check_rule` function (see example
below). It will create a new logical variable to indicate for which
cases the rule holds. The name of the variable can be configured using
the `label` argument in `check_rule`.
Rules can be checked using the `check_rule` and `check_rules` functions
(see example below). It will create a new logical variable to indicate
for which cases the rule holds. The name of the variable can be
configured using the `label` argument in `check_rule`.

## Installation

You can install processcheckR from github with:
You can install **processcheckR** from
[CRAN](https://cran.r-project.org/) with:

``` r
install.packages("processcheckR")
```

### Development Version

You can also install the latest (stable) development version with
bugfixes and new features directly from GitHub:

``` r
# install.packages("devtools")
devtools::install_github("gertjanssenswillen/processcheckR")
devtools::install_github("bupaverse/processcheckR")
```

## Example
Expand All @@ -71,9 +82,9 @@ library(processcheckR)
#>
#> xor
sepsis %>%
# check if cases starts with "ER Registration"
# Check if cases starts with "ER Registration".
check_rule(starts("ER Registration"), label = "r1") %>%
# check if activities "CRP" and "LacticAcid" occur together
# Check if activities "CRP" and "LacticAcid" occur together.
check_rule(and("CRP","LacticAcid"), label = "r2") %>%
group_by(r1, r2) %>%
n_cases()
Expand Down
10 changes: 3 additions & 7 deletions man/absent.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 912dab7

Please sign in to comment.