## ATWL Workflow Review Report  
**Paper Title:** *EventThread: Visual Summarization and Stage Analysis of Event Sequence Data*  
**Workflow ID:** `eventthread-sequence-summarization`

### Overall Assessment
The representation captures the main EventThread pipeline well: preprocessing event sequences, tensor-based thread extraction, optimisation-based layout, interactive threshold clustering, and interpretation through coordinated views.

The central visual encoding and tensor-decomposition description need correction to align precisely with the paper.

**Recommendation:**  
- [ ] Approve as-is  
- [ ] Approve with minor revisions  
- [x] Requires revision  
- [ ] Reject — major rework needed  

### Strengths
- The workflow structure closely follows the paper’s preprocessing, analysis, and visualisation modules.
- Filtering, alignment, stage folding, tensor encoding, and tensor decomposition are correctly represented as distinct analytical phases.
- The interactive clustering threshold is correctly represented as a `specification` updated through a loop with explicit `assign:`.
- `D_threads`, their event/stage/entity relevance features, and the stage-category entities are appropriate ATWL artifact choices.
- The computed layout context correctly omits `embedment:`, since `D_layout_space` is a single reference space.

---

### Critical Issues (Must Fix)

#### Issue 1: Thread-view encodings omit stage likelihood and raw-event provenance
**Location:** `T_visualise_categories`, `V_threads`

**Problem:** The EventThread thread view relies centrally on the stage-likelihood factor. Stripe opacity, dashed segments, event-node likelihood, and entity-background heights all depend on `F_thread_stage_likelihood`. However, this artifact is not an input to the visualisation.

Also, the representation claims that contextual views show raw event and entity details, but `D_sequences_filtered` is not an input to the visualisation.

**Correction:**
```atwl
transform T_visualise_categories :
  intent: visualise
  manner: "line-map thread view with coordinated contextual panels"
  input: A_thread_layout, F_category_label,
    F_thread_event_relevance, F_thread_stage_likelihood,
    F_thread_entity_relevance, D_threads,
    D_sequences_filtered, D_stages
  output: V_threads
  actor: machine
  description: "Render threads as stage-segmented stripes grouped into
    latent stage categories, with event and entity context in coordinated
    views for inspection"

artifact V_threads : visualisation(A_thread_layout, F_category_label,
    F_thread_event_relevance, F_thread_stage_likelihood,
    F_thread_entity_relevance, D_sequences_filtered, D_stages)
  layout: "line-map with threads divided into stage segments;
    coordinated contextual panels"
  form: "coloured linear stripes with event nodes, optional entity-volume
    backgrounds, and contextual list and flow views"
  encoding: "stage and vertical position from A_thread_layout; category
    grouping from F_category_label; stripe opacity and dashed segments
    from F_thread_stage_likelihood; event-node size from event relevance
    weighted by stage likelihood; event-node colour from event type;
    background height from entity relevance weighted by stage likelihood;
    contextual views show selected raw events and entities"
  description: "Coordinated multi-view visualisation of latent threads,
    latent stage categories, and supporting event-sequence context"
```

**Why:** The thread view is the paper’s main visual contribution. Its encoding must reflect the factor matrices correctly and include the raw event data needed by the event-flow, entity-list, and event-list panels.

---

#### Issue 2: Tensor decomposition is described as making all factor matrices orthogonal
**Location:** `T_decompose`, `M_tensor_model`

**Problem:** The paper constrains the stage factor matrix to be orthogonal (`BᵀB = I`). It does not state that all factor matrices are orthogonal. The current wording, “orthogonal factor matrices,” overstates the constraint.

**Correction:**
```atwl
transform T_decompose :
  intent: build-model
  manner: "CP tensor decomposition with an orthogonality constraint on
    the stage factor"
  input: F_tensor, S_stage_spec
  output: M_tensor_model
  actor: machine
  description: "Factorise the event-stage-entity tensor into component
    weights and event, stage, and entity factor matrices, constraining
    the stage factor to support interpretable thread evolution"

artifact M_tensor_model : model(F_tensor, S_stage_spec)
  model type: "tensor decomposition model"
  representation form: "CP decomposition with component weights and
    event, stage, and entity factor matrices"
  description: "Factorised representation from which latent threads and
    their event, stage, and entity distributions are derived"
```

**Why:** This preserves the paper’s methodological contribution without assigning an unsupported property to the event and entity factor matrices.

---

### Recommended Improvements (Should Fix)

