🚀 Added Pipeline File

This commit is contained in:
Patrick Müller 2020-03-28 16:55:34 +01:00
parent 76f9ef7ccd
commit a6a6febe5f
4 changed files with 71 additions and 6 deletions

View File

@ -22,22 +22,44 @@ geoId
countryterritoryCode
popData2018
"""
from datetime import datetime, timedelta
class Analyser:
# Pandas Settings
pd.set_option('display.max_row', 1000)
pd.set_option('display.max_row', 50)
pd.set_option('display.max_column', 10)
df = pd.read_csv('2020-03-28_11-00.csv', encoding='windows-1252')
df['dateRep'] = pd.to_datetime(df['dateRep'])
print(df['dateRep'].head())
def getAvailableCountries(self):
return self.df['countriesAndTerritories'].unique()
def germany_cases_graph(self):
def getCasesGraph(self, country) -> str:
"""
Get a graph with the absolute number of cases by day for the entered country
:param country: The country you wish to get the graph for
:return: The path for the picture of the graph
"""
fig = plt.figure()
ax = fig.add_subplot(111)
germanyData = self.df[self.df['countriesAndTerritories'].isin(['Germany'])]
print(germanyData)
countryData = self.df[self.df['countriesAndTerritories'].isin([country])]
print(countryData['cases'].sum())
return 'abc'
def getTotalCases(self, country, date=datetime.now().strftime('%Y-%m-%d')) -> int:
"""
Get the current total cases for the entered country
:param country: The country you want the case number for
:param date: The date for which the case number is returned. Standard is the current date.
:return: The case number
"""
countryData = self.df[self.df['countriesAndTerritories'].isin([country])]
finalData = pd.DataFrame
countryData.filter(datetime.strptime(country))
print(finalData)
return countryData['cases'].sum()

12
HttpRequestHandler.py Normal file
View File

@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
"""
Project: Analyse worldwide COVID-19 Data and provide graphs etc.
@author Patrick Müller
"""
import socketserver
from http.server import BaseHTTPRequestHandler
class HttpRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
print('hello')

View File

@ -9,5 +9,5 @@ import Analyser as ana
if __name__ == '__main__':
analyser = ana.Analyser()
analyser.germany_cases_graph()
print(analyser.getAvailableCountries())
country = input('What country do you want the graph for: ')
analyser.getTotalCases(country, '2020-03-27')

31
bitbucket-pipelines.yml Normal file
View File

@ -0,0 +1,31 @@
# This is a sample build configuration for Other.
# Check our guides at https://confluence.atlassian.com/x/5Q4SMw for more examples.
# Only use spaces to indent your .yml configuration.
# -----asd
# You can specify a custom docker image from Docker Hub as your build environment.
image: atlassian/default-image:2
pipelines:
branches:
master:
- step:
deployment: production
script:
- echo "Running deployment to production"
- pipe: atlassian/sftp-deploy:0.5.2
variables:
USER: $SFTP_Username
SERVER: $SFTP_Host_Path
REMOTE_PATH: $SFTP_Production_Path
PASSWORD: $SFTP_Password
# feature:
# - step:
# deployment: test
# script:
# - echo "Running deployment to test"
# - pipe: atlassian/sftp-deploy:0.5.2
# variables:
# USER: $SFTP_Username
# SERVER: $SFTP_Host_Path
# REMOTE_PATH: $SFTP_TestPath
# PASSWORD: $SFTP_Password