Thomas Eapen · Selected work

Preserving the sequence of a handover

Order the events and remove consecutive duplicates while keeping return visits visible.

Synthetic example · independently invented dataOne-page print edition · A3 landscape
8invented event records
5states after compression
4participant changes
2P1 → support visits

SYNTHETIC INPUT / ONE INTERACTION

Repeated does not mean redundant

Preserve return visits when removing duplicate participant entriesEight ordered events become P1, P2, P1, P3, P1 after removing only adjacent duplicates. Four handovers remain, including two moves from P1 to a support participant.ORDERED EVENT LOGP1P1P2P2P1P3P3P1CONSECUTIVE DUPLICATES REMOVEDP1P2P1P3P1Gold connections: P1 → support · repeated returns to P1 are retained
The raw records are first sorted by their unique sequence number. Only adjacent repeats are compressed.
Handovers in the compressed sequence
StepFromToIllustrative category
1P1P2P1 → support
2P2P1Return to P1
3P1P3P1 → support
4P3P1Return to P1

THE METHOD / PYTHON

Keep returns in their original order

from itertools import groupby

def transition_summary(events, origin, support):
    ordered = sorted(events, key=lambda row: row['sequence'])
    if len({r['sequence'] for r in ordered}) != len(ordered):
        raise ValueError('Each event needs a unique sequence.')
    people = [row['participant'] for row in ordered]
    chain = [person for person, _ in groupby(people)]
    handovers = list(zip(chain, chain[1:]))
    visits = [(a, b) for a, b in handovers
              if a == origin and b in support]
    return {'ordered': people, 'chain': chain,
            'handovers': handovers, 'support_visits': visits}

Selected code from the new demonstration that computes these results.

Here P2 and P3 are invented support participants. A handover is an adjacent participant change in this demonstration; the code makes no claim about historical business classifications.

Why consecutive duplicates matter Removing every repeated participant would collapse this sequence to P1 → P2 → P3 and lose both return visits. The ordered path is what makes the two P1-to-support moves visible.