Skip to content

Commit 4b54196

Browse files
committed
Fix: OC-DECLARE statistics
1 parent 809cead commit 4b54196

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

backend/shared/src/oc_declare/statistics.rs

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -77,31 +77,30 @@ pub fn get_activity_statistics(locel: &SlimLinkedOCEL, activity: &str) -> Activi
7777
}
7878
}
7979

80-
pub fn get_edge_stats(_locel: &SlimLinkedOCEL, _arc: &OCDeclareArc) -> Vec<i64> {
81-
todo!();
82-
// EventOrSynthetic::get_all_syn_evs(
83-
// locel,
84-
// arc.from.as_str(),
85-
// )
86-
// .iter()
87-
// .flat_map(|ev_index| {
88-
// let ev_time = ev_index.get_timestamp(locel);
89-
// arc.label
90-
// .get_bindings(ev_index, locel)
91-
// .flat_map(move |binding| {
92-
// let target_ev_iterator = get_evs_with_objs_perf(&binding, locel, arc.to.as_str())
93-
// .filter(|ev2| {
94-
// let ev2_time = ev2.get_timestamp(locel);
95-
// match arc.arc_type {
96-
// OCDeclareArcType::EF | OCDeclareArcType::DF => ev_time < ev2_time,
97-
// OCDeclareArcType::EP | OCDeclareArcType::DP => ev_time > ev2_time,
98-
// OCDeclareArcType::AS => true,
99-
// }
100-
// });
101-
// // First event (could also implement this for last, or all matching target events)
102-
// let first_ev = target_ev_iterator.min_by_key(|e| e.get_timestamp(locel));
103-
// first_ev.map(|ev2| (ev2.get_timestamp(locel) - ev_time).num_milliseconds())
104-
// })
105-
// })
106-
// .collect()
80+
pub fn get_edge_stats(locel: &SlimLinkedOCEL, arc: &OCDeclareArc) -> Vec<i64> {
81+
EventOrSynthetic::get_all_syn_evs(
82+
locel,
83+
arc.from.as_str(),
84+
)
85+
.iter()
86+
.flat_map(|ev_index| {
87+
let ev_time = ev_index.get_timestamp(locel);
88+
arc.label
89+
.get_bindings(ev_index, locel)
90+
.flat_map(move |binding| {
91+
let target_ev_iterator = process_mining::conformance::oc_declare::get_evs_with_objs_perf(&binding, locel, arc.to.as_str())
92+
.filter(|ev2| {
93+
let ev2_time = ev2.get_timestamp(locel);
94+
match arc.arc_type {
95+
OCDeclareArcType::EF | OCDeclareArcType::DF => ev_time < ev2_time,
96+
OCDeclareArcType::EP | OCDeclareArcType::DP => ev_time > ev2_time,
97+
OCDeclareArcType::AS => true,
98+
}
99+
});
100+
// First event (could also implement this for last, or all matching target events)
101+
let first_ev = target_ev_iterator.min_by_key(|e| e.get_timestamp(locel));
102+
first_ev.map(|ev2| (ev2.get_timestamp(locel) - ev_time).num_milliseconds())
103+
})
104+
})
105+
.collect()
107106
}

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"react-force-graph-2d": "^1.25.5",
5050
"react-hook-form": "^7.54.2",
5151
"react-hot-toast": "^2.4.1",
52-
"react-icons": "^4.11.0",
52+
"react-icons": "^5.5.0",
5353
"react-plotly.js": "^2.6.0",
5454
"react-router-dom": "^6.18.0",
5555
"react-virtualized-auto-sizer": "^1.0.24",

frontend/src/routes/oc-declare/flow/OCDeclareFlowEdge.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { getEdgeParams } from './edge-helpers';
1717
import { getRandomStringColor } from "@/lib/random-colors";
1818
import { ContextMenuArrow } from '@radix-ui/react-context-menu';
1919
import React, { Fragment, useContext, useEffect, useMemo, useState } from "react";
20-
import { LuArrowLeft, LuArrowLeftRight, LuArrowRight, LuHash, LuShapes, LuTrendingUp, LuXCircle } from 'react-icons/lu';
20+
import { LuArrowLeft, LuArrowLeftRight, LuArrowRight, LuBadgeCent, LuBadgeCheck, LuCircleX, LuHash, LuShapes, LuTimer, LuTrendingUp } from 'react-icons/lu';
2121
const asSvg = "/as.svg";
2222
const dfSvg = "/df.svg";
2323
const dpSvg = "/dp.svg";
@@ -163,7 +163,7 @@ export default function OCDeclareFlowEdge(edge: EdgeProps<CustomEdgeType> & { da
163163
const res = await toast.promise(backend['ocel/evaluate-oc-declare-arcs']([flowEdgeToOCDECLARE(edge,flow)]), { loading: "Evaluating...", error: "Evaluation Failed", success: "Evaluated!" });
164164
flow.updateEdgeData(id, { violationInfo: { violationPercentage: 100 * res[0] } })
165165
}}>
166-
<TbDiscountCheckFilled className='size-4 mr-1' />
166+
<LuBadgeCheck className='size-4 mr-1' />
167167
Evaluate
168168
</ContextMenuItem>
169169

@@ -353,13 +353,14 @@ import { getTypesRelationshipSupport } from "@/lib/variable-hints";
353353
import { SupportDisplay } from "@/routes/visual-editor/helper/box/FilterOrConstraintEditor";
354354
import toast from "react-hot-toast";
355355
import { MdBarChart } from "react-icons/md";
356-
import { TbDiscountCheckFilled } from "react-icons/tb";
356+
import { TbTagFilled } from "react-icons/tb";
357357
import { ObjectTypeAssociation } from "../types/ObjectTypeAssociation";
358358
import { OCDeclareArcLabel } from "../types/OCDeclareArcLabel";
359359
import { MinMaxDisplayWithSugar } from "./MinMaxSugar";
360360
import { flowEdgeToOCDECLARE, getArcTypeDisplayName } from "./oc-declare-flow-type-conversions";
361361
import { ActivityNodeData, ActivityNodeType, ALL_EDGE_TYPES, CustomEdgeType, EdgeType } from "./oc-declare-flow-types";
362362
import { getMarkersForEdge } from "./OCDeclareFlowEditor";
363+
import { IoPlay } from "react-icons/io5";
363364

364365
function EditEdgeLabelsDialog({ open, initialValue, onClose, colors, sourceAct, targetAct }: { open: boolean, initialValue: OCDeclareArcLabel, sourceAct: ActivityNodeData, targetAct: ActivityNodeData, onClose: (newValue?: OCDeclareArcLabel) => unknown, colors?: { type: string, color: string }[] },) {
365366
const [value, setValue] = useState({ ...initialValue });
@@ -392,7 +393,7 @@ function EditEdgeLabelsDialog({ open, initialValue, onClose, colors, sourceAct,
392393
setAddValue({ mode: t, t: ot })
393394
}} className="border p-1 rounded relative">
394395
<ShowObjectTypeAssociation t={ot} colors={colors} />
395-
<LuXCircle className="absolute size-5 -right-2 -top-2 text-red-400 hover:text-red-600" tabIndex={1} onClick={() => {
396+
<LuCircleX className="absolute size-5 -right-2 -top-2 text-red-400 hover:text-red-600" tabIndex={1} onClick={() => {
396397
setValue((v) => {
397398
const changed = [...v[t]];
398399
changed.splice(i, 1);

tauri/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"react-force-graph-2d": "^1.25.5",
5151
"react-hook-form": "^7.54.2",
5252
"react-hot-toast": "^2.4.1",
53-
"react-icons": "^4.11.0",
53+
"react-icons": "^5.5.0",
5454
"react-plotly.js": "^2.6.0",
5555
"react-router-dom": "^6.18.0",
5656
"react-virtualized-auto-sizer": "^1.0.24",

0 commit comments

Comments
 (0)