This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://github.com/omnisci/F1-demo/blob/726c56ba4e8c878abeef81b7cf680bd4d36a4bd2/f1dash/app.py#L36-L55 | |
# helps load css at the footer, to avoid having default react css overwrite | |
app.index_string = ''' | |
<!DOCTYPE html> | |
<html> | |
<head> | |
{%metas%} | |
<title>{%title%}</title> | |
{%favicon%} | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://github.com/omnisci/F1-demo/blob/726c56ba4e8c878abeef81b7cf680bd4d36a4bd2/f1dash/track.py#L56-L60 | |
#dcc.Interval creates an object with no display characteristics, triggering a callback every 'interval' seconds | |
#for anything listening for the id 'track-interval' | |
trackgraph = html.Div([ | |
dcc.Graph(id='track-graph', | |
config={ | |
'displayModeBar': True | |
} | |
), | |
#controls when track and telemetry updates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### THIS IS A SUMMARY, THIS FILE WILL NOT RUN AS-IS #### | |
#### INPUTS to build_telemetry_chart #### | |
#https://github.com/omnisci/F1-demo/blob/726c56ba4e8c878abeef81b7cf680bd4d36a4bd2/f1dash/controls.py#L9-L32 | |
#### reference lap: build list dynamically with callback | |
reflapmenu = dcc.Dropdown( | |
id='reflapmenu', | |
searchable=False, | |
clearable=False, | |
style=dict(minWidth = '250px', paddingRight = '15px', borderRadius = 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_telemetry_data(sessionuid, lapstarttime, lapendtime, playercarindex, metric): | |
conn = pymapd.connect(host = host, user = user, password = password, dbname = dbname, port = port) | |
## get telemetry data | |
## by specifying the timestamps and sessionuid, it implies a single track | |
tele = f"""select | |
packettime, | |
max({metric}) as {metric} | |
from gtc_cartelemetry_v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app = dash.Dash(__name__, external_stylesheets = [dbc.themes.DARKLY]) | |
app.title = "OmniSci Grand Prix | Converge 2019" | |
app.config['suppress_callback_exceptions'] = True | |
server = app.server | |
body = dbc.Container([ | |
dbc.Row([track, leaderboard]), | |
dbc.Row([telemetry, menubox]) | |
], | |
className="mt-4", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#From the post: https://randyzwitch.com/benchmarktools-julia-benchmarking/ | |
using Random, OmniSci, BenchmarkTools, Base.Threads | |
#change defaults, since examples long-running | |
BenchmarkTools.DEFAULT_PARAMETERS.seconds = 200 | |
BenchmarkTools.DEFAULT_PARAMETERS.samples = 5 | |
#generate test data | |
gendata(x, T) = [rand(typemin(T):typemax(T)) for y in 1:x] | |
int64_10x6 = gendata(10^6, Int64) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insert into baywheels_tripdata | |
select | |
duration_sec, | |
start_time, | |
end_time, | |
start_station_id, | |
start_station_name, | |
start_station_latitude, | |
start_station_longitude, | |
end_station_id, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--201906 and 201907 files have extra blank column | |
CREATE TABLE baywheels_tripdata_extracol( | |
duration_sec INTEGER, | |
start_time TIMESTAMP, | |
end_time TIMESTAMP, | |
start_station_id SMALLINT, | |
start_station_name TEXT ENCODING DICT, | |
start_station_latitude FLOAT, | |
start_station_longitude FLOAT, | |
end_station_id SMALLINT, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
omnisql> copy baywheels_tripdata from 's3://baywheels-data/201905-baywheels-tripdata.csv.zip'; | |
Result | |
Loaded: 182163 recs, Rejected: 0 recs in 2.440000 secs | |
omnisql> copy baywheels_tripdata from 's3://baywheels-data/201906-baywheels-tripdata.csv.zip'; | |
Result | |
Loader truncated due to reject count. Processed : 0 recs, Rejected: 191772 recs in 8.323000 secs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--add column bike_share_for_all_trip, which starts with Jan 2018 file | |
ALTER TABLE baywheels_tripdata ADD COLUMN bike_share_for_all_trip TEXT ENCODING DICT; |
NewerOlder