Merge branch 'main' into develop

This commit is contained in:
Alexander Hess 2021-03-01 14:20:08 +01:00
commit 6c03261b07
Signed by: alexander
GPG key ID: 344EA5AB10D868E0
22 changed files with 618055 additions and 12 deletions

View file

@ -114,7 +114,7 @@
" shutil.rmtree(r_libs_path)\n",
"except FileNotFoundError:\n",
" pass\n",
"os.mkdir(r_libs_path)"
"os.makedirs(r_libs_path)"
]
},
{

View file

@ -192,7 +192,7 @@
"source": [
"%cd -q ..\n",
"!alembic upgrade f11cd76d2f45\n",
"%cd -q notebooks"
"%cd -q research"
]
},
{
@ -7647,7 +7647,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.8.6"
}
},
"nbformat": 4,

View file

@ -0,0 +1,168 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Gridification"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook runs the gridification script and creates all the pixels in the database."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[32murban-meal-delivery\u001b[0m, version \u001b[34m0.3.0\u001b[0m\n"
]
}
],
"source": [
"!umd --version"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Upgrade Database Schema"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This database migration also de-duplicates redundant addresses and removes obvious outliers."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"%cd -q .."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"INFO [alembic.runtime.migration] Context impl PostgresqlImpl.\n",
"INFO [alembic.runtime.migration] Will assume transactional DDL.\n",
"INFO [alembic.runtime.migration] Running upgrade f11cd76d2f45 -> 888e352d7526, Add pixel grid.\n",
"INFO [alembic.runtime.migration] Running upgrade 888e352d7526 -> e40623e10405, Add demand forecasting.\n",
"INFO [alembic.runtime.migration] Running upgrade e40623e10405 -> 26711cd3f9b9, Add confidence intervals to forecasts.\n",
"INFO [alembic.runtime.migration] Running upgrade 26711cd3f9b9 -> e86290e7305e, Remove orders from restaurants with invalid location ...\n"
]
}
],
"source": [
"!alembic upgrade e86290e7305e"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Create the Grids"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Put all restaurant locations in pixels."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3 cities retrieved from the database\n",
"\n",
"Creating grids for Lyon\n",
"Creating grid with a side length of 707 meters\n",
" -> created 62 pixels\n",
"Creating grid with a side length of 1000 meters\n",
" -> created 38 pixels\n",
"Creating grid with a side length of 1414 meters\n",
" -> created 24 pixels\n",
"=> assigned 358 out of 48058 addresses in Lyon\n",
"\n",
"Creating grids for Paris\n",
"Creating grid with a side length of 707 meters\n",
" -> created 199 pixels\n",
"Creating grid with a side length of 1000 meters\n",
" -> created 111 pixels\n",
"Creating grid with a side length of 1414 meters\n",
" -> created 66 pixels\n",
"=> assigned 1133 out of 108135 addresses in Paris\n",
"\n",
"Creating grids for Bordeaux\n",
"Creating grid with a side length of 707 meters\n",
" -> created 30 pixels\n",
"Creating grid with a side length of 1000 meters\n",
" -> created 22 pixels\n",
"Creating grid with a side length of 1414 meters\n",
" -> created 15 pixels\n",
"=> assigned 123 out of 21742 addresses in Bordeaux\n"
]
}
],
"source": [
"!umd gridify"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"%cd -q research"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff