Skip to content

Enhanced football substitutions - #29027

Open
Jakeii wants to merge 6 commits into
mainfrom
jlk/enahanced-football-lineup-API
Open

Enhanced football substitutions#29027
Jakeii wants to merge 6 commits into
mainfrom
jlk/enahanced-football-lineup-API

Conversation

@Jakeii

@Jakeii Jakeii commented Aug 5, 2026

Copy link
Copy Markdown
Member

What does this change?

Use the new LineUpsEnhanced API introduced in guardian/pa-football-client#125 to work out which player was substituted.

The new API comes with an eventId which we can use to find the corresponding player that was substituted in and display it in the UI (see DCR PR)

We use this to create a substitutions list on the TeamStats, which is used in DCR to lookup the player name that was substituted in.

We've added enhancedEvents in addition to events on the players so this won't break DCR's parsing.

Why

At the moment we know a substitution happened and at what time, but not who was substituted in!

Checklist

Jakeii and others added 5 commits July 29, 2026 17:01
@Jakeii Jakeii added the feature Departmental tracking: work on a new feature label Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

teamColour: String,
): TeamStats = {
val players = makePlayers(teamV2)
val substitutions: Seq[Substitution] = players

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where we gather the substitution events from the substitute players, so we can look up in DCR when we come across a player that was subbed out, what player was subbed in.

@Jakeii
Jakeii marked this pull request as ready for review August 6, 2026 14:27
@Jakeii
Jakeii requested a review from a team as a code owner August 6, 2026 14:27

@marjisound marjisound left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, just left 2 small comments/questions :)

@@ -18,6 +21,7 @@ case class Player(
timeOnPitch: String,
shirtNumber: String,
events: Seq[PlayerEvent],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we going to still have events? And also enhancedEvents? Can we not delete the events from here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we remove it straight away, I think it'll make DCR's parser fail? once DCR is updated we can remove it

def makePlayers(team: LineUpTeam): Seq[Player] = {
def makePlayers(team: LineUpTeamEnhanced): Seq[Player] = {
team.players.map { player =>
val events = player.events.filter(event => MatchStats.reportedEventTypes.contains(event.eventType)).map { event =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above comment, can this be deleted or there's a reason we need to keep it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Departmental tracking: work on a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants