Scoreline graphic: Part 1

Creation of basic hooks for a scoreline graphic and adding sample data

Caveat: You need to have Template Editor permissions. It may be sensible when naming new hooks, new templates or new template sets to add "TRAINING" as part of the name, to differentiate your work from 'live' production work. Do consider any 'Delete' actions carefully - is it your work you are deleting?


The Graphic


This is what the graphic looks like that you are trying to create a template for, it is a lower 1/3 scoreline showing who scored, when they scored and how (e.g. Own Goal).


Scoreline graphic: Part 1


To be able to generate this graphic there are a number of tutorials that are broken down into manageable sizes. This is Part 1.


Prerequisites


Prior to beginning this article, the user should be familiar with selecting a schema and creating hooks.

You will need to have already completed the following articles:

XMLTeam Data Provider

Schedule condition hooks

'User Input Node' functionality

You should also be familiar with creating images sets.


The Graphic's Requirements


The requirements from the user side are to be able to simply choose from a dropdown list at what point during the timeline of the match to create an instance for. The list of options should include each goal scored, as well as fixed points in time such as 'Pre-match', the 'Start' of a match, 'Half-Time' and 'Full-Time'.

Players who score more than one goal should only appear once, with their goal times listed together.

Players scoring own goals appear on the opposite side to their own team. Own goals and penalties are flagged with '(OG)' or '(P)'.


The Data


Unfortunately, the data you get from the data provider is not shaped in a way that neatly fits the graphic. It consists of a list of 'score actions', with player id's, team-id's, minutes etc. There are no rows in the data for the fixed points in time and each goal is a separate item in the list, not a list of minutes as the graphic requires for players who score more than once.

Here is a small sample of some data that includes the goals in the match:


