Skip to content
Snippets Groups Projects
Commit 168a1a5c authored by safer-lgtm's avatar safer-lgtm
Browse files

docs HTML generated and data transformed

parent ab308de7
Branches main
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
def get_hmm():
"""Get a thought."""
return 'hmmm...'
from pathlib import Path
def get_path_to_data():
"""Return path to data."""
return Path('Data/')
def get_raw_data_path():
"""Return path to raw data."""
return get_path_to_data() / 'RawData'
def get_tidy_data_path():
"""Return path to tidy data."""
return get_path_to_data() / 'TidyData'
import json
import requests
from helpers import get_raw_data_path
base_url = 'http://ergast.com/api/f1/'
endpoint = 'current/last/results.json'
response = requests.get(
url=base_url + endpoint
)
data = response.json()
raw_data_path = get_raw_data_path()
raw_data_path.mkdir(parents=True, exist_ok=True)
with open(raw_data_path / 'current.json', 'w') as f:
json.dump(data, f)
import json
import pandas as pd
from helpers import get_raw_data_path, get_tidy_data_path
tidy_data_path = get_tidy_data_path()
tidy_data_path.mkdir(parents=True, exist_ok=True)
with open(get_raw_data_path() / 'current.json', 'r') as f:
d = json.load(f)
df = pd.json_normalize(d['MRData']['RaceTable']['Races'][0]['Results'])
df.to_parquet(tidy_data_path / 'current_race.parquet')
# -*- coding: utf-8 -*-
# Learn more: https://github.com/kennethreitz/setup.py
from setuptools import setup, find_packages
......@@ -12,13 +10,13 @@ with open('LICENSE') as f:
license = f.read()
setup(
name='formulaone',
version='0.1.1', # increase version by 0.0.1
description='Downloads and prepares formula one data',
name='dynamodb',
version='0.1.2', # increase version by 0.0.1
description='Downloads and prepares db movie data',
long_description=readme,
author='Timo Schuerg',
author_email='t.schuerg@th-bingen.de',
url='https://github.com/kennethreitz/samplemod',
author='Safouan Er-Ryfy',
author_email='safouan.erryfy@stud.h-da.de',
url='https://code.fbi.h-da.de/safouan.erryfy/dynamodb',
license=license,
packages=find_packages(exclude=('tests', 'docs'))
)
......@@ -6,7 +6,7 @@ import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
#from formulaone.sample.helpers import get_tidy_data_path
from formulaone.helpers import get_tidy_data_path
from dynamodb.helpers import get_tidy_data_path
import pandas as pd
......
......@@ -12,7 +12,7 @@ module_path = os.path.abspath(os.path.join(os.getcwd(), 'formulaone'))
sys.path.insert(0, module_path)
print(sys.path.insert(0, module_path))
from formulaone.dynamodb_helpers import *
from dynamodb.dynamodb_helpers import *
def test_aws_config_keys():
"""Test the necessary AWS config keys."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment