DYSARTISANIDEAS, FORGED INTO FORM.Search the episode library ↗

THE INNOVATION FORGE / Workbench Workthroughs

Feature Engineering Act 2: Timing, streaks and score history

Explore time-anchored behavior counts, login streaks and historical score snapshots in Slate, with practical tests for dates, scope and change over time.

A brass instrument in progress with components and diagrams on a maker's bench.
Count the behavior. Keep its place in the sequence.

THE IDEA, IN A MINUTE

The order of events changes the question.

Feature Engineering Act 2 adds sequence to the count. The walkthrough builds calendar and milestone windows, uses Sequential Value Groups for login streaks, and designs a history entity for comparing successive scores.

01 / THE RECORDING

Watch the episode.
Or find your moment.

Ask when the behavior happened

A count tells you how often something was recorded. It leaves the sequence open. Three event registrations before a decision opens describe a different moment from three registrations afterward. A cluster of portal logins last autumn is different from a streak this week.

Feature Engineering Act 2 develops that distinction through three builds: counts within a time window, login streaks and a history of scores. Each adds a different kind of context. A calendar window compares a recurring part of the cycle; a milestone window follows an individual's sequence; a snapshot series records how a calculated value changes.

In the recording · 06:57 ↗

Keep the calendar window and the population separate

The first example copies an existing event-attendance count and narrows it to the second half of April. A month comparison selects April, and a day comparison includes the 15th onward. The existing cutoff also limits the count to activity before a deposit or its configured fallback.

That combination matters. A month-and-day test describes a recurring season, but it does not by itself select an application cycle or a year. Keep the population and cycle scope visible alongside the calendar rule. If the purpose is a year-over-year comparison, make sure each cohort is being measured through a comparable point.

Test the corners before looking at totals: April 14, April 15, April 30 and May 1, plus an event after the individual's cutoff. Name the export after the actual window. The narration revises the proposed range as the live filters are built, so the finished definition should follow the conditions rather than the first phrase spoken.

In the recording · 07:54 ↗

Choose the timestamp that matches the action

The next count asks about event registrations after an admission decision is opened. The build distinguishes that opening from the decision being created or released. It also corrects the other endpoint: an event's start date would measure attendance timing, while the form-response submission date represents registration.

A date-difference calculation then supports a window from zero through seven days. Write down whether your intended rule uses calendar-day boundaries or exact elapsed time, including the relevant timezone. A registration around midnight is a useful test because the date can change after only a few minutes.

Copying a query is convenient, but it copies its old assumptions too. The recording removes the attendance condition when the question changes to registration and revisits the earlier deposit cutoff. Inspect every inherited filter. A registration count should not quietly require attendance merely because its source query did.

In the recording · 12:21 ↗

Decide what a streak is supposed to measure

Sequential Value Groups supplies the next tool. The demonstration converts direct portal-login dates into day offsets from a fixed anchor, groups consecutive values and returns the size of each group. Minimum and maximum offsets are converted back to dates so the result has readable endpoints. Impersonated staff logins are excluded from the student activity measure.

The same structure can answer several questions. What was the longest weekly streak? How many streaks lasted more than one day? How many days were contained in those longer streaks? For groups lasting two, five and seven days, the count is three and the sum of their lengths is fourteen. Those are different features, even though they begin with the same records.

Keep the unit in the name. Weekly groups need an agreed week boundary, and a daily streak should not grow because someone logged in several times on one day. Test repeated logins, a gap, a boundary crossing and a staff impersonation. A streak records a pattern of access; it cannot explain the person's reason for returning.

In the recording · 18:51 ↗

Store snapshots before asking about change

The final build creates an application-scoped historical score entity with fields for a total, score type and an average-change value. Keeping a score type allows one history structure to hold different measures without mixing them in a comparison.

The calculation retrieves the latest and second-latest values of the selected type, sorted by creation date, then compares their totals and dates. The recording explicitly notes that another query must populate those snapshots. Creating the entity alone will not produce a history.

Choose a capture schedule, a reliable observation date and a way to identify the scoring definition used. If weights or rules change, a jump in the stored score may reflect the calculation rather than new activity. Keep the raw snapshots available so someone can examine the difference instead of trusting only the derived rate.

In the recording · 33:05 ↗

Read the average as an average

Subtracting the older total from the newer total gives the score change. Dividing by the elapsed days gives an average rate across that interval. A rise from ten to fifteen over five days is one point per day on average; it does not establish that one point was earned on each day.

The build adds a zero-denominator guard. Extend the test to a first snapshot with no predecessor, two snapshots on the same day and two score types interleaved in time. Check which pair is selected and how an unavailable rate is displayed. A transparent missing result is more useful than a number produced from the wrong pair.

Bring the three builds together by keeping their questions separate. A window counts activity in a defined period, a streak describes continuity, and a snapshot comparison tracks a calculated measure. Clear names and a few boundary cases make those features useful beyond the person who first built them.

In the recording · 42:38 ↗

03 / A SMALL EXPERIMENT

Test the clock behind the feature

Use fictional dates and scores to check the definition before applying the query to a working dataset.

Which event date?

A fictional decision is opened Monday. The person registers Tuesday for an event held three weeks later. Which timestamp answers whether registration happened within seven days?

Compare your reasoning

Use the form-response submission time for the registration question. The event start time answers a different question. Check the decision-opened anchor and any inherited attendance filter.

Revisit this moment · 15:01 ↗
Count or sum?

A fictional direct-login history contains qualifying daily streaks of two, five and seven days. What are the number of streaks, the longest streak and the total days in those streaks?

Compare your reasoning

There are three streaks, the longest is seven days, and their lengths sum to fourteen days. Name each export for its actual measure; confirm duplicate logins and impersonations do not inflate it.

Revisit this moment · 32:02 ↗
Two snapshots, one day

A fictional score has two snapshots on the same calendar day, and an unrelated score type was also recorded between them. What needs checking before dividing the score change by days?

Compare your reasoning

Filter to the intended score type, verify ordering and observation dates, then handle a zero or unavailable interval explicitly. Do not substitute an unrelated snapshot to produce a rate.

Revisit this moment · 42:38 ↗
Build a test card to take with you

Notes stay in this tab. Reloading clears them.

04 / INSIDE THE STUDIO

The seams are part
of the story.

Behind the episode

The registration example initially reaches for the event start date, then switches to the form-response submission date. The copied attendance filter is removed too. That live correction captures a recurring feature-engineering problem: a query can be technically valid while answering the previous question.

Revisit the studio moment · 15:01 ↗

Art from the workshop

Workbench Workthroughs series artwork, with the parts and plans of a build laid out for inspection.

Open the artwork ↗

KEEP THE IDEA MOVING

Where would you take it next?

CONTINUE EXPLORING