API Reference#

This page provides an overview the extension DCR4Py for pm4py.

Note the pm4py.discovery, pm4py.conformance etc. contain the top level api calls for pm4py, in which the function found here have been implemented. However the subpackages should only the implemented extension.

Process Discovery (pm4py.discovery)#

DCR4Py allows for discovery of DCR graphs. Note that the implemented algorithm always discover a perfect fitting graph.

Conformance Checking (pm4py.conformance)#

DCR4Py contains two conformance checking methods:

Visualization (pm4py.vis)#

DCR4Py allow visualization of DCR graphs and storing them.

Read (pm4py.read and pm4py.write)#

DCR4Py can import and export dcr graphs as xml.

Conversion (pm4py.convert)#

DCR4Py also allows for the conversion of a DCR graph to petri net. The current existing function within pm4py has been extended to also handle DCR graphs.

Overall List of Methods#

pm4py.read.read_dcr_xml(file_path, **parameters)

Reads a DCR graph from an XML file :param file_path: path to the DCR graph :param parameters: parameters of the importer :rtype: DCR .. code-block:: python3 import pm4py dcr = pm4py.read_dcr_xml("<path_to_dcr_file>", variant).

pm4py.write.write_dcr_xml(dcr_graph, path, ...)

Writes a DCR graph object to disk in the .xml file format (exported as .xml file).

pm4py.convert.convert_to_petri_net(obj, ...)

Converts an input model to an (accepting) Petri net.

pm4py.discovery.discover_dcr(log[, ...])

Discovers a DCR graph from an event log based on the DisCoveR algorithm. This method implements the DCR discovery algorithm as described in: C. O. Back, T. Slaats, T. T. Hildebrandt, M. Marquard, "DisCoveR: accurate and efficient discovery of declarative process models". Parameters ---------- log : Union[EventLog, pd.DataFrame] The event log or Pandas dataframe containing the event data. post_process : Optional[str] Specifies the type of post-processing for the event log, currently supports ROLES, PENDING, TIMED and NESTINGS. activity_key : str, optional The attribute to be used for the activity, defaults to "concept:name". timestamp_key : str, optional The attribute to be used for the timestamp, defaults to "time:timestamp". case_id_key : str, optional The attribute to be used as the case identifier, defaults to "case:concept:name". group_key : str, optional The attribute to be used as a role identifier, defaults to "org:group". resource_key : str, optional The attribute to be used as a resource identifier, defaults to "org:resource". findAdditionalConditions : bool, optional A boolean value specifying whether additional conditions should be found, defaults to True. Returns ------- Tuple[Any, dict] A tuple containing the discovered DCR graph and a dictionary with additional information. Examples -------- .. code-block:: python3 import pm4py graph, la = pm4py.discover_DCR(log).

pm4py.conformance.conformance_dcr(log, dcr_graph)

Applies rule based conformance checking against a DCR model.

pm4py.conformance.optimal_alignment_dcr(log, ...)

Applies optimal alignment against a DCR model. Reference paper: Axel Kjeld Fjelrad Christfort & Tijs Slaats. "Efficient Optimal Alignment Between Dynamic Condition Response Graphs and Traces" https://doi.org/10.1007/978-3-031-41620-0_1 Parameters ---------- log : EventLog | pd.DataFrame | Trace Event log to be used for alignment. also supports Trace dcr_graph : DCRGraph The DCR graph against which the log is aligned. activity_key : str The key to identify activity names in the log. timestamp_key : str The key to identify timestamps in the log. case_id_key : str The key to identify case identifiers in the log. return_diagnostics_dataframe : bool, default False If True, returns a diagnostics dataframe instead of the usual list output. Returns ------- Union[pd.DataFrame, List[Tuple[str, Dict[str, Any]]]] Depending on the value of return_diagnostics_dataframe, returns either a pandas DataFrame with diagnostics or a list of alignment results. Raises ------ Exception If the log provided is not an instance of EventLog or pandas DataFrame. Examples -------- .. code-block:: python3 import pm4py graph, la = pm4py.discover_DCR(log) conf_res = pm4py.optimal_alignment_dcr(log,graph).

pm4py.vis.view_dcr(dcr[, format, bgcolor, ...])

Views a DCR graph

pm4py.vis.save_vis_dcr(dcr, file_path[, ...])

Saves the visualization of a DCR graph