<event-actions>
<event-actions-soccer>
<action-soccer-penalty xmlns:bbc="http://www.bbc.co.uk/sport/sports-data" id="a.1671106398" bbc:time-elapsed="25:48" sequence-number="20180825T152557+0100" minutes-elapsed="26" date-time="2018-08-25T15:25:57+01:00" period-value="1" team-idref="EFBO987619-TFBB20" recipient-type="player" recipient-idref="PO132015" penalty-level="yellow-card" penalty-type="other" comment="Persistent Infringement"/>
<action-soccer-penalty xmlns:bbc="http://www.bbc.co.uk/sport/sports-data" id="a.1167005783" bbc:time-elapsed="63:30" sequence-number="20180825T162032+0100" minutes-elapsed="64" date-time="2018-08-25T16:20:32+01:00" period-value="2" team-idref="EFBO987619-TFBB20" recipient-type="player" recipient-idref="PO40146" penalty-level="yellow-card" penalty-type="foul" comment="Foul"/>
<action-soccer-penalty xmlns:bbc="http://www.bbc.co.uk/sport/sports-data" id="a.1237844124" bbc:time-elapsed="76:31" sequence-number="20180825T163333+0100" minutes-elapsed="77" date-time="2018-08-25T16:33:33+01:00" period-value="2" team-idref="EFBO987619-TFBB20" recipient-type="player" recipient-idref="PO132015" penalty-level="yellow-red-card" penalty-type="diving" comment="Simulation"/>
<action-soccer-score xmlns:bbc="http://www.bbc.co.uk/sport/sports-data" id="a.1342384862" bbc:time-elapsed="51:30" sequence-number="20180825T160832+0100" period-value="2" team-idref="EFBO987619-TFBB20" score-attempt-type="regular" minutes-elapsed="52" bbc:score-away="0" bbc:score-home="1" date-time="2018-08-25T16:08:32+01:00">
<action-soccer-play-participant player-idref="PO40146" team-idref="EFBO987619-TFBB20" role="scorer"/>
</action-soccer-score>
<action-soccer-substitution xmlns:bbc="http://www.bbc.co.uk/sport/sports-data" id="a.1651714690" bbc:time-elapsed="68:59" sequence-number="20180825T162601+0100" minutes-elapsed="69" date-time="2018-08-25T16:26:01+01:00" period-value="2" team-idref="EFBO987619-TFBB20" person-replacing-position="forward" person-original-idref="PO84939" person-replacing-idref="PO78356" substitution-reason="Tactical"/>
<action-soccer-substitution xmlns:bbc="http://www.bbc.co.uk/sport/sports-data" id="a.1194374192" bbc:time-elapsed="78:43" sequence-number="20180825T163545+0100" minutes-elapsed="79" date-time="2018-08-25T16:35:45+01:00" period-value="2" team-idref="EFBO987619-TFBB20" person-replacing-position="midfielder" person-original-idref="PO96787" person-replacing-idref="PO78056" substitution-reason="Tactical"/>
<action-soccer-substitution xmlns:bbc="http://www.bbc.co.uk/sport/sports-data" id="a.1544447640" bbc:time-elapsed="85:56" sequence-number="20180825T164257+0100" minutes-elapsed="86" date-time="2018-08-25T16:42:57+01:00" period-value="2" team-idref="EFBO987619-TFBB20" person-replacing-position="midfielder" person-original-idref="PO20452" person-replacing-idref="PO91047" substitution-reason="Tactical"/>
<action-soccer-penalty xmlns:bbc="http://www.bbc.co.uk/sport/sports-data" id="a.1902387736" bbc:time-elapsed="92:50" sequence-number="20180825T164952+0100" minutes-elapsed="93" date-time="2018-08-25T16:49:52+01:00" period-value="2" team-idref="EFBO987619-TFBB13" recipient-type="player" recipient-idref="PO95658" penalty-level="yellow-card" penalty-type="excessive-celebration" comment="Excessive celebration"/>
<action-soccer-score xmlns:bbc="http://www.bbc.co.uk/sport/sports-data" id="a.1326189656" bbc:time-elapsed="55:23" sequence-number="20180825T161225+0100" period-value="2" team-idref="EFBO987619-TFBB13" score-attempt-type="regular" minutes-elapsed="56" bbc:score-away="1" bbc:score-home="1" date-time="2018-08-25T16:12:25+01:00">
<action-soccer-play-participant player-idref="PO172632" team-idref="EFBO987619-TFBB13" role="scorer"/>
</action-soccer-score>
<action-soccer-score xmlns:bbc="http://www.bbc.co.uk/sport/sports-data" id="a.1564590174" bbc:time-elapsed="91:33" sequence-number="20180825T164835+0100" period-value="2" team-idref="EFBO987619-TFBB13" score-attempt-type="regular" minutes-elapsed="92" bbc:score-away="2" bbc:score-home="1" date-time="2018-08-25T16:48:35+01:00">
<action-soccer-play-participant player-idref="PO95658" team-idref="EFBO987619-TFBB13" role="scorer"/>
<action-soccer-play-participant player-idref="PO51938" team-idref="EFBO987619-TFBB13" role="assist"/>
</action-soccer-score>
<action-soccer-substitution xmlns:bbc="http://www.bbc.co.uk/sport/sports-data" id="a.1810115067" bbc:time-elapsed="66:22" sequence-number="20180825T162324+0100" minutes-elapsed="67" date-time="2018-08-25T16:23:24+01:00" period-value="2" team-idref="EFBO987619-TFBB13" person-replacing-position="midfielder" person-original-idref="PO173515" person-replacing-idref="PO51938" substitution-reason="Tactical"/>
<action-soccer-substitution xmlns:bbc="http://www.bbc.co.uk/sport/sports-data" id="a.1991611034" bbc:time-elapsed="77:33" sequence-number="20180825T163435+0100" minutes-elapsed="78" date-time="2018-08-25T16:34:35+01:00" period-value="2" team-idref="EFBO987619-TFBB13" person-replacing-position="midfielder" person-original-idref="PO172780" person-replacing-idref="PO115858" substitution-reason="Tactical"/>
<action-soccer-substitution xmlns:bbc="http://www.bbc.co.uk/sport/sports-data" id="a.1801961863" bbc:time-elapsed="87:34" sequence-number="20180825T164436+0100" minutes-elapsed="88" date-time="2018-08-25T16:44:36+01:00" period-value="2" team-idref="EFBO987619-TFBB13" person-replacing-position="forward" person-original-idref="PO172632" person-replacing-idref="PO78412" substitution-reason="Tactical"/>
</event-actions-soccer>
</event-actions>

Way too much info to try and analyse yourself, even when you examine the XML for one score event:


<action-soccer-score xmlns:bbc="http://www.bbc.co.uk/sport/sports-data" id="a.1342384862" bbc:time-elapsed="51:30" sequence-number="20180825T160832+0100" period-value="2" team-idref="EFBO987619-TFBB20" score-attempt-type="regular" minutes-elapsed="52" bbc:score-away="0" bbc:score-home="1" date-time="2018-08-25T16:08:32+01:00">
<action-soccer-play-participant player-idref="PO40146" team-idref="EFBO987619-TFBB20" role="scorer"/>
</action-soccer-score>

This next section of the data is from the beginning of the XML file:


