Betarena / scores

We are building the first open-source live results and statistics platform with community involvement features for data insertion. The project includes a blockchain component that will allow participants to receive rewards based on their participation and also to stake the future Token of the platform.
GNU General Public License v3.0
18 stars 5 forks source link

Backend Widget football_Fixtures_Odds #447

Closed jonsnowpt closed 2 years ago

jonsnowpt commented 2 years ago

We need to populate all information related to the fixtures, including live scores and fixtures. Also, we need to add the WP links associated with each fixture.

Steps:

Get information from the provider and populate the Hasura DB.

Provider endpoint:

https://soccer.sportmonks.com/api/v2.0/fixtures/between/:STARTDATE/:ENDATE?include=localTeam,visitorTeam,substitutions,goals,cards,other events,corners,lineup,bench,sidelined,comments,tvstations,round,stage,referee,venue,localCoach,visitorCoach,group,trends,firstAssistant,secondAssistant,fourthOfficial,stats,shootout,league,stats,probability,valuebet,news

Hasura endpoint Dev:

historic_fixtures_dev

Hasura endpoint Prod:

historic_fixtures

Columns:

id
fixture_day
league_name
country_flag = Add the the "iso2" in the endpoint: scores_football_countries with the prefix: "https://betarena.com/images/flags/{US}.svg"
home_team_logo
away_team_logo
away_team_name
status
probabilities
tvstations
inserted_at
time
valuebets
home_team_name
round_name
data
league_id

Mock Data:

https://cloud.hasura.io/project/1b086d12-8b64-462e-b7cc-f3f5e2c1702d/console/data/betarena_prod/schema/public/tables/historic_fixtures/browse

Update frequency:

Dev = Manual Once Prod = Manual Once

Get information from the provider and populate the Hasura DB.

Range from today for the next 2 weeks:

Provider endpoint:

https://soccer.sportmonks.com/api/v2.0/fixtures/between/:STARTDATE/:ENDATE?include=localTeam,visitorTeam,substitutions,goals,cards,other events,corners,lineup,bench,sidelined,comments,tvstations,round,stage,referee,venue,localCoach,visitorCoach,group,trends,firstAssistant,secondAssistant,fourthOfficial,stats,shootout,league,stats,probability,valuebet,news

Dev = 24 hours Prod = 24 hours

Range from today for the next 12 months:

Provider endpoint:

https://soccer.sportmonks.com/api/v2.0/fixtures/between/:STARTDATE/:ENDATE?include=localTeam,visitorTeam,substitutions,goals,cards,other events,corners,lineup,bench,sidelined,comments,tvstations,round,stage,referee,venue,localCoach,visitorCoach,group,trends,firstAssistant,secondAssistant,fourthOfficial,stats,shootout,league,stats,probability,valuebet,news

Dev = Every 2 weeks Prod = Every 2 weeks

This endpoint will bring only the fixtures that have been updated in the last 2 hours.

Provider endpoint:

https://soccer.sportmonks.com/api/v2.0/fixtures/updates?include=localTeam,visitorTeam,substitutions,goals,cards,other events,corners,lineup,bench,sidelined,comments,tvstations,round,stage,referee,venue,localCoach,visitorCoach,group,trends,firstAssistant,secondAssistant,fourthOfficial,stats,shootout,league,stats,probability,valuebet

Dev = Hourly Prod = Hourly

Get information from the provider and populate the Firebase DB.

Provider endpoint:

https://soccer.sportmonks.com/api/v2.0/livescores/now?include=localTeam,visitorTeam,substitutions,goals,cards,other,events,corners,lineup,bench,sidelined,comments,tvstations,,round,stage,referee,venue,localCoach,visitorCoach,group,trends,stats,probability,valuebet

Firebase endpoint:

livescores_now

firebase_livescore_now_structure.json.zip

Frequency: Every 5s

Get information from the WP-API and populate the Hasura DB.

Wordpress API v2.postman_collection.json.zip

Access the WP API using the data range:

WP-API

Change the categories as needed to retrieve data, and use the latest 24 hours time range. Use the categories to identify the lang on Hasura (betarena_content) = categories_lang

Keys:

categories = EN: 68974, 94373 - RO: 97549, 97548 - IT: 96968, 98372 - ES: 98373, 69114 :: BR: 94220, 67729 - PT: 69842, 97106
orderby
order
before
after

International:

https://www.betarena.com/wp-json/wp/v2/posts?orderby=date&order=desc&before=2022-04-07T23:59:00&after=2022-04-01T13:00:00&categories=68974

BR and PT:

