adarvmaps 0.1.36__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- adarvmaps-0.1.36/.gitignore +13 -0
- adarvmaps-0.1.36/AUTHORS.md +14 -0
- adarvmaps-0.1.36/LICENSE +21 -0
- adarvmaps-0.1.36/PKG-INFO +247 -0
- adarvmaps-0.1.36/README.md +197 -0
- adarvmaps-0.1.36/adarvmaps/__init__.py +33 -0
- adarvmaps-0.1.36/adarvmaps/cli.py +112 -0
- adarvmaps-0.1.36/adarvmaps/data/__init__.py +0 -0
- adarvmaps-0.1.36/adarvmaps/data/district_boundary_lite.fgb +0 -0
- adarvmaps-0.1.36/adarvmaps/data/state_boundary_lite.fgb +0 -0
- adarvmaps-0.1.36/adarvmaps/exceptions.py +10 -0
- adarvmaps-0.1.36/adarvmaps/interactive.py +613 -0
- adarvmaps-0.1.36/adarvmaps/layers.py +225 -0
- adarvmaps-0.1.36/adarvmaps/loader.py +242 -0
- adarvmaps-0.1.36/adarvmaps/map_builder.py +265 -0
- adarvmaps-0.1.36/adarvmaps/sidebar.py +432 -0
- adarvmaps-0.1.36/adarvmaps/spatial.py +159 -0
- adarvmaps-0.1.36/pyproject.toml +58 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Authors
|
|
2
|
+
|
|
3
|
+
AdarvMaps is developed and maintained by the **ADARV** team.
|
|
4
|
+
|
|
5
|
+
| Name | Role |
|
|
6
|
+
|---|---|
|
|
7
|
+
| Muniraj Mallesan | Maintainer |
|
|
8
|
+
| Dr. Sharan Murali | Team Lead |
|
|
9
|
+
| Manikandan K | |
|
|
10
|
+
| Shanmuga Sundharam | |
|
|
11
|
+
| Yogita Chaudhary | |
|
|
12
|
+
| Barath U | |
|
|
13
|
+
| Balaji S | |
|
|
14
|
+
| Deepana R | |
|
adarvmaps-0.1.36/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 ADARV
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: adarvmaps
|
|
3
|
+
Version: 0.1.36
|
|
4
|
+
Summary: Interactive epidemiological spot maps for India
|
|
5
|
+
Project-URL: Homepage, https://github.com/ADARV-Epi-hub/adarvmaps
|
|
6
|
+
Project-URL: Repository, https://github.com/ADARV-Epi-hub/adarvmaps
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/ADARV-Epi-hub/adarvmaps/issues
|
|
8
|
+
Author: Muniraj Mallesan, Dr. Sharan Murali, Manikandan K, Shanmuga Sundharam, Yogita Chaudhary, Barath U, Balaji S, Deepana R
|
|
9
|
+
Maintainer-email: Muniraj Mallesan <adarv@nieicmr.org.in>
|
|
10
|
+
License: MIT License
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2025 ADARV
|
|
13
|
+
|
|
14
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
in the Software without restriction, including without limitation the rights
|
|
17
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
19
|
+
furnished to do so, subject to the following conditions:
|
|
20
|
+
|
|
21
|
+
The above copyright notice and this permission notice shall be included in all
|
|
22
|
+
copies or substantial portions of the Software.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
+
SOFTWARE.
|
|
31
|
+
License-File: AUTHORS.md
|
|
32
|
+
License-File: LICENSE
|
|
33
|
+
Keywords: case-control,epidemiology,folium,geospatial,india,spot map
|
|
34
|
+
Classifier: Intended Audience :: Science/Research
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Operating System :: OS Independent
|
|
37
|
+
Classifier: Programming Language :: Python :: 3
|
|
38
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
39
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
40
|
+
Requires-Python: >=3.9
|
|
41
|
+
Requires-Dist: folium>=0.14
|
|
42
|
+
Requires-Dist: geopandas>=0.13
|
|
43
|
+
Requires-Dist: numpy>=1.24
|
|
44
|
+
Requires-Dist: openpyxl>=3.1
|
|
45
|
+
Requires-Dist: pandas>=2.0
|
|
46
|
+
Requires-Dist: shapely>=2.0
|
|
47
|
+
Provides-Extra: test
|
|
48
|
+
Requires-Dist: pytest>=7; extra == 'test'
|
|
49
|
+
Description-Content-Type: text/markdown
|
|
50
|
+
|
|
51
|
+
# AdarvMaps
|
|
52
|
+
|
|
53
|
+
**Interactive epidemiological spot maps for India — no GIS software, no shapefiles, no setup.**
|
|
54
|
+
|
|
55
|
+
[](https://pypi.org/project/adarvmaps/)
|
|
56
|
+
[](https://pypi.org/project/adarvmaps/)
|
|
57
|
+
[](https://github.com/ADARV-Epi-hub/adarvmaps/blob/main/LICENSE)
|
|
58
|
+
|
|
59
|
+
AdarvMaps turns a spreadsheet of latitude and longitude from the field into a polished,
|
|
60
|
+
interactive HTML map. You can open the map in any browser, make edits, and download it as
|
|
61
|
+
a **PNG** image or **PDF**. India's state and district boundaries are already built in, so
|
|
62
|
+
you don't have to search for shapefiles.
|
|
63
|
+
|
|
64
|
+
- 📍 **Spot maps** — show the location of individual people or events
|
|
65
|
+
- 🔴 **Dot-density maps** — aggregate nearby points to show clustering of cases
|
|
66
|
+
- 🗺️ Built-in **state & district boundaries** — nothing to download
|
|
67
|
+
- 🎨 Recolour and resize markers, toggle place-name labels, export to PNG / PDF
|
|
68
|
+
- 🤖 **Auto-detects** your latitude / longitude / outcome columns
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## What will AdarvMaps do?
|
|
73
|
+
|
|
74
|
+
AdarvMaps turns your spreadsheet into an interactive map. It automatically places every
|
|
75
|
+
row as a **dot** at its location, draws the correct **state and district boundaries**, and
|
|
76
|
+
colours the groups (e.g. cases and controls) differently. It then generates a single,
|
|
77
|
+
self-contained **HTML** file you can open in any browser to fine-tune your map — and you
|
|
78
|
+
can download it as a PNG or PDF, or email it to a colleague. You may also aggregate the
|
|
79
|
+
dots to switch from a spot map to a **dot-density** map.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Which guide is for me?
|
|
84
|
+
|
|
85
|
+
| If this sounds like you… | Go to |
|
|
86
|
+
|---|---|
|
|
87
|
+
| 🙋 **"I just want a map — I don't write code."** | → [Guide for non-coders](#guide-for-non-coders) |
|
|
88
|
+
| 👩💻 **"I write Python and want the API / command line."** | → [Guide for developers](#guide-for-developers) |
|
|
89
|
+
|
|
90
|
+
Everyone should also read [Preparing your data](#preparing-your-data) first.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Preparing your data
|
|
95
|
+
|
|
96
|
+
Each **row** in your spreadsheet should be **one person or event**, and each row should
|
|
97
|
+
carry its **location** (latitude and longitude) in separate columns. You may also include
|
|
98
|
+
an extra column that splits the data into groups (e.g. case / control) if you want to show
|
|
99
|
+
both on the same map.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Guide for non-coders
|
|
104
|
+
|
|
105
|
+
This guide is for anyone who wants a map but has never written any code. You don't need to
|
|
106
|
+
install anything on your computer. You'll copy and paste two lines of template code, and
|
|
107
|
+
then AdarvMaps will guide you through the rest with a few plain-English questions.
|
|
108
|
+
|
|
109
|
+
### Step 1 — Open a free notebook
|
|
110
|
+
Go to **[colab.research.google.com](https://colab.research.google.com)** and click
|
|
111
|
+
**New notebook**. Google Colab is a free service that runs code in your web browser, so
|
|
112
|
+
there's nothing to install. You'll see an empty box called a *cell*.
|
|
113
|
+
|
|
114
|
+
### Step 2 — Start AdarvMaps
|
|
115
|
+
Click inside the cell, paste the two lines below, and press the ▶ (play) button:
|
|
116
|
+
```python
|
|
117
|
+
!pip install adarvmaps
|
|
118
|
+
import adarvmaps; adarvmaps.run()
|
|
119
|
+
```
|
|
120
|
+
The first line installs AdarvMaps; the second starts the guided wizard. Depending on your
|
|
121
|
+
internet speed, the install may take a little while.
|
|
122
|
+
|
|
123
|
+
### Step 3 — Answer the questions
|
|
124
|
+
AdarvMaps asks **five** questions. Each shows its own best guess — press **Enter** to
|
|
125
|
+
accept it, or type the number of the correct choice.
|
|
126
|
+
|
|
127
|
+
1. **Upload your data file**
|
|
128
|
+
- In Colab (or Jupyter / VS Code) an *Upload* button appears — click it and pick your
|
|
129
|
+
spreadsheet (CSV, Excel `.xlsx` / `.xls`, or TSV).
|
|
130
|
+
- AdarvMaps prints a quick summary — the number of rows and columns, each column name
|
|
131
|
+
with an example value, and the first few rows — so you can confirm it read your file.
|
|
132
|
+
- **FAQ: Is my data uploaded to a server?** On **Colab**, yes — Colab runs on Google's
|
|
133
|
+
cloud, so your file is processed on Google's servers (see the privacy note below). If
|
|
134
|
+
your data must stay private, **run AdarvMaps locally** instead (see Guide for
|
|
135
|
+
developers) — nothing leaves your computer.
|
|
136
|
+
|
|
137
|
+
2. **Which column has the latitude?**
|
|
138
|
+
- Latitude is the north–south number (for example, `28.61` for Delhi).
|
|
139
|
+
- AdarvMaps pre-selects the column it thinks is latitude — press Enter to accept, or, if
|
|
140
|
+
the guess is wrong, check the summary above and type the number of the right column.
|
|
141
|
+
|
|
142
|
+
3. **Which column has the longitude?**
|
|
143
|
+
- Longitude is the east–west number (for example, `77.20` for Delhi).
|
|
144
|
+
- AdarvMaps pre-selects its best guess — accept it or pick another.
|
|
145
|
+
- **Remember:** if the points later look misplaced, the most common cause is that
|
|
146
|
+
latitude and longitude are swapped.
|
|
147
|
+
|
|
148
|
+
4. **Which column has the outcome?**
|
|
149
|
+
- If your spreadsheet has a variable that splits the data into *cases* and *controls*,
|
|
150
|
+
or *affected* and *not affected*, choose it here. You can equally use this to show
|
|
151
|
+
*male* / *female*, *dead* / *alive*, or *positive* / *negative* differently on the
|
|
152
|
+
map — AdarvMaps lets you name the two groups.
|
|
153
|
+
- If you don't want any split, choose the first option: *My data is all cases (no
|
|
154
|
+
control group)*.
|
|
155
|
+
|
|
156
|
+
5. **Which value marks the outcome?**
|
|
157
|
+
- AdarvMaps lists the values found in the column you chose. Tell it which value is the
|
|
158
|
+
"case" (for example, if you coded `1 = Case, 0 = Control`, choose `1`).
|
|
159
|
+
- Every other value is treated as the other group.
|
|
160
|
+
|
|
161
|
+
### Step 4 — Get your map
|
|
162
|
+
- Your map appears right below the cell and is saved as a file called `adarvmaps.html`.
|
|
163
|
+
- Download it and open it in any browser — it works on its own, no internet needed to view.
|
|
164
|
+
- Using the map's sidebar you can: switch between **Spot Map** and **Dot Density**, show one
|
|
165
|
+
group or both, change colours and resize the dots, toggle **place-name labels**, and save
|
|
166
|
+
the map as a **PNG** or **PDF**.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Guide for developers
|
|
171
|
+
|
|
172
|
+
### Install
|
|
173
|
+
```bash
|
|
174
|
+
pip install adarvmaps
|
|
175
|
+
```
|
|
176
|
+
Python 3.9+.
|
|
177
|
+
|
|
178
|
+
### Usage
|
|
179
|
+
```python
|
|
180
|
+
from adarvmaps import AdarvMaps
|
|
181
|
+
|
|
182
|
+
# `data` accepts a CSV path or a pandas DataFrame
|
|
183
|
+
AdarvMaps("my_data.csv").build().save("map.html")
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Or from the command line:
|
|
187
|
+
```bash
|
|
188
|
+
adarvmaps my_data.csv -o map.html
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Common options
|
|
192
|
+
`AdarvMaps(data, ...)` — all options below are keyword arguments:
|
|
193
|
+
|
|
194
|
+
| Option | Default | Description |
|
|
195
|
+
|---|---|---|
|
|
196
|
+
| `lat_col`, `long_col`, `outcome_col` | auto | Override column auto-detection |
|
|
197
|
+
| `case_value` | auto | Value in `outcome_col` that means "case" |
|
|
198
|
+
| `case_label`, `control_label` | "Case" / "Control" | Names for the two groups, e.g. "Male" / "Female" |
|
|
199
|
+
| `all_cases` | `False` | Treat every row as a case (no controls) |
|
|
200
|
+
| `case_color`, `control_color`, `cluster_color` | ADARV palette | Marker colours (hex) |
|
|
201
|
+
| `state_shp`, `district_shp` | bundled | Use your own boundary files |
|
|
202
|
+
|
|
203
|
+
**Full API and CLI reference →** [DOCUMENTATION.md](https://github.com/ADARV-Epi-hub/adarvmaps/blob/main/DOCUMENTATION.md)
|
|
204
|
+
|
|
205
|
+
> 🔒 **Privacy:** running AdarvMaps locally keeps your data on your machine — nothing is
|
|
206
|
+
> uploaded. Google Colab is convenient but runs on Google's cloud, so use it only for
|
|
207
|
+
> de-identified or demo data.
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Preparing your data (details)
|
|
212
|
+
|
|
213
|
+
AdarvMaps reads a CSV and **auto-detects** the columns — you don't have to rename anything.
|
|
214
|
+
At a minimum it needs **location** and, optionally, an **outcome**:
|
|
215
|
+
|
|
216
|
+
| What AdarvMaps needs | Possible column names | How to provide it |
|
|
217
|
+
|---|---|---|
|
|
218
|
+
| **Coordinates** | `lat`, `lon` (or `latitude`, `longitude`) | Separate `lat` / `lon` columns **or** one combined `"lat,lon"` column |
|
|
219
|
+
| **Outcome** (optional) | `outcome`, `status`, `case_control`, `case` | A column with values like `case` / `control` |
|
|
220
|
+
|
|
221
|
+
**Example:**
|
|
222
|
+
```csv
|
|
223
|
+
latitude,longitude,outcome
|
|
224
|
+
28.6,77.2,case
|
|
225
|
+
19.0,72.8,control
|
|
226
|
+
13.0,80.2,case
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## What you get
|
|
232
|
+
|
|
233
|
+
A single, self-contained HTML file you can open in any browser or share. Its sidebar lets
|
|
234
|
+
anyone switch between **Dot Density** and **Spot Pins**, show one group or both, recolour
|
|
235
|
+
and resize markers, toggle **place-name labels**, and export to **PNG / PDF**.
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## ADARV Team
|
|
240
|
+
|
|
241
|
+
AdarvMaps is developed by the **ADARV** team: **Muniraj Mallesan** (maintainer),
|
|
242
|
+
**Dr. Sharan Murali** (team lead), Manikandan K, Shanmuga Sundharam, Yogita Chaudhary,
|
|
243
|
+
Barath U, Balaji S, and Deepana R.
|
|
244
|
+
|
|
245
|
+
## License
|
|
246
|
+
|
|
247
|
+
MIT © ADARV
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# AdarvMaps
|
|
2
|
+
|
|
3
|
+
**Interactive epidemiological spot maps for India — no GIS software, no shapefiles, no setup.**
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/adarvmaps/)
|
|
6
|
+
[](https://pypi.org/project/adarvmaps/)
|
|
7
|
+
[](https://github.com/ADARV-Epi-hub/adarvmaps/blob/main/LICENSE)
|
|
8
|
+
|
|
9
|
+
AdarvMaps turns a spreadsheet of latitude and longitude from the field into a polished,
|
|
10
|
+
interactive HTML map. You can open the map in any browser, make edits, and download it as
|
|
11
|
+
a **PNG** image or **PDF**. India's state and district boundaries are already built in, so
|
|
12
|
+
you don't have to search for shapefiles.
|
|
13
|
+
|
|
14
|
+
- 📍 **Spot maps** — show the location of individual people or events
|
|
15
|
+
- 🔴 **Dot-density maps** — aggregate nearby points to show clustering of cases
|
|
16
|
+
- 🗺️ Built-in **state & district boundaries** — nothing to download
|
|
17
|
+
- 🎨 Recolour and resize markers, toggle place-name labels, export to PNG / PDF
|
|
18
|
+
- 🤖 **Auto-detects** your latitude / longitude / outcome columns
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## What will AdarvMaps do?
|
|
23
|
+
|
|
24
|
+
AdarvMaps turns your spreadsheet into an interactive map. It automatically places every
|
|
25
|
+
row as a **dot** at its location, draws the correct **state and district boundaries**, and
|
|
26
|
+
colours the groups (e.g. cases and controls) differently. It then generates a single,
|
|
27
|
+
self-contained **HTML** file you can open in any browser to fine-tune your map — and you
|
|
28
|
+
can download it as a PNG or PDF, or email it to a colleague. You may also aggregate the
|
|
29
|
+
dots to switch from a spot map to a **dot-density** map.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Which guide is for me?
|
|
34
|
+
|
|
35
|
+
| If this sounds like you… | Go to |
|
|
36
|
+
|---|---|
|
|
37
|
+
| 🙋 **"I just want a map — I don't write code."** | → [Guide for non-coders](#guide-for-non-coders) |
|
|
38
|
+
| 👩💻 **"I write Python and want the API / command line."** | → [Guide for developers](#guide-for-developers) |
|
|
39
|
+
|
|
40
|
+
Everyone should also read [Preparing your data](#preparing-your-data) first.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Preparing your data
|
|
45
|
+
|
|
46
|
+
Each **row** in your spreadsheet should be **one person or event**, and each row should
|
|
47
|
+
carry its **location** (latitude and longitude) in separate columns. You may also include
|
|
48
|
+
an extra column that splits the data into groups (e.g. case / control) if you want to show
|
|
49
|
+
both on the same map.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Guide for non-coders
|
|
54
|
+
|
|
55
|
+
This guide is for anyone who wants a map but has never written any code. You don't need to
|
|
56
|
+
install anything on your computer. You'll copy and paste two lines of template code, and
|
|
57
|
+
then AdarvMaps will guide you through the rest with a few plain-English questions.
|
|
58
|
+
|
|
59
|
+
### Step 1 — Open a free notebook
|
|
60
|
+
Go to **[colab.research.google.com](https://colab.research.google.com)** and click
|
|
61
|
+
**New notebook**. Google Colab is a free service that runs code in your web browser, so
|
|
62
|
+
there's nothing to install. You'll see an empty box called a *cell*.
|
|
63
|
+
|
|
64
|
+
### Step 2 — Start AdarvMaps
|
|
65
|
+
Click inside the cell, paste the two lines below, and press the ▶ (play) button:
|
|
66
|
+
```python
|
|
67
|
+
!pip install adarvmaps
|
|
68
|
+
import adarvmaps; adarvmaps.run()
|
|
69
|
+
```
|
|
70
|
+
The first line installs AdarvMaps; the second starts the guided wizard. Depending on your
|
|
71
|
+
internet speed, the install may take a little while.
|
|
72
|
+
|
|
73
|
+
### Step 3 — Answer the questions
|
|
74
|
+
AdarvMaps asks **five** questions. Each shows its own best guess — press **Enter** to
|
|
75
|
+
accept it, or type the number of the correct choice.
|
|
76
|
+
|
|
77
|
+
1. **Upload your data file**
|
|
78
|
+
- In Colab (or Jupyter / VS Code) an *Upload* button appears — click it and pick your
|
|
79
|
+
spreadsheet (CSV, Excel `.xlsx` / `.xls`, or TSV).
|
|
80
|
+
- AdarvMaps prints a quick summary — the number of rows and columns, each column name
|
|
81
|
+
with an example value, and the first few rows — so you can confirm it read your file.
|
|
82
|
+
- **FAQ: Is my data uploaded to a server?** On **Colab**, yes — Colab runs on Google's
|
|
83
|
+
cloud, so your file is processed on Google's servers (see the privacy note below). If
|
|
84
|
+
your data must stay private, **run AdarvMaps locally** instead (see Guide for
|
|
85
|
+
developers) — nothing leaves your computer.
|
|
86
|
+
|
|
87
|
+
2. **Which column has the latitude?**
|
|
88
|
+
- Latitude is the north–south number (for example, `28.61` for Delhi).
|
|
89
|
+
- AdarvMaps pre-selects the column it thinks is latitude — press Enter to accept, or, if
|
|
90
|
+
the guess is wrong, check the summary above and type the number of the right column.
|
|
91
|
+
|
|
92
|
+
3. **Which column has the longitude?**
|
|
93
|
+
- Longitude is the east–west number (for example, `77.20` for Delhi).
|
|
94
|
+
- AdarvMaps pre-selects its best guess — accept it or pick another.
|
|
95
|
+
- **Remember:** if the points later look misplaced, the most common cause is that
|
|
96
|
+
latitude and longitude are swapped.
|
|
97
|
+
|
|
98
|
+
4. **Which column has the outcome?**
|
|
99
|
+
- If your spreadsheet has a variable that splits the data into *cases* and *controls*,
|
|
100
|
+
or *affected* and *not affected*, choose it here. You can equally use this to show
|
|
101
|
+
*male* / *female*, *dead* / *alive*, or *positive* / *negative* differently on the
|
|
102
|
+
map — AdarvMaps lets you name the two groups.
|
|
103
|
+
- If you don't want any split, choose the first option: *My data is all cases (no
|
|
104
|
+
control group)*.
|
|
105
|
+
|
|
106
|
+
5. **Which value marks the outcome?**
|
|
107
|
+
- AdarvMaps lists the values found in the column you chose. Tell it which value is the
|
|
108
|
+
"case" (for example, if you coded `1 = Case, 0 = Control`, choose `1`).
|
|
109
|
+
- Every other value is treated as the other group.
|
|
110
|
+
|
|
111
|
+
### Step 4 — Get your map
|
|
112
|
+
- Your map appears right below the cell and is saved as a file called `adarvmaps.html`.
|
|
113
|
+
- Download it and open it in any browser — it works on its own, no internet needed to view.
|
|
114
|
+
- Using the map's sidebar you can: switch between **Spot Map** and **Dot Density**, show one
|
|
115
|
+
group or both, change colours and resize the dots, toggle **place-name labels**, and save
|
|
116
|
+
the map as a **PNG** or **PDF**.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Guide for developers
|
|
121
|
+
|
|
122
|
+
### Install
|
|
123
|
+
```bash
|
|
124
|
+
pip install adarvmaps
|
|
125
|
+
```
|
|
126
|
+
Python 3.9+.
|
|
127
|
+
|
|
128
|
+
### Usage
|
|
129
|
+
```python
|
|
130
|
+
from adarvmaps import AdarvMaps
|
|
131
|
+
|
|
132
|
+
# `data` accepts a CSV path or a pandas DataFrame
|
|
133
|
+
AdarvMaps("my_data.csv").build().save("map.html")
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Or from the command line:
|
|
137
|
+
```bash
|
|
138
|
+
adarvmaps my_data.csv -o map.html
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Common options
|
|
142
|
+
`AdarvMaps(data, ...)` — all options below are keyword arguments:
|
|
143
|
+
|
|
144
|
+
| Option | Default | Description |
|
|
145
|
+
|---|---|---|
|
|
146
|
+
| `lat_col`, `long_col`, `outcome_col` | auto | Override column auto-detection |
|
|
147
|
+
| `case_value` | auto | Value in `outcome_col` that means "case" |
|
|
148
|
+
| `case_label`, `control_label` | "Case" / "Control" | Names for the two groups, e.g. "Male" / "Female" |
|
|
149
|
+
| `all_cases` | `False` | Treat every row as a case (no controls) |
|
|
150
|
+
| `case_color`, `control_color`, `cluster_color` | ADARV palette | Marker colours (hex) |
|
|
151
|
+
| `state_shp`, `district_shp` | bundled | Use your own boundary files |
|
|
152
|
+
|
|
153
|
+
**Full API and CLI reference →** [DOCUMENTATION.md](https://github.com/ADARV-Epi-hub/adarvmaps/blob/main/DOCUMENTATION.md)
|
|
154
|
+
|
|
155
|
+
> 🔒 **Privacy:** running AdarvMaps locally keeps your data on your machine — nothing is
|
|
156
|
+
> uploaded. Google Colab is convenient but runs on Google's cloud, so use it only for
|
|
157
|
+
> de-identified or demo data.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Preparing your data (details)
|
|
162
|
+
|
|
163
|
+
AdarvMaps reads a CSV and **auto-detects** the columns — you don't have to rename anything.
|
|
164
|
+
At a minimum it needs **location** and, optionally, an **outcome**:
|
|
165
|
+
|
|
166
|
+
| What AdarvMaps needs | Possible column names | How to provide it |
|
|
167
|
+
|---|---|---|
|
|
168
|
+
| **Coordinates** | `lat`, `lon` (or `latitude`, `longitude`) | Separate `lat` / `lon` columns **or** one combined `"lat,lon"` column |
|
|
169
|
+
| **Outcome** (optional) | `outcome`, `status`, `case_control`, `case` | A column with values like `case` / `control` |
|
|
170
|
+
|
|
171
|
+
**Example:**
|
|
172
|
+
```csv
|
|
173
|
+
latitude,longitude,outcome
|
|
174
|
+
28.6,77.2,case
|
|
175
|
+
19.0,72.8,control
|
|
176
|
+
13.0,80.2,case
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## What you get
|
|
182
|
+
|
|
183
|
+
A single, self-contained HTML file you can open in any browser or share. Its sidebar lets
|
|
184
|
+
anyone switch between **Dot Density** and **Spot Pins**, show one group or both, recolour
|
|
185
|
+
and resize markers, toggle **place-name labels**, and export to **PNG / PDF**.
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## ADARV Team
|
|
190
|
+
|
|
191
|
+
AdarvMaps is developed by the **ADARV** team: **Muniraj Mallesan** (maintainer),
|
|
192
|
+
**Dr. Sharan Murali** (team lead), Manikandan K, Shanmuga Sundharam, Yogita Chaudhary,
|
|
193
|
+
Barath U, Balaji S, and Deepana R.
|
|
194
|
+
|
|
195
|
+
## License
|
|
196
|
+
|
|
197
|
+
MIT © ADARV
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""adarvmaps — Interactive epidemiological spot maps for India."""
|
|
2
|
+
|
|
3
|
+
from .exceptions import ColumnNotFoundError, NoCasePointsError, AdarvMapsError
|
|
4
|
+
from .interactive import run_interactive, adarvmaps_run
|
|
5
|
+
from .map_builder import AdarvMaps
|
|
6
|
+
|
|
7
|
+
# Short, friendly alias so non-coders can simply do: import adarvmaps; adarvmaps.run()
|
|
8
|
+
run = adarvmaps_run
|
|
9
|
+
|
|
10
|
+
__version__ = "0.1.36"
|
|
11
|
+
__all__ = [
|
|
12
|
+
"AdarvMaps",
|
|
13
|
+
"run", # friendly alias for adarvmaps_run
|
|
14
|
+
"adarvmaps_run",
|
|
15
|
+
"run_interactive", # deprecated alias, kept for backward compat
|
|
16
|
+
"AdarvMapsError",
|
|
17
|
+
"ColumnNotFoundError",
|
|
18
|
+
"NoCasePointsError",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
# Friendly welcome shown when the package is imported, to help first-time
|
|
22
|
+
# (non-coder) users know how to launch the tool. At this point `import adarvmaps`
|
|
23
|
+
# has already run, so we only need to tell them the one next line.
|
|
24
|
+
print(
|
|
25
|
+
f"\n"
|
|
26
|
+
f"Interactive AdarvMaps for India - created by ADARV\n"
|
|
27
|
+
f"\n"
|
|
28
|
+
f"No code required! To build your map, just run:\n"
|
|
29
|
+
f"\n"
|
|
30
|
+
f"adarvmaps.run()\n"
|
|
31
|
+
f"\n"
|
|
32
|
+
f"You'll be asked to choose your data file, then your map appears.\n"
|
|
33
|
+
)
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"""Command-line interface for adarvmaps."""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
_EPILOG = """\
|
|
8
|
+
Examples:
|
|
9
|
+
adarvmaps launch the guided wizard (easiest)
|
|
10
|
+
adarvmaps data.csv build a map from data.csv
|
|
11
|
+
adarvmaps data.csv -o my_map.html choose where to save the map
|
|
12
|
+
|
|
13
|
+
In Python or Google Colab:
|
|
14
|
+
from adarvmaps import adarvmaps_run
|
|
15
|
+
adarvmaps_run()
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _build_parser() -> argparse.ArgumentParser:
|
|
20
|
+
p = argparse.ArgumentParser(
|
|
21
|
+
prog="adarvmaps",
|
|
22
|
+
description="Generate an interactive epidemiological spot map for India.",
|
|
23
|
+
epilog=_EPILOG,
|
|
24
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
25
|
+
)
|
|
26
|
+
p.add_argument(
|
|
27
|
+
"csv",
|
|
28
|
+
nargs="?",
|
|
29
|
+
default=None,
|
|
30
|
+
help="Path to your data file (CSV/Excel). Omit it to launch the guided wizard.",
|
|
31
|
+
)
|
|
32
|
+
p.add_argument(
|
|
33
|
+
"-o", "--output",
|
|
34
|
+
default="adarvmaps_output.html",
|
|
35
|
+
help="Output HTML file path (default: adarvmaps_output.html).",
|
|
36
|
+
)
|
|
37
|
+
p.add_argument("--state-shp", default=None, help="Custom state boundary file.")
|
|
38
|
+
p.add_argument("--district-shp", default=None, help="Custom district boundary file.")
|
|
39
|
+
p.add_argument("--lat-col", default=None, help="Latitude column name.")
|
|
40
|
+
p.add_argument("--lon-col", default=None, help="Longitude column name.")
|
|
41
|
+
p.add_argument("--outcome-col", default=None, help="Outcome column name.")
|
|
42
|
+
p.add_argument("--case-value", default=None, help="Value that represents a case.")
|
|
43
|
+
p.add_argument(
|
|
44
|
+
"--count-cutoff",
|
|
45
|
+
type=int,
|
|
46
|
+
default=2,
|
|
47
|
+
help="District count threshold for mode selection (default: 2).",
|
|
48
|
+
)
|
|
49
|
+
p.add_argument(
|
|
50
|
+
"--cluster-color",
|
|
51
|
+
default="#E85252",
|
|
52
|
+
help="Hex colour for dot-density clusters (default: #E85252).",
|
|
53
|
+
)
|
|
54
|
+
p.add_argument(
|
|
55
|
+
"--case-color",
|
|
56
|
+
default="#D55757",
|
|
57
|
+
help="Hex colour for case pins (default: #D55757).",
|
|
58
|
+
)
|
|
59
|
+
p.add_argument(
|
|
60
|
+
"--control-color",
|
|
61
|
+
default="#7676E7",
|
|
62
|
+
help="Hex colour for control pins (default: #7676E7).",
|
|
63
|
+
)
|
|
64
|
+
p.add_argument(
|
|
65
|
+
"--case-label",
|
|
66
|
+
default=None,
|
|
67
|
+
help="Name for the case group on the map, e.g. Male (default: Case).",
|
|
68
|
+
)
|
|
69
|
+
p.add_argument(
|
|
70
|
+
"--control-label",
|
|
71
|
+
default=None,
|
|
72
|
+
help="Name for the control group on the map, e.g. Female (default: Control).",
|
|
73
|
+
)
|
|
74
|
+
return p
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def main(argv=None) -> None:
|
|
78
|
+
parser = _build_parser()
|
|
79
|
+
args = parser.parse_args(argv)
|
|
80
|
+
|
|
81
|
+
# No data file given → launch the friendly step-by-step wizard.
|
|
82
|
+
if args.csv is None:
|
|
83
|
+
from .interactive import adarvmaps_run
|
|
84
|
+
adarvmaps_run(args.output)
|
|
85
|
+
return
|
|
86
|
+
|
|
87
|
+
from .map_builder import AdarvMaps
|
|
88
|
+
|
|
89
|
+
try:
|
|
90
|
+
AdarvMaps(
|
|
91
|
+
args.csv,
|
|
92
|
+
state_shp=args.state_shp,
|
|
93
|
+
district_shp=args.district_shp,
|
|
94
|
+
lat_col=args.lat_col,
|
|
95
|
+
long_col=args.lon_col,
|
|
96
|
+
outcome_col=args.outcome_col,
|
|
97
|
+
case_value=args.case_value,
|
|
98
|
+
count_cutoff=args.count_cutoff,
|
|
99
|
+
cluster_color=args.cluster_color,
|
|
100
|
+
case_color=args.case_color,
|
|
101
|
+
control_color=args.control_color,
|
|
102
|
+
case_label=args.case_label,
|
|
103
|
+
control_label=args.control_label,
|
|
104
|
+
).build().save(args.output)
|
|
105
|
+
print(f"Map saved to: {args.output}")
|
|
106
|
+
except Exception as exc:
|
|
107
|
+
print(f"Error: {exc}", file=sys.stderr)
|
|
108
|
+
sys.exit(1)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
if __name__ == "__main__":
|
|
112
|
+
main()
|
|
File without changes
|
|
Binary file
|
|
Binary file
|