Skip to content

Commit

Permalink
Merge pull request #33 from Seshat-Global-History-Databank/fix/7
Browse files Browse the repository at this point in the history
Fix/7
  • Loading branch information
edwardchalstrey1 authored Jul 19, 2024
2 parents 6337f6d + 5583598 commit 7d28412
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 320 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ pulumi/logs
pulumi/Pulumi.seshat.yaml
scripts
.DS_Store
*.ipynb

docs/source/api/seshat/
docs/source/api/custom_filters/
2 changes: 2 additions & 0 deletions notebooks/README.md → cliopatria/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Cliopatria is the shape dataset used by the Seshat Global History Databank website. It can also be explored in a local Jupyter notebook running on your local machine by following these instructions.

<!-- TODO: Add download link for Cliopatria -->

1. Ensure you have a working installation of Python 3 and Conda. If not, [download Anaconda](https://docs.anaconda.com/free/anaconda/install/index.html), which should give you both
- Note: you can use a different tool for creating a Python virtual environment than conda (e.g. venv) if you prefer

Expand Down
94 changes: 94 additions & 0 deletions cliopatria/cliopatria.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Cliopatria viewer\n",
"\n",
"1. Download and unzip the Cliopatria dataset.\n",
"2. Update the Cliopatria GeoJSON file with colours and other properties required by Seshat:\n",
" ```\n",
" python cliopatria/convert_data.py /path/to/cliopatria.geojson\n",
" ```\n",
" Note: this will create a new file with the same name but with the suffix \"_seshat_processed.geojson\"\n",
"3. Run the subsequent cells of this notebook\n",
"4. Play around with both the GeoDataFrame (gdf) and the rendered map\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Note: update this path to the location of the cliopatria data\n",
"cliopatria_geojson_path = \"../data/cliopatria_07052024/cliopatria_composite_unique_simplified_seshat_processed.geojson\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Import necessary libraries\n",
"from map_functions import display_map\n",
"import geopandas as gpd"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Load the processed Cliopatria data to a GeoDataFrame with geopandas\n",
"gdf = gpd.read_file(cliopatria_geojson_path)\n",
"gdf.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Play with the data on the map\n",
"\n",
"**Notes**\n",
"- Use minus numbers for BCE.\n",
"- Click the shapes to reveal the polity display names"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"display_year = 1217\n",
"display_map(gdf, display_year)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python (cliopatria1)",
"language": "python",
"name": "cliopatria1"
},
"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.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions docs/source/getting-started/setup/cloud/pulumi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,18 @@ In order to restore the database from the dump, run the following command:
$ sudo psql -U postgres <seshat_db_name> < ~/seshat.dump
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Optional] manual step 4.1: Update the database with the latest shape data
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If you need to update the database with the latest shape datasets, you can do so by following the instructions in `spatialdb.rst <../spatialdb.rst>`_.
You can first upload the data files required to the VM using ``scp``:
.. code-block:: bash
$ scp -i ~/.ssh/id_rsa path/to/datafile webadmin@<VM IP adress>:location_on_vm/datafile
Manual step 5: Run the Django app
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
10 changes: 5 additions & 5 deletions docs/source/getting-started/setup/local/ubuntu.rst
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,11 @@ The file should look like this:

.. code-block::
NAME=<seshat_db_name>
USER=postgres
HOST=localhost
PORT=5432
PASSWORD=<db_password>
DB_NAME=<seshat_db_name>
DB_USER=postgres
DB_HOST=localhost
DB_PORT=5432
DB_PASSWORD=<db_password>
Step 10: Migrate the database
Expand Down
Loading

0 comments on commit 7d28412

Please sign in to comment.