The Master database tables are currently stored in individual CSV files, one for each table, derived from Excel data tables generated using Power Query.
Currently, the “database” (CSV table files) are used “as-is”, to generate a static web site (see the generate_website
directory), which can easily be re-generated and re-deployed whenever the data is updated. The CSV files could also be used to set up a database in an actual database management system.
The tables should all be normalized with no data duplication among any tables.
All tables have a numeric primary key ID. Most start at 1, with exceptions such as Competitor ID and Division ID.
It should be obvious what datatype is used for each field: integer, text, or date.
Contains the CTST-assigned Competitor ID for each competitor, along with their name. Used only in table_Results
.
Note that in some cases there may be Competitors that have had multiple Competitor IDs assigned for multiple variations of their name. Work has been done to eliminate duplicate Competitor entries. However, there may still be instances of Competitors with multiple IDs for different variations of their name. These may be addressed in the future if such cases come to light.
Competitor ID
: Primary Key. Uniquely identifies a CTST Competitor.
This is the actual number assigned to a Competitor by the CTST once the Competitor earns their first point (or has a Result entry in the database even if no points were awarded). There are gaps in the Competitor ID assignments.
Competitor IDs from the legacy points registry were used unchanged. Some Competitor IDs had to be created for Competitors who
were mistakenly omitted from the legacy points registry.
New Competitor IDs are assigned using PowerQuery within an Excel workbook in the create_csv_new
directory for all new events.
The following Competitor ID ranges currently exist:
Last Name
: Competitor’s Last Name. Not referenced from other tables.
First Name
: Competitor’s First Name. Not referenced from other tables.
A Contest is a combination of an Event (e.g., 2019 Colorado Country Classic), in a given Division (Novice, Intermediate, etc.), for a given Role (Leader or Follower). Leader contests and Follower contests must be tracked separately since the points awarded to Leaders and Followers are based on the Contest Tier, which may be different for Leaders and Followers, and is determined by the total number of contestants that competed in that Division (in ALL heats) as a Leader or as a Follower.
Contest ID
: Primary Key. Uniquely identifies a Contest. Only used in table_Results
.
Event ID
: from table_Events
.
Division ID
: from table_Divisions
.
Role ID
: from table_Roles
.
Tier
: Contest Tier. Not referenced from other tables. Used as a record of which Tier was used when assigning competitor points at the time the contest was held. Not directly used to compute competitor points. Current Tier values:
0
: Fewer than 5 entrants, or any non-pointed Contest (e.g., Masters or Sophisticated)1
: At least 5 but less than 13 entrants2
: At least 13 but less than 31 entrants3
: At least 31 entrantsCurrently, assignment of Tiers to Contests is considered a data entry function. Therefore, there is no separate Tier Table. This gives the flexibility to change the Tier points assignments in the future without affecting previously assigned points and Tier values. For legacy data (2020 results and earlier), the Tier value was solely derived from the Points assigned to the contest first-place winner in the Points Registry, as the number of leader/follower entries, and hence the Contest Tier, was not known in many cases.
Num Entries
: Number of contestants who competed (in ALL heats, not just the Finals). Not referenced from other tables.
The total number of leaders or followers who competed in this contest. For legacy data (2020 results and earlier), this value was not used and was set to -1 (to indicate an undefined value), as the leader/follower counts were not available for all contests.
Description
: Not presently used, but intended to add additional Contest information, e.g. can be used to indicate a combined-division contest, e.g., “Intermediate/Advanced”, since for combined Contests, the Division ID in table_Contests
will only be the lower of the two Divisions, i.e. the one in which points were awarded, and there is no other way in the database to denote a combined contest.Division ID
: Primary Key. Uniquely identifies a Division. Only used in table_Contests
. For ease of reporting and computing a competitor’s currently-assigned Division, the non-pointed Divisions are grouped first, followed by the pointed Divisions (“Novice” and above). Gaps in the assigned IDs permit future divisions to be used, e.g., Juniors, Invitational.
10
: Newcomer20
: Sophisticated30
: Masters40
: Novice50
: Intermediate60
: Advanced70
: All-StarsDivision
: Division Name.Note that because there have not yet been any “All-Stars” contests held so far, there may not yet be a table entry for “All-Stars”.
For consistency in reporting and use as a data entry lookup-table, each location in which an Event was held has its own table entry.
Event Location ID
: Primary Key. Uniquely identifies an Event’s location. Only used in table_Events
.
Event Location
: Event location (City, State; City, Province; or County, State).
For consistency in reporting and use as a data entry lookup-table, each named event has its own table entry. This is separate from table_EventLocations
to allow events such as World’s to be grouped without regard to the fact that the event was held in multiple locations.
Event Name ID
: Primary Key. Uniquely identifies a named Event. Used in table_Events
.
Event Name
: Not used in other tables.
Each time an event is held there will be a separate Event entry for the Event on that date. If desired, other fields could be added to this table in the future, e.g., Event organizer name, contact info, web site, etc.
Event ID
: Primary Key. Uniquely identifies an event. Used in table_Contests
.
Event Date
: The starting date of the Event.
Event Name ID
: from table_EventNames
.
Event Location ID
: from table_EventLocations
.
The lowest level of detail in the Points database is the Result record. A Result record is required for each placement in the Final heat of any Contest in which points are awarded. A Result entry is not required if no points were awarded. However, there is nothing to preclude creating a Result entry for all Competitors in the Final heat, or for Contests in the non-pointed divisions (e.g., Masters), as long as the Competitor is assigned a Competitor ID. The Points value assigned to a Result is determined by the data entry function, and is not automatically derived from the Result/Tier. This allows future changes to the points/tier levels without affecting existing points awarded.
Result ID
: Primary Key. Uniquely identifies a result. Not used in other tables.
Contest ID
: from table_Contests
.
Competitor ID
: from table_Competitors
.
Result
: Competitor’s placement in the Contest’s Final heat (1 = First place winner, etc.)
Points
: Points assigned to the Competitor in the Contest based on the Leader/Follower Contest Tier.
In the legacy Points Registry, each competitor was listed in EITHER the Men’s OR the Women’s Points Registry. The new database design is more flexible, and allows a Role to be used instead (L/F, Leader/Follower, Lead/Follow, etc.) Competitors can accrue points in either or both roles, as allowed by the rules in effect for each Event.
Role ID
: Primary Key. Uniquely identifies a Role, currently Leader (1) or Follower (2). Only used in table_Contests
.
Role
: The name of the Role: “L” or “F”.
create_db_tables.xlsx
is an Excel workbook that uses Power Query to generate the database tables.
This Excel workbook uses as its data source the CSV file, points_latest.csv
, in the create_csv_new
directory, a combined file containing all Leader and Follower points data, for both old and new contest data.
To (re-)generate the Excel data tables for the database in the Excel workbook, update the Data Source, then re-run the Power Query queries:
create_db_tables.xlsx
in ExcelSECURITY WARNING External Data Connections have been disabled
appears, click Enable Content
Data > Get Data v > Data Source Settings...
OK
to trust the source of the filepoints_latest.csv
fileChange Source...
Browse...
under File pathpoints_latest.csv
filepoints_latest.csv
file, then click Import
, then OK
, then Close
Queries & Connections
, then, still on the Data ribbon, click Refresh All v
File
then Save
to save the updated workbookThe actual CSV files for the data tables are not written out automatically when Power Query is run. Each CSV file must be manually saved from its corresponding table/worksheet in the Excel workbook.
Open create_db_tables.xlsx
in Excel, then for each of the table_
worksheets (except for base_data
):
table_...
worksheetFile > Save As
More options...
Save as type:
select CSV (Comma delimited) (*.csv)
, halfway down the listFile name
, e.g: table_Competitors.csv
db_tables_MASTER
Save
, then Yes
if overwriting an existing file, then OK
to save only the active sheetTo view the actual Power Query queries used to generate the data tables, update the Data Source as described above, then:
create_db_tables.xlsx
in ExcelData > Get Data v > Launch Power Query Editor...
OK
to trust the source of the fileQueries
list
base_data
contains all Result records with all data fields filled intable_...
query is generated using base_data
as a Reference queryAPPLIED STEPS
in the Query Settings pane on the rightView > Advanced Editor
to view the details for all steps making up the selected query