adarvmaps 0.1.36__py3-none-any.whl
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/__init__.py +33 -0
- adarvmaps/cli.py +112 -0
- adarvmaps/data/__init__.py +0 -0
- adarvmaps/data/district_boundary_lite.fgb +0 -0
- adarvmaps/data/state_boundary_lite.fgb +0 -0
- adarvmaps/exceptions.py +10 -0
- adarvmaps/interactive.py +613 -0
- adarvmaps/layers.py +225 -0
- adarvmaps/loader.py +242 -0
- adarvmaps/map_builder.py +265 -0
- adarvmaps/sidebar.py +432 -0
- adarvmaps/spatial.py +159 -0
- adarvmaps-0.1.36.dist-info/METADATA +247 -0
- adarvmaps-0.1.36.dist-info/RECORD +18 -0
- adarvmaps-0.1.36.dist-info/WHEEL +4 -0
- adarvmaps-0.1.36.dist-info/entry_points.txt +2 -0
- adarvmaps-0.1.36.dist-info/licenses/AUTHORS.md +14 -0
- adarvmaps-0.1.36.dist-info/licenses/LICENSE +21 -0
adarvmaps/__init__.py
ADDED
|
@@ -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
|
+
)
|
adarvmaps/cli.py
ADDED
|
@@ -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
|