Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add source info to log message
  • Loading branch information
Kilo59 committed Apr 18, 2020
commit 5a243bfba7e3a3d7273d5eea74b9afed6f37cfeb
6 changes: 3 additions & 3 deletions app/services/location/csbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ async def get_locations():
:rtype: dict
"""
logger = logging.getLogger("services.location.csbs")
logger.info("Requesting data...")
logger.info("csbs Requesting data...")
async with httputils.CLIENT_SESSION.get(BASE_URL) as response:
text = await response.text()

logger.info("Data received")
logger.info("csbs Data received")

data = list(csv.DictReader(text.splitlines()))
logger.info("CSV parsed")
Expand Down Expand Up @@ -83,7 +83,7 @@ async def get_locations():
int(item["Death"] or 0),
)
)
logger.info("Data normalized")
logger.info("csbs Data normalized")

# Return the locations.
return locations
8 changes: 4 additions & 4 deletions app/services/location/jhu.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ async def get_category(category):
url = BASE_URL + "time_series_covid19_%s_global.csv" % category

# Request the data
logger.info("Requesting data...")
logger.info("jhu Requesting data...")
async with httputils.CLIENT_SESSION.get(url) as response:
text = await response.text()

logger.info("Data received")
logger.info("jhu Data received")

# Parse the CSV.
data = list(csv.DictReader(text.splitlines()))
logger.info("CSV parsed")
logger.info("jhu CSV parsed")

# The normalized locations.
locations = []
Expand Down Expand Up @@ -98,7 +98,7 @@ async def get_category(category):
"latest": int(latest or 0),
}
)
logger.info("Data normalized")
logger.info("jhu Data normalized")

# Latest total.
latest = sum(map(lambda location: location["latest"], locations))
Expand Down
6 changes: 3 additions & 3 deletions app/services/location/nyt.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ async def get_locations():
logger = logging.getLogger("services.location.nyt")

# Request the data.
logger.info("Requesting data...")
logger.info("nyt Requesting data...")
async with httputils.CLIENT_SESSION.get(BASE_URL) as response:
text = await response.text()

logger.info("Data received")

# Parse the CSV.
data = list(csv.DictReader(text.splitlines()))
logger.info("CSV parsed")
logger.info("nyt CSV parsed")

# Group together locations (NYT data ordered by dates not location).
grouped_locations = get_grouped_locations_dict(data)
Expand Down Expand Up @@ -125,6 +125,6 @@ async def get_locations():
},
)
)
logger.info("Data normalized")
logger.info("nyt Data normalized")

return locations