<sports-content>
<sports-metadata date-time="2018-08-27T12:42:45+01:00" doc-id="xt.opta.20180827124245-987619-post-event" language="en-US" fixture-key="event-stats" document-class="event-summary" fixture-name="Event Score and Stats">
<sports-title/>
<sports-content-codes>
<sports-content-code code-name="Opta" code-key="optasports.com" code-type="publisher"/>
<sports-content-code code-name="XML Team Solutions, Inc." code-key="xmlteam.com" code-type="distributor"/>
<sports-content-code code-type="sport" code-key="15054000" code-name="Soccer"/>
<sports-content-code code-name="opta-sport-feed" code-key="Soccer::F9" code-type="article-ref"/>
<sports-content-code code-name="optafeed" code-key="f9" code-type="token"/>
<sports-content-code code-type="tournament" code-key="CFBB8" code-name="English Premier League" code-source="bbc.co.uk"/>
<sports-content-code code-type="league" code-key="l.premierleague.com" code-name="English Premier League" code-source="xmlteam.com"/>
<sports-content-code code-type="season" code-key="2018"/>
<sports-content-code code-type="team" code-key="TFBB13" code-name="Leicester City" code-source="bbc.co.uk"/>
<sports-content-code code-type="team" code-key="TFBB20" code-name="Southampton Saints" code-source="bbc.co.uk"/>
<sports-content-code code-type="team" code-key="o.thefa.com-t.4693" code-name="Leicester City" code-source="xmlteam.com"/>
<sports-content-code code-type="team" code-key="o.thefa.com-t.4874" code-name="Southampton Saints" code-source="xmlteam.com"/>
</sports-content-codes>
</sports-metadata>
<sports-event>
<event-metadata xmlns:bbc="http://www.bbc.co.uk/sport/sports-data" date-coverage-type="event" event-key="EFBO987619" event-status="post-event" bbc:result-status="certain" event-status-note="Result" start-date-time="2018-08-25T15:00:00+01:00" bbc:event-type="Regular" event-name="Southampton v Leicester City" event-outcome-type="regular">
<event-metadata-soccer week="3" minutes-elapsed="90">
<time-adjustment period-extra-time-elapsed="6"/>
</event-metadata-soccer>
<site>
<site-metadata site-key="VFBB2370">
<name first="St. Mary's Stadium" full="St. Mary's Stadium" abbreviation="St. Mary's Stadium" bbc:vide-code="St. Mary's Stadium"/>
<home-location country="England"/>
</site-metadata>
<site-stats alignment="home" attendance="29925"/>
</site>
<sports-property formal-name="detail-level" value="1"/>
</event-metadata>

Note - In the above (the second line from the top),there is a timestamp:

  • (year,month,date,T,hour,minutes,seconds +0100)


The occurrences do not appear in the XML file in chronological order, i.e. they all occur on 2nd September 2018 but at varying times and for varying reasons.

You will use the above data during the construction of most of your controls for the graphic.


Planning what to build


The user of the template wants a simple selection from a timeline dropdown, so, you need to create a 'List Hook' that provides all the possible choices - goals and fixed points - and presents them with nicely formatted descriptions.

Such as (from Southampton v Leicester City 2018-08-25):

  • Pre-match (v)

  • Start (0-0)

  • HALF-TIME (0-0)

  • SOT Bertrand 52' (1-0)

  • LEI Gray 56' (1-1)

  • LEI Maguire 90'+2' (1-2)

  • Full-Time (1-2)


This will be the "Scorelines" hook. It will produce a list of:

  • An abbreviation of the Team

  • The Player Name

  • The time of the score (including an indication if occurred extra-time)

  • The match score at this point

  • If an own-goal or a penalty - indicated by (OG) or (P)


Next, you need the data being sent to the renderer for the graphic, this needs to be in a different shape to the "Scorelines" hook. It needs to group a single player's goals together and allow home and away goals to be listed separately.

  • Lukaku 27' 44' - away (from Burnley v Manchester United 2018-09-02)


These values should be filterable to any particular goal or point in the match, such that, up to half-time you would only see (from Cardiff City v Arsenal 2018-09-02):

  • Mustafi 11' - away

  • Camarasa 45'+2' - home


This will be the "GoalsByPlayer" hook.


Creating hooks


Using Ignition Post Win Client as a Template Editor.


  1. Select the main tab DATA

  2. Select the sub-tab SCHEMAS & HOOKS

  3. Below SCHEMAS:

    1. Data Provider: XMLTeam

    2. Target: Production:

    3. Schema: soccer event-report

    4. Sample Data: Southampton v Leicester City

  4. Below SCHEMA expand:

    1. sports-content

    2. sport-event

    3. event-actions

    4. event-actions-soccer


