adarvmap 0.1.41__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.
@@ -0,0 +1,13 @@
1
+ .claude/
2
+
3
+ # Python build / cache artifacts
4
+ __pycache__/
5
+ *.py[cod]
6
+ *.egg-info/
7
+ build/
8
+ dist/
9
+ .pytest_cache/
10
+
11
+ # Local demo/scratch output
12
+ *_demo.html
13
+ COMMIT_MSG.tmp
@@ -0,0 +1,14 @@
1
+ # Authors
2
+
3
+ AdarvMap 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 | |
@@ -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,249 @@
1
+ Metadata-Version: 2.5
2
+ Name: adarvmap
3
+ Version: 0.1.41
4
+ Summary: Interactive epidemiological spot maps for India
5
+ Project-URL: Homepage, https://github.com/ADARV-Epi-hub/adarvmap
6
+ Project-URL: Repository, https://github.com/ADARV-Epi-hub/adarvmap
7
+ Project-URL: Bug Tracker, https://github.com/ADARV-Epi-hub/adarvmap/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
+ # AdarvMap
52
+
53
+ **Interactive epidemiological spot maps for India — no GIS software, no shapefiles, no setup.**
54
+
55
+ [![PyPI version](https://img.shields.io/pypi/v/adarvmap.svg)](https://pypi.org/project/adarvmap/)
56
+ [![Python versions](https://img.shields.io/pypi/pyversions/adarvmap.svg)](https://pypi.org/project/adarvmap/)
57
+ [![License: MIT](https://img.shields.io/pypi/l/adarvmap.svg)](https://github.com/ADARV-Epi-hub/adarvmap/blob/main/LICENSE)
58
+
59
+ AdarvMap 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 AdarvMap do?
73
+
74
+ AdarvMap 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 AdarvMap 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 AdarvMap
115
+ Click inside the cell, paste the two lines below, and press the ▶ (play) button:
116
+ ```python
117
+ !pip install adarvmap
118
+ import adarvmap; adarvmap.run()
119
+ ```
120
+ The first line installs AdarvMap; 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
+ AdarvMap 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
+ - AdarvMap 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 AdarvMap 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
+ - AdarvMap 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
+ - AdarvMap 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 is your grouping variable?**
149
+ - Choose the column that splits your data into two groups — *case* / *control*,
150
+ *affected* / *not affected*, *male* / *female*, *dead* / *alive*, *positive* /
151
+ *negative*, and so on. The map uses the **actual values from your data** as the group
152
+ names automatically — you don't have to type anything.
153
+ - If you don't want any split, choose the first option: *No grouping — show all rows
154
+ the same*.
155
+
156
+ 5. **Which value is the main group?**
157
+ - AdarvMap lists the values found in the column you chose. Tell it which one is the
158
+ **main group** (it's the highlighted / clustered group; for example, if you coded
159
+ `1 = Case, 0 = Control`, choose `1`).
160
+ - Every other value becomes the other group, shown with its own name.
161
+
162
+ ### Step 4 — Get your map
163
+ - Your map appears right below the cell and is saved as a file called `adarvmap.html`.
164
+ - Download it and open it in any browser, or email it to a colleague — it's a single
165
+ self-contained file (an internet connection is needed to load the background map tiles).
166
+ - Using the map's sidebar you can: switch between **Spot Map** and **Dot Density**, show one
167
+ group or both, change colours and resize the dots, toggle **place-name labels**, and save
168
+ the map as a **PNG** or **PDF**.
169
+
170
+ ---
171
+
172
+ ## Guide for developers
173
+
174
+ ### Install
175
+ ```bash
176
+ pip install adarvmap
177
+ ```
178
+ Python 3.9+.
179
+
180
+ ### Usage
181
+ ```python
182
+ from adarvmap import AdarvMap
183
+
184
+ # `data` accepts a CSV path or a pandas DataFrame
185
+ AdarvMap("my_data.csv").build().save("map.html")
186
+ ```
187
+
188
+ Or from the command line:
189
+ ```bash
190
+ adarvmap my_data.csv -o map.html
191
+ ```
192
+
193
+ ### Common options
194
+ `AdarvMap(data, ...)` — all options below are keyword arguments:
195
+
196
+ | Option | Default | Description |
197
+ |---|---|---|
198
+ | `lat_col`, `long_col`, `outcome_col` | auto | Override column auto-detection |
199
+ | `case_value` | auto | Value in `outcome_col` that means "case" |
200
+ | `case_label`, `control_label` | "Case" / "Control" | Names for the two groups, e.g. "Male" / "Female" |
201
+ | `all_cases` | `False` | Treat every row as a case (no controls) |
202
+ | `case_color`, `control_color`, `cluster_color` | ADARV palette | Marker colours (hex) |
203
+ | `state_shp`, `district_shp` | bundled | Use your own boundary files |
204
+
205
+ **Full API and CLI reference →** [DOCUMENTATION.md](https://github.com/ADARV-Epi-hub/adarvmap/blob/main/DOCUMENTATION.md)
206
+
207
+ > 🔒 **Privacy:** running AdarvMap locally keeps your data on your machine — nothing is
208
+ > uploaded. Google Colab is convenient but runs on Google's cloud, so use it only for
209
+ > de-identified or demo data.
210
+
211
+ ---
212
+
213
+ ## Preparing your data (details)
214
+
215
+ AdarvMap reads a CSV and **auto-detects** the columns — you don't have to rename anything.
216
+ At a minimum it needs **location** and, optionally, an **outcome**:
217
+
218
+ | What AdarvMap needs | Possible column names | How to provide it |
219
+ |---|---|---|
220
+ | **Coordinates** | `lat`, `lon` (or `latitude`, `longitude`) | Separate `lat` / `lon` columns **or** one combined `"lat,lon"` column |
221
+ | **Outcome** (optional) | `outcome`, `status`, `case_control`, `case` | A column with values like `case` / `control` |
222
+
223
+ **Example:**
224
+ ```csv
225
+ latitude,longitude,outcome
226
+ 28.6,77.2,case
227
+ 19.0,72.8,control
228
+ 13.0,80.2,case
229
+ ```
230
+
231
+ ---
232
+
233
+ ## What you get
234
+
235
+ A single, self-contained HTML file you can open in any browser or share. Its sidebar lets
236
+ anyone switch between **Dot Density** and **Spot Pins**, show one group or both, recolour
237
+ and resize markers, toggle **place-name labels**, and export to **PNG / PDF**.
238
+
239
+ ---
240
+
241
+ ## ADARV Team
242
+
243
+ AdarvMap is developed by the **ADARV** team: **Muniraj Mallesan** (maintainer),
244
+ **Dr. Sharan Murali** (team lead), Manikandan K, Shanmuga Sundharam, Yogita Chaudhary,
245
+ Barath U, Balaji S, and Deepana R.
246
+
247
+ ## License
248
+
249
+ MIT © ADARV
@@ -0,0 +1,199 @@
1
+ # AdarvMap
2
+
3
+ **Interactive epidemiological spot maps for India — no GIS software, no shapefiles, no setup.**
4
+
5
+ [![PyPI version](https://img.shields.io/pypi/v/adarvmap.svg)](https://pypi.org/project/adarvmap/)
6
+ [![Python versions](https://img.shields.io/pypi/pyversions/adarvmap.svg)](https://pypi.org/project/adarvmap/)
7
+ [![License: MIT](https://img.shields.io/pypi/l/adarvmap.svg)](https://github.com/ADARV-Epi-hub/adarvmap/blob/main/LICENSE)
8
+
9
+ AdarvMap 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 AdarvMap do?
23
+
24
+ AdarvMap 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 AdarvMap 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 AdarvMap
65
+ Click inside the cell, paste the two lines below, and press the ▶ (play) button:
66
+ ```python
67
+ !pip install adarvmap
68
+ import adarvmap; adarvmap.run()
69
+ ```
70
+ The first line installs AdarvMap; 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
+ AdarvMap 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
+ - AdarvMap 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 AdarvMap 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
+ - AdarvMap 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
+ - AdarvMap 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 is your grouping variable?**
99
+ - Choose the column that splits your data into two groups — *case* / *control*,
100
+ *affected* / *not affected*, *male* / *female*, *dead* / *alive*, *positive* /
101
+ *negative*, and so on. The map uses the **actual values from your data** as the group
102
+ names automatically — you don't have to type anything.
103
+ - If you don't want any split, choose the first option: *No grouping — show all rows
104
+ the same*.
105
+
106
+ 5. **Which value is the main group?**
107
+ - AdarvMap lists the values found in the column you chose. Tell it which one is the
108
+ **main group** (it's the highlighted / clustered group; for example, if you coded
109
+ `1 = Case, 0 = Control`, choose `1`).
110
+ - Every other value becomes the other group, shown with its own name.
111
+
112
+ ### Step 4 — Get your map
113
+ - Your map appears right below the cell and is saved as a file called `adarvmap.html`.
114
+ - Download it and open it in any browser, or email it to a colleague — it's a single
115
+ self-contained file (an internet connection is needed to load the background map tiles).
116
+ - Using the map's sidebar you can: switch between **Spot Map** and **Dot Density**, show one
117
+ group or both, change colours and resize the dots, toggle **place-name labels**, and save
118
+ the map as a **PNG** or **PDF**.
119
+
120
+ ---
121
+
122
+ ## Guide for developers
123
+
124
+ ### Install
125
+ ```bash
126
+ pip install adarvmap
127
+ ```
128
+ Python 3.9+.
129
+
130
+ ### Usage
131
+ ```python
132
+ from adarvmap import AdarvMap
133
+
134
+ # `data` accepts a CSV path or a pandas DataFrame
135
+ AdarvMap("my_data.csv").build().save("map.html")
136
+ ```
137
+
138
+ Or from the command line:
139
+ ```bash
140
+ adarvmap my_data.csv -o map.html
141
+ ```
142
+
143
+ ### Common options
144
+ `AdarvMap(data, ...)` — all options below are keyword arguments:
145
+
146
+ | Option | Default | Description |
147
+ |---|---|---|
148
+ | `lat_col`, `long_col`, `outcome_col` | auto | Override column auto-detection |
149
+ | `case_value` | auto | Value in `outcome_col` that means "case" |
150
+ | `case_label`, `control_label` | "Case" / "Control" | Names for the two groups, e.g. "Male" / "Female" |
151
+ | `all_cases` | `False` | Treat every row as a case (no controls) |
152
+ | `case_color`, `control_color`, `cluster_color` | ADARV palette | Marker colours (hex) |
153
+ | `state_shp`, `district_shp` | bundled | Use your own boundary files |
154
+
155
+ **Full API and CLI reference →** [DOCUMENTATION.md](https://github.com/ADARV-Epi-hub/adarvmap/blob/main/DOCUMENTATION.md)
156
+
157
+ > 🔒 **Privacy:** running AdarvMap locally keeps your data on your machine — nothing is
158
+ > uploaded. Google Colab is convenient but runs on Google's cloud, so use it only for
159
+ > de-identified or demo data.
160
+
161
+ ---
162
+
163
+ ## Preparing your data (details)
164
+
165
+ AdarvMap reads a CSV and **auto-detects** the columns — you don't have to rename anything.
166
+ At a minimum it needs **location** and, optionally, an **outcome**:
167
+
168
+ | What AdarvMap needs | Possible column names | How to provide it |
169
+ |---|---|---|
170
+ | **Coordinates** | `lat`, `lon` (or `latitude`, `longitude`) | Separate `lat` / `lon` columns **or** one combined `"lat,lon"` column |
171
+ | **Outcome** (optional) | `outcome`, `status`, `case_control`, `case` | A column with values like `case` / `control` |
172
+
173
+ **Example:**
174
+ ```csv
175
+ latitude,longitude,outcome
176
+ 28.6,77.2,case
177
+ 19.0,72.8,control
178
+ 13.0,80.2,case
179
+ ```
180
+
181
+ ---
182
+
183
+ ## What you get
184
+
185
+ A single, self-contained HTML file you can open in any browser or share. Its sidebar lets
186
+ anyone switch between **Dot Density** and **Spot Pins**, show one group or both, recolour
187
+ and resize markers, toggle **place-name labels**, and export to **PNG / PDF**.
188
+
189
+ ---
190
+
191
+ ## ADARV Team
192
+
193
+ AdarvMap is developed by the **ADARV** team: **Muniraj Mallesan** (maintainer),
194
+ **Dr. Sharan Murali** (team lead), Manikandan K, Shanmuga Sundharam, Yogita Chaudhary,
195
+ Barath U, Balaji S, and Deepana R.
196
+
197
+ ## License
198
+
199
+ MIT © ADARV
@@ -0,0 +1,61 @@
1
+ """adarvmap — Interactive epidemiological spot maps for India."""
2
+
3
+ from .exceptions import ColumnNotFoundError, NoCasePointsError, AdarvMapError
4
+ from .interactive import run_interactive, adarvmap_run
5
+ from .map_builder import AdarvMap
6
+
7
+ # Short, friendly alias so non-coders can simply do: import adarvmap; adarvmap.run()
8
+ run = adarvmap_run
9
+
10
+ __version__ = "0.1.41"
11
+ __all__ = [
12
+ "AdarvMap",
13
+ "run", # friendly alias for adarvmap_run
14
+ "adarvmap_run",
15
+ "run_interactive", # deprecated alias, kept for backward compat
16
+ "AdarvMapError",
17
+ "ColumnNotFoundError",
18
+ "NoCasePointsError",
19
+ ]
20
+
21
+ _BANNER = (
22
+ "\n"
23
+ "Interactive AdarvMap for India - created by ADARV\n"
24
+ "\n"
25
+ "No code required! To build your map, just run:\n"
26
+ "\n"
27
+ "adarvmap.run()\n"
28
+ "\n"
29
+ "You'll be asked to choose your data file, then your map appears.\n"
30
+ )
31
+
32
+
33
+ def _in_interactive_session() -> bool:
34
+ """True for a REPL, Jupyter/Colab notebook, or an interactive terminal."""
35
+ import sys
36
+
37
+ if "ipykernel" in sys.modules or "google.colab" in sys.modules:
38
+ return True
39
+ if hasattr(sys, "ps1"): # plain Python REPL
40
+ return True
41
+ try:
42
+ return bool(sys.stdout.isatty())
43
+ except Exception: # noqa: BLE001 — detached/!closed streams
44
+ return False
45
+
46
+
47
+ def _show_banner() -> None:
48
+ """Show the first-run hint for non-coders.
49
+
50
+ Written to **stderr**, and only in an interactive session, so that
51
+ importing adarvmap never pollutes piped or redirected stdout (which
52
+ would corrupt scripts that emit CSV/JSON). This mirrors R's
53
+ ``packageStartupMessage`` behaviour in the sibling adarvmapr package.
54
+ """
55
+ import sys
56
+
57
+ if _in_interactive_session():
58
+ print(_BANNER, file=sys.stderr)
59
+
60
+
61
+ _show_banner()
@@ -0,0 +1,114 @@
1
+ """Command-line interface for adarvmap."""
2
+
3
+ import argparse
4
+ import sys
5
+
6
+
7
+ _EPILOG = """\
8
+ Examples:
9
+ adarvmap launch the guided wizard (easiest)
10
+ adarvmap data.csv build a map from data.csv
11
+ adarvmap data.csv -o my_map.html choose where to save the map
12
+
13
+ In Python or Google Colab:
14
+ from adarvmap import adarvmap_run
15
+ adarvmap_run()
16
+ """
17
+
18
+
19
+ def _build_parser() -> argparse.ArgumentParser:
20
+ p = argparse.ArgumentParser(
21
+ prog="adarvmap",
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=None,
35
+ help="Output HTML file path (default: a dated file, e.g. adarvmap_200926.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 adarvmap_run
84
+ adarvmap_run(args.output)
85
+ return
86
+
87
+ from .map_builder import AdarvMap
88
+ from .interactive import _default_output
89
+
90
+ output = args.output or _default_output()
91
+ try:
92
+ AdarvMap(
93
+ args.csv,
94
+ state_shp=args.state_shp,
95
+ district_shp=args.district_shp,
96
+ lat_col=args.lat_col,
97
+ long_col=args.lon_col,
98
+ outcome_col=args.outcome_col,
99
+ case_value=args.case_value,
100
+ count_cutoff=args.count_cutoff,
101
+ cluster_color=args.cluster_color,
102
+ case_color=args.case_color,
103
+ control_color=args.control_color,
104
+ case_label=args.case_label,
105
+ control_label=args.control_label,
106
+ ).build().save(output)
107
+ print(f"Map saved to: {output}")
108
+ except Exception as exc:
109
+ print(f"Error: {exc}", file=sys.stderr)
110
+ sys.exit(1)
111
+
112
+
113
+ if __name__ == "__main__":
114
+ main()
File without changes