#### Improvement 1: Use TF-IDF terminology for event filtering
**Location:** `T_filter`

**Suggestion:** The paper uses TF-IDF with uni- and bi-grams to identify low-importance events. “Frequency-based importance scoring” is too imprecise.

```atwl
transform T_filter :
  intent: define-unit
  manner: "filter low-importance events using TF-IDF-based scoring"
  input: D_sequences
  output: D_sequences_filtered
  actor: machine
  description: "Remove events with low TF-IDF importance, retaining
    characteristic events that differentiate each sequence from the
    collection"
```

**Why:** TF-IDF reduces events that are uninformative relative to the corpus, not merely events that are globally infrequent.

---

#### Improvement 2: Remove unused input features or represent event attributes instead
**Location:** `D_sequences`

**Problem:** `f_length` and `f_duration` are not used by any downstream transform. At the same time, event types and timestamps are essential to filtering, alignment, tensor construction, and visual inspection but are only described informally.

**Suggestion:** Either remove the unused features or replace them with features representing the event components.

```atwl
artifact D_sequences : entities
  origin: given
  internal structure: sequence
  embedment: set
  features:
    - id: f_event_types
      value structure: list
      value type: categorical
      description: "Ordered event types within each sequence"
    - id: f_event_times
      value structure: list
      value type: temporal
      description: "Occurrence times of events within each sequence"
  description: "Heterogeneous timestamped event sequences, one per
    analytic entity, containing variable event types and lengths"
```

**Why:** This makes the data required by the preprocessing steps explicit and avoids unused internal features.

---

#### Improvement 3: Clarify the tensor as a multi-way incidence representation
**Location:** `F_tensor`

**Suggestion:** `relational configuration` is the closest available ATWL value structure for a three-way event-stage-entity relation, but the representation should explicitly describe it as a multi-way incidence configuration.

```atwl
artifact F_tensor : feature(D_sequences_filtered)
  value structure: relational configuration
  value type: numeric
  representation form: "three-way event-stage-entity incidence tensor
    with non-negative occurrence counts"
  description: "Multi-way representation of event occurrences across
    event types, shared stages, and entities"
```

**Why:** ATWL has no dedicated tensor value structure. The description should therefore make clear that this is a structured multi-way relation rather than an ordinary graph-like configuration.

---

#### Improvement 4: Align final knowledge provenance with its declared inputs
**Location:** `K_findings`

**Suggestion:**
```atwl
artifact K_findings : knowledge(P_patterns, K_cluster_quality)
  representation form: "statements and explanations"
  description: "Documented domain insights about typical progression
    pathways, divergent subgroup behaviours, and characteristics
    revealed by thread evolution across stages"
```

**Why:** The final synthesis transform uses both `P_patterns` and `K_cluster_quality`; the knowledge artifact should reference the evidence used to form it.

---

### Minor Suggestions (Optional)

- `D_stages` may use `embedment: time` when stages always represent fixed-duration temporal intervals. `embedment: sequence` remains appropriate when stages are based on event-count rounds rather than temporal duration.
- Consider adding filtering and segmentation settings to a broader preprocessing specification if those settings are interactively chosen in a concrete deployment.
- The final `T_synthesise` step is a reasonable ATWL endpoint, though the paper demonstrates this mainly through usage scenarios rather than describing a separate formal synthesis module.

---

### Alignment with Paper

| Aspect | Assessment | Notes |
|---|---|---|
| Main methodology phases | Pass | Filtering, alignment, stage folding, tensor modelling, decomposition, layout, and visual exploration are represented in the correct order. |
| Tensor-based summarisation | Partial | CP decomposition is represented, but the orthogonality constraint must be limited to the stage factor. |
| Interactive stage-category clustering | Pass | Threshold-based grouping with a user-adjustable specification and explicit feedback assignment is well represented. |
| Layout contribution | Pass | The similarity-and-crossing-minimisation layout is correctly captured. |
| Thread-view visual encoding | Partial | Add stage likelihood, raw event sequences, stripe opacity/dashing, and weighted event/entity encodings. |
| Coordinated contextual views | Partial | The views are described, but their raw-data input is currently absent. |
| Domain terminology | Pass | “Threads,” “stages,” “latent stage categories,” and event-sequence terminology align well with the paper. |

### Conclusion
This is a strong representation of EventThread’s analytical workflow. The preprocessing and interactive clustering loop are particularly well modelled. Revise the thread-view dataflow and encoding, correct the decomposition’s orthogonality claim, and make the TF-IDF preprocessing terminology more precise.