https://apostas.betarena.com/wp-json/wp/v2/posts?orderby=date&order=desc&before=2022-04-07T23:59:00&after=2022-04-01T13:00:00&categories=94220

If ID matches with the fixture ID add the icon and respective link to the fixture:

"acf": {
            "gameid": "18508743",
        },

Example:

"link": "https://www.betarena.com/seattle-sounders-vs-new-york-city-concacaf-champions-league-prediction-and-betting-tips-on-06-04-2022/",

Hasura endpoint Dev:

historic_fixtures_dev

Hasura endpoint Prod:

historic_fixtures

Columns:

id
fixture_day
league_name
country_flag = Add the the "iso2" in the endpoint: scores_football_countries with the prefix: "https://betarena.com/images/flags/{US}.svg"
home_team_logo
away_team_logo
away_team_name
status
probabilities
tvstations
inserted_at
time
valuebets
home_team_name
round_name
data
league_id
tip_link_wp

Mock Data:

https://cloud.hasura.io/project/1b086d12-8b64-462e-b7cc-f3f5e2c1702d/console/data/betarena_prod/schema/public/tables/historic_fixtures/browse

Update frequency:

Dev = 24 hours Prod = Hourly

Get information from the WP-API and populate the Hasura DB.

Access the WP API using the data range:

WP-API

Change the categories as needed to retrieve data, and use the latest 24 hours time range. Use the categories to identify the lang on Hasura (betarena_content) = categories_lang

Keys:

categories = EN: 70708 - RO: 97616 - IT: 97199 - ES: 72007 :: BR: 71024 - PT: 70222
orderby
order
before
after

International:

https://www.betarena.com/wp-json/wp/v2/posts?orderby=date&order=desc&before=2022-04-07T23:59:00&after=2022-04-01T13:00:00&categories=70708

BR and PT:

https://apostas.betarena.com/wp-json/wp/v2/posts?orderby=date&order=desc&before=2022-04-07T23:59:00&after=2022-04-01T13:00:00&categories=71024

If ID matches with the fixture ID add the link to the fixture:

 "acf": {
            "gameid": "18175135",
            "date_livescore_game": "2022-04-11",
            "lang": "en"
        },

Example:

""link": "https://www.betarena.com/vasas-vs-szeged-2011-livescore-preview-3/",

Hasura endpoint Dev:

historic_fixtures_dev

Hasura endpoint Prod:

historic_fixtures

Columns:

id
fixture_day
league_name
country_flag = Add the the "iso2" in the endpoint: scores_football_countries with the prefix: "https://betarena.com/images/flags/{US}.svg"
home_team_logo
away_team_logo
away_team_name
status
probabilities
tvstations
inserted_at
time
valuebets
home_team_name
round_name
data
league_id
tip_link_wp
fixture_link_wp

Mock Data:

https://cloud.hasura.io/project/1b086d12-8b64-462e-b7cc-f3f5e2c1702d/console/data/betarena_prod/schema/public/tables/historic_fixtures/browse

Update frequency:

Dev = 24 hours Prod = Hourly

Get information from the Firebase endpoint.

*Firebase

https://console.firebase.google.com/u/0/project/betarena-ios/database/betarena-rv-6b382/data/~2Fmedia_higlights_sources

Use team names match to verify if there is media available and add it to: media_highlights (true / false) (use team names match minimum 60%)

If Team Names matches with at least 60%, add the media icon and link

Example:

betarena-rv-6b382-3938974-export.json.zip

Columns:

id
fixture_day
league_name
country_flag = Add the the "iso2" in the endpoint: scores_football_countries with the prefix: "https://betarena.com/images/flags/{US}.svg"
home_team_logo
away_team_logo
away_team_name
status
probabilities
tvstations
inserted_at
time
valuebets
home_team_name
round_name
data
league_id
tip_link_wp
fixture_link_wp
media_link

Mock Data:

https://cloud.hasura.io/project/1b086d12-8b64-462e-b7cc-f3f5e2c1702d/console/data/betarena_prod/schema/public/tables/historic_fixtures/browse

Update frequency:

Dev = 24 hours Prod = 30 min

jonsnowpt commented 2 years ago

@migbash

League ID is not populated.

migbash commented 2 years ago

Working on #7 to finalize the backend.

migbash commented 2 years ago

@jonsnowpt completed! Deployed on:

CRON Frequency
[backend] [dev] historic wp links 1 hour
[backend] [dev] historic media links 30 min
[backend] [firebase] 5s livescore now update 1 min (*)

(*) 5 sec. interval not possible in CRON

jonsnowpt commented 2 years ago

@migbash

Waiting for real-time update outside of cron.