Creating the 'Scorelines' hook


  1. Create a parent hook using the 'action-soccer-score' node

  2. Rename to 'Scorelines'


Scoreline graphic: Part 1


You will now create some sub-hooks below the main hook to be able to provide context to some of the required actions. This will allow information to be seen in the hook evaluation pane. Some nodes will be used more than once, however, they are manipulated to generate different outputs.


  1. Below the 'Scorelines' hook, create sub-hooks using the following nodes:

    1. 'minutes-elapsed'

    2. 'period-value'

    3. 'score-attempt-type'

    4. 'sequence-number'

    5. 'score-away'

    6. 'score-home'

    7. 'action-soccer-score.action-soccer-play-participant'


It may be necessary to expand the size of the SCHEMA sub-pane to be able to see the 'hook' icon.


  1. Within WORKING SET, select the parent hook 'Scorelines'

  2. Expand 'Scorelines'

  3. Select 'Action Soccer Play Participant', add sub-sub-hooks to:

    1. player-idref

    2. team-idref

  4. In the SCHEMA sub-pane, identify the following node:

    1. action-soccer-score.action-soccer-play-participant.role


You now need to create a constraint, so the node only returns information meeting criteria, i.e. 'scorer'. Using the node 'role' as an example, adjacent to the node there will be a filter icon (with a small green plus sign) - 'Add Constraint to Action Soccer Play Participant'. When the button is clicked, a dialogue appears. In the dialogue there are three fields:

  • One to set the mathematical process to be used, i.e. = or <= (you can hover to get a dropdown)

  • The second to add what you want to be used as the constraint - this can be text or numbers

  • The third is to set whether you want the constraint to operate as a 'Text' or a 'Numerical' operator


Now to actually add a constraint to the 'Action Soccer Play Participant' hook. The following 6 actions, take you through the procedure quite carefully:


  1. Ensure the 'Action Soccer Play Participant' hook is selected

  2. Click the 'Add Constraint to Action Soccer Play Participant' button (a 'filter' icon) adjacent to the following node:

    1. action-soccer-score.action-soccer-play-participant.role

  3. Set the mathematical value to: =

  4. Add the following text: scorer

  5. Leave the operator as: Text

  6. Click the 'green' TICK


During other tutorials the act of adding a constraint may be shown in a more brief manner:

  1. Add a constraint to the 'Scorer' hook as follows:

    1. action-soccer-score.action-soccer-play-participant.role

    2. = scorer (Text)


Scoreline graphic: Part 1


Now to make changes to the 'Action Soccer Play Participant' sub-hook to ensure it functions correctly.


  1. Ensure the 'Action Soccer Play Participant' sub-hook is selected

  2. From within HOOK PROPERTIES change the 'Select Mode' from 'All Items' to:

    1. 'Single Item (first in list)'


Scoreline graphic: Part 1
  • Rename 'Action Soccer Play Participant' to:

    1. 'Scorer'


    You will note from the below image that even though the hook has been renamed you can still identify the node used to create the hook. Also, you have icons indicating the hook has a constraint applied and the hook will give a 'Single Item (first in list)' rather than 'All Items'.


    Scoreline graphic: Part 1


    1. Ensure the sub-hook 'Scorer' is selected

    2. Ensure the sub-hook 'Player Idref' below 'Scorer' is selected


    Within 'Hook Properties' there are the fields: 'Value Transforms' and 'Reference'. Adjacent to 'Reference' is a button: 'Create Hooks'. The purpose of 'Reference' is to be able to cross-reference to an alternate parent hook and generate sub-hooks based on its contents - this will be in 'Part 2' of the tutorials to produce a 'Scorelines' Graphic for a Football Match.


    Adding sample data


    Can you remember how? Its the main tab DATA, then the sub-tab SCHEMAS, then below SCHEMAS and below Sample Data you click the icon 'Upload sample data from file'.


    1. Add the following three sample data files:

      1. Watford v Tottenham Hotspur.xml -- This match has an own-goal

      2. Burnley v Manchester United.xml -- This match has two goals by a player and a red card (due to a second yellow card)

      3. Cardiff City v Arsenal.xml -- This match has a goal in the first-half extra-time


    The following sample data file will already be present:

    • Southampton v Leicester City.xml -- This match has a goal in the second-half extra-time and a red card


    Now to ensure you are using the sample data that is being used in the remaining tutorials to create a scoreline graphic.


    1. Select the following sample data:

      1. Southampton v Leicester City.xml


    Scoreline graphic: Part 1


    Your next tutorial is:

    Scoreline graphic Part 2