Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ jobs:
${{ runner.os }}-poetry-${{ matrix.python-version }}-

- name: Install dependencies
run: make .venv
run: |
poetry install --no-root
echo "VIRTUAL_ENV=$(poetry env info --path)" >> $GITHUB_ENV
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH

- name: Lint code
run: make lint
Expand Down
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,12 @@ testing, linting, and more.
This project uses [Poetry](https://python-poetry.org/) for dependency management.
To set up your development environment:

1. **Create and activate the virtual environment:**
**Create and activate the virtual environment:**

```bash
make .venv
```

2. **Install project dependencies:**

```bash
poetry install
```

### Running Normalisation Scripts

Each data source module under `src` contains scripts for data normalisation.
Expand Down
97 changes: 97 additions & 0 deletions notebooks/exploration.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Notebook: Exploration of csv files"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\"\"\"Exploration notebook for data analysis.\n",
"\n",
"This notebook contains data exploration steps for disaster analysis.\n",
"\"\"\"\n",
"\n",
"import sys\n",
"from pathlib import Path\n",
"\n",
"import pandas as pd\n",
"\n",
"module_path = Path(\"..\").resolve()\n",
"sys.path.append(str(module_path))"
]
},
{
"cell_type": "code",
"execution_count": 66,
"metadata": {},
"outputs": [],
"source": [
"def read_dat(dat_file: str) -> pd:\n",
" \"\"\"Reads a CSV file from the data_prep directory.\"\"\"\n",
" dat_dir = Path(\"../data_prep/\").resolve()\n",
" dat_path = dat_dir / dat_file\n",
" return pd.read_csv(dat_path)"
]
},
{
"cell_type": "code",
"execution_count": 67,
"metadata": {},
"outputs": [],
"source": [
"glide_prep_df = read_dat(\"glide_prep.csv\")\n",
"gdacs_prep_df = read_dat(\"gdacs_prep.csv\")\n",
"emdat_prep_df = read_dat(\"emdat_prep.csv\")\n",
"disaster_charter_df = read_dat(\"disaster_charter_prep.csv\")\n",
"cerf_df = read_dat(\"cerf_prep.csv\")\n",
"idmc_df = read_dat(\"idmc_prep.csv\")\n",
"ifrc_df = read_dat(\"ifrc_prep.csv\")"
]
},
{
"cell_type": "code",
"execution_count": 68,
"metadata": {},
"outputs": [],
"source": [
"pre_dfs = [\n",
" glide_prep_df,\n",
" gdacs_prep_df,\n",
" emdat_prep_df,\n",
" disaster_charter_df,\n",
" cerf_df,\n",
" idmc_df,\n",
" ifrc_df,\n",
"]"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"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.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
48 changes: 47 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pymarkdownlnt = "^0.9.23"
pytest = "^8.3.3"
ruff = "^0.6.8"
ipykernel = "^6.29.5"
nbqa = "^1.9.1"

[build-system]
requires = ["poetry-core"]
Expand Down