Barcelona Dashboard is an academic project where we can visualize, through bar charts, Barcelona populatio by districts and neighborhoods. Also, we can stratify the population by the year of the municipal register, gender and age of the poblation. And visualize on the map the location of districts and neighborhoods.
The dataset has been selected and downloaded from: Open Data BCN
In the developing, different technological stacks were used like Python, Pandas, FastAPI, MongoDB and Streamlit (among others).
- 1 Select Barcelona dataset.
- 2 Dataset exploration and treatment of duplicate and null data.
- 3 Dataset load in MongoDB Atlas( Previously treatment).
- 4 -API creation (using FastAPI):
- Connection with MongoDB.
- Definition of routers and endpoints.
- 5 Streamlit creation:
- API connection.
- Creation and parameterization of visualizations.
-
1-Access the directory:
../barcelona_dashboard
-
2-Install system requirements:
$ pip install -r requirements.txt
-
3-Access the directory:
../barcelona_dashboard/api
-
4-Run API:
$ uvicorn main:app
-
5-Access the directory:
../barcelona_dashboard/streamlit
-
6-Run main.py:
$ streamlit run main.py
1.1 -Navigation: At sidebar you can select between seeing the population and location by district or neighborhood.
1.2- Population and location by district:
-
1.2.1- A: you can select the year of display.
-
1.2.2- B: you can select the stratification variable (None, gender or age)
- 1.2.3- Population graph by district:
- 1.2.4- District population stratified by gender:
- 1.2.5- District population stratified by age:
- 1.2.6- Districts location graph:
- 1.2.7- Data download button (.csv):
1.3- Population and location by neighborhood:
-
1.3.1- A: you can select the year of display.
-
1.3.2- B: Select a district to view the population and location of the neighborhoods that make up it.
-
1.3.3- C: you can select the stratification variable (None, gender or age).
- 1.3.4- Population graph by neighborhood:
- 1.3.5-Neighborhood location graph:
- 1.3.6-Data download button (.csv):