Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
GandalFran committed Jan 4, 2021
1 parent c617560 commit ce0e121
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Twico, is the final project for the SOA subject of the Computer Science Master's
## Current deployments
- web: https://soa.servehttp.com
- api: http://soa.servehttp.com:5000/soa/v1/
- pm2 monitor: https://app.pm2.io/bucket/5ff2f7d6a523016b6fa70bca/backend/overview/servers

<img src="https://github.com/GandalFran/soa-final/blob/master/soa-web-app/vue-web/public/img/twico.PNG" align="center">
<img src="https://github.com/GandalFran/TwiCo/blob/master/soa-web-app/vue-web/public/img/dashboard.png" align="center">
Expand Down
4 changes: 3 additions & 1 deletion soa-api/src/soa/models/covid_model_bcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,13 @@ def extract(self, from_date=None, to_date=None):
from_date = (datetime.datetime.now() - datetime.timedelta(days=1)).date().isoformat()
if to_date is None:
to_date = datetime.datetime.now().date().isoformat()

uri = self._build_uri(from_date, to_date)
data = self._do_request(uri)
if data is not None:
if data or data is not None:
data = self._format_response(data)
else:
with open('/etc/bcn_data.json','r') as f:
data = json.loads(f.read())

return data
7 changes: 6 additions & 1 deletion soa-api/src/soa/models/covid_model_eu.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Copyright 2020 Luis Blazquez Miñambres (@luisblazquezm), Miguel Cabezas Puerto (@MiguelCabezasPuerto), Óscar Sánchez Juanes (@oscarsanchezj) and Francisco Pinto-Santos (@gandalfran)
# See LICENSE for details.

import json
import datetime
import pandas as pd

Expand Down Expand Up @@ -67,7 +68,6 @@ def _format_response(self, response:list) -> list:

transform_country = lambda x: ' '.join(x.split('_')).replace('(',' ').replace(')',' ')

print(response)
return [{
'date': r['dateRep'].isoformat(),
'country': transform_country(r['countriesAndTerritories']),
Expand Down Expand Up @@ -107,5 +107,10 @@ def extract(self, from_date=None, to_date=None):
if df is not None:
df = self._filter_dates(df, from_date, to_date)
data = self._format_response(df)

data = None
if data is None or not data:
with open('/etc/eu_data.json','r') as f:
data = json.loads(f.read())

return data

0 comments on commit ce0e121

Please sign in to comment.