Skip to content

Commit

Permalink
Estimate Localized Economic Impacts in Tourism (#18)
Browse files Browse the repository at this point in the history
* Add visits notebook

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Revert "[pre-commit.ci] auto fixes from pre-commit.com hooks"

This reverts commit aa824e3.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
g4brielvs and pre-commit-ci[bot] committed Apr 3, 2024
1 parent 1108d6d commit a7e6462
Show file tree
Hide file tree
Showing 10 changed files with 2,106 additions and 2 deletions.
3 changes: 3 additions & 0 deletions docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ parts:
- file: notebooks/spill/spillover-README
sections:
- file: notebooks/spill/spill.ipynb
- file: notebooks/mobility/README.md
sections:
- file: notebooks/mobility/visits.ipynb
- caption: Insights and Indicators
chapters:
- file: notebooks/indicators/conflict-and-trade.ipynb
Expand Down
21 changes: 21 additions & 0 deletions notebooks/mobility/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Economic Impacts in Tourism

Understanding where and when population movement occurs can help inform disaster response and public policy, especially during crises.

(mobility-data)=

## Data

The project team acquired longitudinal human mobility data. The mobility data was provided pro-bono by [Veraset](https://veraset.com) through the proposal [Measure Activity Levels on Tourism Sites Affected by the 2023 Red Sea Crisis](https://portal.datapartnership.org/readableproposal/565) via the [Development Data Partnership](https://datapartnership.org). During the project’s execution, [Veraset Movement](https://www.veraset.com/products/movement/)’s global daily data feed was ingested and processed through the [Mobility](https://docs.datapartnership.org/collections/mobility/README.html) pipeline maintained by the [Development Data Partnership](https://datapartnership.org/). For additional information, please refer to the [Mobility Documentation](https://docs.datapartnership.org/collections/mobility/README.html) accessible to all World Bank staff.

### Data Availability Statement

Data are available upon request through the [Development Data Partnership](https://datapartnership.org). Licensing and access information for all other datasets are included in the documentation.

## Methodology

```{caution}
The following working methodologies are a work in progress and awaiting review.
```

- [Estimating Activity Through Point of Interest Visits Using Mobility Data](./visits.ipynb)
1,968 changes: 1,968 additions & 0 deletions notebooks/mobility/visits.ipynb

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "red-sea-monitoring"
dynamic = ["version"]
description = ""
readme = { file = "README.md", content-type = "text/markdown" }
license = { file = "LICENSE" }
Expand All @@ -18,7 +19,10 @@ classifiers = [
"Topic :: Scientific/Engineering",
]
requires-python = ">=3.10"
dynamic = ["version"]
dependencies = [
"bokeh>3,<4",
"geopandas>=0.12",
]

[project.optional-dependencies]
docs = [
Expand All @@ -36,7 +40,7 @@ ignore-regex = '^\s*"image\/png":\s.*'
ignore-words-list = "gost,"

[tool.hatch.build.targets.wheel]
packages = ["src/red-sea-monitoring"]
packages = ["src/red_sea_monitoring"]

[tool.hatch.version]
source = "vcs"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
108 changes: 108 additions & 0 deletions src/red_sea_monitoring/mobility.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import datetime

from bokeh.models import HoverTool, Legend, Span, Title
from bokeh.plotting import figure

COLORS = [
"#4E79A7", # Blue
"#F28E2B", # Orange
"#E15759", # Red
"#76B7B2", # Teal
"#59A14F", # Green
"#EDC948", # Yellow
"#B07AA1", # Purple
"#FF9DA7", # Pink
"#9C755F", # Brown
"#BAB0AC", # Gray
"#7C7C7C", # Dark gray
"#6B4C9A", # Violet
"#D55E00", # Orange-red
"#CC61B0", # Magenta
"#0072B2", # Bright blue
"#329262", # Peacock green
"#9E5B5A", # Brick red
"#636363", # Medium gray
"#CD9C00", # Gold
"#5D69B1", # Medium blue
]


def plot_visits(data, title="Points of Interest Visit Trends"):
"""Plot number of visits to OSM points of interest"""

p = figure(
title=title,
width=750,
height=750,
x_axis_label="Date",
x_axis_type="datetime",
y_axis_label="Count of Devices",
y_axis_type="log",
y_range=(0.75, 5 * 10**3),
tools="pan,reset,save,box_select",
)
p.add_layout(Legend(), "right")
p.add_layout(
Title(
text="Count of Devices Identified with OpenStreetMap tag",
text_font_size="12pt",
text_font_style="italic",
),
"above",
)
p.add_layout(
Title(
text=f"Source: Veraset Movement. Creation date: {datetime.datetime.today().strftime('%d %B %Y')}. Feedback: datalab@worldbank.org.",
text_font_size="10pt",
text_font_style="italic",
),
"below",
)

# plot spans
p.renderers.extend(
[
Span(
location=datetime.datetime(2023, 10, 7),
dimension="height",
line_color="grey",
line_width=2,
line_dash=(4, 4),
),
Span(
location=datetime.datetime(2023, 11, 17),
dimension="height",
line_color="grey",
line_width=2,
line_dash=(4, 4),
),
]
)

# plot lines
for column, color in zip(data.columns, COLORS):
try:
r = p.line(
data.index,
data[column],
legend_label=column,
line_color=color,
line_width=2,
)
if column != "hotel":
r.muted = True
except KeyError:
pass

p.add_tools(
HoverTool(
tooltips=[("Date", "@x{%F}"), ("Count", "@y")],
formatters={"@x": "datetime"},
)
)

p.legend.location = "bottom_left"
p.legend.click_policy = "mute"
p.title.text_font_size = "16pt"
# p.sizing_mode = "scale_both"
return p
File renamed without changes.
File renamed without changes.

0 comments on commit a7e6462

Please sign in to comment.