Reading plays - dvw files

DVW files

The data project scouting software, data volley 4 produces .dvw files. These files are similar to a text file. If your interested in some example files, you can find them here.

Python - Reading plays from one dvw file

The provided example file is used. You would typically fill in the None with the actual path of your dvw files.

Code
from datavolley import read_dv
import pandas as pd
from IPython.display import Markdown
pd.set_option('display.max_colwidth', 1000)
dv_instance = read_dv.DataVolley(None) # Replace `None` with path of your dvw file 
df = dv_instance.get_plays()
df = df[df['skill'].notna()]
df = df.head(5)
Markdown(df.to_markdown(index = False, tablefmt="github", maxcolwidths=[None]))
match_id video_file_number video_time code team player_number player_name player_id skill evaluation_code setter_position attack_code set_code set_type start_zone end_zone end_subzone num_players_numeric home_team_score visiting_team_score home_setter_position visiting_setter_position custom_code home_p1 home_p2 home_p3 home_p4 home_p5 home_p6 visiting_p1 visiting_p2 visiting_p3 visiting_p4 visiting_p5 visiting_p6 start_coordinate mid_coordinate end_coordinate point_phase attack_phase start_coordinate_x start_coordinate_y mid_coordinate_x mid_coordinate_y end_coordinate_x end_coordinate_y set_number home_team visiting_team home_team_id visiting_team_id point_won_by serving_team receiving_team rally_number possesion_number
f21c7df0-9f7f-49fd-a16d-79bf997088df 1 494 *19SM+~78A~00 University of Louisville 19 Shannon Shields -296094 Serve + 1 nan nan nan 7 8 A nan 1 0 1 6 00 19 9 11 15 10 7 1 16 17 10 6 8 431 7642 Serve nan 1.26875 0.092596 1.68125 5.425924 1 University of Louisville University of Dayton 17 42 University of Louisville University of Louisville University of Dayton 1 0
f21c7df0-9f7f-49fd-a16d-79bf997088df 1 495 a02RM-~58AM00B University of Dayton 2 Maura Collins -230138 Reception - 6 nan nan nan 5 8 A nan 1 0 1 6 00B 19 9 11 15 10 7 1 16 17 10 6 8 431 7642 Reception nan 1.26875 0.092596 1.68125 5.425924 1 University of Louisville University of Dayton 17 42 University of Louisville University of Louisville University of Dayton 1 1
f21c7df0-9f7f-49fd-a16d-79bf997088df 1 497 a08ET#~~8C~00 University of Dayton 8 Brooke Westbeld -232525 Set # 6 nan nan ~ nan 8 C nan 1 0 1 6 00 19 9 11 15 10 7 1 16 17 10 6 8 3147 Reception nan 1.86875 2.09259 1 University of Louisville University of Dayton 17 42 University of Louisville University of Louisville University of Dayton 1 1
f21c7df0-9f7f-49fd-a16d-79bf997088df 1 499 a10AT-X546CH200F University of Dayton 10 Jamie Peterson -11802 Attack - 6 X5 nan nan 4 6 C 2 1 0 1 6 00F 19 9 11 15 10 7 1 16 17 10 6 8 4512 5522 8150 Reception Reception 0.55625 3.12963 0.9312499999999999 3.8703700000000008 1.9812500000000002 5.796294 1 University of Louisville University of Dayton 17 42 University of Louisville University of Louisville University of Dayton 1 1
f21c7df0-9f7f-49fd-a16d-79bf997088df 1 499 *11BT+~~2C~00 University of Louisville 11 Anna Stevenson -278838 Block + 1 nan nan nan nan 2 C nan 1 0 1 6 00 19 9 11 15 10 7 1 16 17 10 6 8 4578 Serve nan 3.03125 3.12963 1 University of Louisville University of Dayton 17 42 University of Louisville University of Louisville University of Dayton 1 2

Python - Reading plays from multiple files

Code
import os

# Assign path
dvw_path_folder = os.path.expanduser("~\\desktop\\dvws")
file_extension = ".dvw"

# Get a list of all files with the specified extension in the directory
file_list = [f for f in os.listdir(dvw_path_folder) if f.endswith(file_extension)]

# Initialize an empty DataFrame to store combined data
combined_df = pd.DataFrame()

def process_file(path):
    dv_instance = read_dv.DataVolley(os.path.join(dvw_path_folder, path))
    df = dv_instance.get_plays()
    return df

# Loop through each file path
for file_name in file_list:
    combined_df = pd.concat([combined_df, process_file(file_name)], ignore_index=True)

match_count = combined_df[['match_id']].drop_duplicates()
Markdown(match_count.to_markdown(index = False))
match_id
ce8d628b-c22e-4483-9ada-3cf30fa667df
0cdcc9f8-6fd6-4875-97d3-b558d1e41f6e
02c95bfa-05f1-49df-8620-1e6f029e0c68
bc4ea206-b184-419d-8a05-89a5c440b608

R - Reading plays from one dvw file

The provided example file is used. You would typically fill in the None with the actual path of your dvw files.

Code
library(datavolley)
library(tidyverse)
x <- dv_read("datavolley//example_data.dvw") # Example data from python
px <- x$plays
px <- px %>% filter(!is.na(skill))
px <- head(px, 5)
knitr::kable(px)
match_id point_id time video_file_number video_time code team player_number player_name player_id skill skill_type evaluation_code evaluation attack_code attack_description set_code set_description set_type start_zone end_zone end_subzone end_cone skill_subtype num_players num_players_numeric special_code timeout end_of_set substitution point home_team_score visiting_team_score home_setter_position visiting_setter_position custom_code file_line_number home_p1 home_p2 home_p3 home_p4 home_p5 home_p6 visiting_p1 visiting_p2 visiting_p3 visiting_p4 visiting_p5 visiting_p6 start_coordinate mid_coordinate end_coordinate point_phase attack_phase start_coordinate_x start_coordinate_y mid_coordinate_x mid_coordinate_y end_coordinate_x end_coordinate_y home_player_id1 home_player_id2 home_player_id3 home_player_id4 home_player_id5 home_player_id6 visiting_player_id1 visiting_player_id2 visiting_player_id3 visiting_player_id4 visiting_player_id5 visiting_player_id6 set_number team_touch_id home_team visiting_team home_team_id visiting_team_id team_id point_won_by winning_attack serving_team phase home_score_start_of_point visiting_score_start_of_point
a9e6117d72bb9cf6065ceb32112aa955 0 NA 1 494 *19SM+~78A~00 University of Louisville 19 Shannon Shields -296094 Serve Jump-float serve + Positive, opponent some attack NA NA NA NA NA 7 8 A NA NA NA NA NA FALSE FALSE FALSE FALSE 1 0 1 6 00 123 19 9 11 15 10 7 1 16 17 10 6 8 431 NA 7642 NA NA 1.26875 0.0925926 NA NA 1.68125 5.425926 -296094 -225496 -278838 -224838 -75967 -224837 -231069 14555 -11804 -11802 -230139 -232525 1 2 University of Louisville University of Dayton 17 42 17 University of Louisville FALSE University of Louisville Serve 0 0
a9e6117d72bb9cf6065ceb32112aa955 0 NA 1 495 a02RM-~58AM00B University of Dayton 2 Maura Collins -230138 Reception Jump-float serve reception - Negative, limited attack NA NA NA NA NA 5 8 A NA Middle line NA NA NA FALSE FALSE FALSE FALSE 1 0 1 6 00B 124 19 9 11 15 10 7 1 16 17 10 6 8 431 NA 7642 NA NA 1.26875 0.0925926 NA NA 1.68125 5.425926 -296094 -225496 -278838 -224838 -75967 -224837 -231069 14555 -11804 -11802 -230139 -232525 1 3 University of Louisville University of Dayton 17 42 42 University of Louisville FALSE University of Louisville Reception 0 0
a9e6117d72bb9cf6065ceb32112aa955 0 NA 1 497 a08ET#~~8C~00 University of Dayton 8 Brooke Westbeld -232525 Set Head ball set # Perfect NA NA NA NA NA NA 8 C NA NA NA NA NA FALSE FALSE FALSE FALSE 1 0 1 6 00 125 19 9 11 15 10 7 1 16 17 10 6 8 3147 NA NA NA NA 1.86875 2.0925926 NA NA NA NA -296094 -225496 -278838 -224838 -75967 -224837 -231069 14555 -11804 -11802 -230139 -232525 1 3 University of Louisville University of Dayton 17 42 42 University of Louisville FALSE University of Louisville Reception 0 0
a9e6117d72bb9cf6065ceb32112aa955 0 NA 1 499 a10AT-X546CH200F University of Dayton 10 Jamie Peterson -11802 Attack Head ball attack - Poor, easily dug X5 Go NA NA NA 4 6 C NA Hard spike 2 player block 2 NA FALSE FALSE FALSE FALSE 1 0 1 6 00F 126 19 9 11 15 10 7 1 16 17 10 6 8 4512 5522 8150 NA NA 0.55625 3.1296296 0.93125 3.87037 1.98125 5.796296 -296094 -225496 -278838 -224838 -75967 -224837 -231069 14555 -11804 -11802 -230139 -232525 1 3 University of Louisville University of Dayton 17 42 42 University of Louisville FALSE University of Louisville Reception 0 0
a9e6117d72bb9cf6065ceb32112aa955 0 NA 1 499 *11BT+~~2C~00 University of Louisville 11 Anna Stevenson -278838 Block Head ball block + Positive, block touch NA NA NA NA NA NA 2 C NA NA NA NA NA FALSE FALSE FALSE FALSE 1 0 1 6 00 127 19 9 11 15 10 7 1 16 17 10 6 8 4578 NA NA NA NA 3.03125 3.1296296 NA NA NA NA -296094 -225496 -278838 -224838 -75967 -224837 -231069 14555 -11804 -11802 -230139 -232525 1 4 University of Louisville University of Dayton 17 42 17 University of Louisville FALSE University of Louisville Reception 0 0

R - Reading plays from multiple files

Code
dvw_path_folder <- path.expand("~/dvws")
d <- dir(dvw_path_folder, pattern = "dvw$", full.names = TRUE)
lx <- lapply(d, dv_read, insert_technical_timeouts = FALSE)
px <- bind_rows(lapply(lx, plays))
match_count <- px %>% distinct(match_id)
knitr::kable(match_count)
match_id
2d8ebf675e98a874f0ab4f572ab78367
4e567edc1747c7b8243b731599ee7688
6f92782e87acbf537e9203740e728a7b
bd1e1273f6e6dc83b46f28f42dc45128