Serve scouting by static csv
This commit is contained in:
parent
24cf331803
commit
c0a94613a3
@ -1,4 +1,7 @@
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query, Response
|
||||
from fastapi.responses import FileResponse
|
||||
from scipy import stats
|
||||
from typing import Literal, Optional, List
|
||||
import logging
|
||||
@ -251,6 +254,13 @@ async def get_card_scouting(team_id: int, ts: str, cardset_id: list = Query(defa
|
||||
# vr = pd.DataFrame(vr_vals)
|
||||
# db.close()
|
||||
|
||||
if os.path.isfile(f'storage/batting-ratings.csv'):
|
||||
return FileResponse(
|
||||
path=f'storage/batting-ratings.csv',
|
||||
media_type='text/csv',
|
||||
# headers=headers
|
||||
)
|
||||
|
||||
output = get_scouting_dfs(cardset_id)
|
||||
first = ['player_id', 'player_name', 'cardset_name', 'rarity', 'hand', 'variant']
|
||||
exclude = first + ['id_vl', 'id_vr', 'vs_hand_vl', 'vs_hand_vr']
|
||||
@ -261,6 +271,13 @@ async def get_card_scouting(team_id: int, ts: str, cardset_id: list = Query(defa
|
||||
|
||||
@router.get('/basic')
|
||||
async def get_basic_scouting(cardset_id: list = Query(default=None)):
|
||||
if os.path.isfile(f'storage/batting-basic.csv'):
|
||||
return FileResponse(
|
||||
path=f'storage/batting-basic.csv',
|
||||
media_type='text/csv',
|
||||
# headers=headers
|
||||
)
|
||||
|
||||
raw_data = get_scouting_dfs(cardset_id)
|
||||
logging.debug(f'output: {raw_data}')
|
||||
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query, Response
|
||||
from fastapi.responses import FileResponse
|
||||
from typing import Literal, Optional, List
|
||||
import logging
|
||||
import pandas as pd
|
||||
@ -191,6 +194,13 @@ async def get_card_scouting(team_id: int, ts: str, cardset_id: list = Query(defa
|
||||
'make sure it is enabled on your team. If you are interested you can pick it up here (thank you!): ' \
|
||||
'https://ko-fi.com/manticorum/shop'
|
||||
|
||||
if os.path.isfile(f'storage/pitching-ratings.csv'):
|
||||
return FileResponse(
|
||||
path=f'storage/pitching-ratings.csv',
|
||||
media_type='text/csv',
|
||||
# headers=headers
|
||||
)
|
||||
|
||||
output = get_scouting_dfs(cardset_id)
|
||||
first = ['player_id', 'player_name', 'cardset_name', 'rarity', 'hand', 'variant']
|
||||
exclude = first + ['id_vl', 'id_vr', 'vs_hand_vl', 'vs_hand_vr']
|
||||
@ -200,6 +210,13 @@ async def get_card_scouting(team_id: int, ts: str, cardset_id: list = Query(defa
|
||||
|
||||
@router.get('/basic')
|
||||
async def get_basic_scouting(cardset_id: list = Query(default=None)):
|
||||
if os.path.isfile(f'storage/pitching-basic.csv'):
|
||||
return FileResponse(
|
||||
path=f'storage/pitching-basic.csv',
|
||||
media_type='text/csv',
|
||||
# headers=headers
|
||||
)
|
||||
|
||||
raw_data = get_scouting_dfs(cardset_id)
|
||||
logging.info(f'output: {raw_data}')
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user