bxp-sdk 2.1.0__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.
bxp_sdk-2.1.0/LICENSE ADDED
@@ -0,0 +1,129 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work.
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship.
43
+
44
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
45
+ in the Work by the copyright owner or by an individual or Legal Entity
46
+ authorized to submit on behalf of the copyright owner. For the purposes
47
+ of this definition, "submit" means any form of electronic, verbal, or
48
+ written communication sent to the Licensor or its representatives.
49
+
50
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
51
+ whom a Contribution has been received by the Licensor and included
52
+ within the Work.
53
+
54
+ 2. Grant of Copyright License. Subject to the terms and conditions of
55
+ this License, each Contributor hereby grants to You a perpetual,
56
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
57
+ copyright license to reproduce, prepare Derivative Works of,
58
+ publicly display, publicly perform, sublicense, and distribute the
59
+ Work and such Derivative Works in Source or Object form.
60
+
61
+ 3. Grant of Patent License. Subject to the terms and conditions of
62
+ this License, each Contributor hereby grants to You a perpetual,
63
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
64
+ patent license to make, use, sell, offer for sale, import, and
65
+ otherwise transfer the Work.
66
+
67
+ 4. Redistribution. You may reproduce and distribute copies of the
68
+ Work or Derivative Works thereof in any medium, with or without
69
+ modifications, and in Source or Object form, provided that You
70
+ meet the following conditions:
71
+
72
+ (a) You must give any other recipients of the Work or Derivative
73
+ Works a copy of this License; and
74
+
75
+ (b) You must cause any modified files to carry prominent notices
76
+ stating that You changed the files; and
77
+
78
+ (c) You must retain, in the Source form of any Derivative Works
79
+ that You distribute, all copyright, patent, trademark, and
80
+ attribution notices from the Source form of the Work; and
81
+
82
+ (d) If the Work includes a "NOTICE" text file, You must include a
83
+ readable copy of the attribution notices contained within such
84
+ NOTICE file.
85
+
86
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
87
+ any Contribution submitted for inclusion in the Work by You to the
88
+ Licensor shall be under the terms and conditions of this License,
89
+ without any additional terms or conditions.
90
+
91
+ 6. Trademarks. This License does not grant permission to use the trade
92
+ names, trademarks, service marks, or product names of the Licensor.
93
+
94
+ 7. Disclaimer of Warranty. Unless required by applicable law or
95
+ agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
96
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
97
+ implied. You are solely responsible for determining the appropriateness
98
+ of using or reproducing the Work and assume any risks associated with
99
+ Your exercise of permissions under this License.
100
+
101
+ 8. Limitation of Liability. In no event and under no legal theory,
102
+ whether in tort (including negligence), contract, or otherwise,
103
+ shall any Contributor be liable to You for damages, including any
104
+ direct, indirect, special, incidental, or exemplary damages of any
105
+ character arising as a result of this License or out of the use or
106
+ inability to use the Work.
107
+
108
+ 9. Accepting Warranty or Additional Liability. While redistributing
109
+ the Work or Derivative Works thereof, You may offer, and charge a
110
+ fee for, acceptance of support, warranty, indemnity, or other
111
+ liability obligations and terms consistent with this License.
112
+ However, in accepting such obligations, You may offer such terms
113
+ only on Your own behalf and on Your sole responsibility.
114
+
115
+ END OF TERMS AND CONDITIONS
116
+
117
+ Copyright 2026 Elvarin
118
+
119
+ Licensed under the Apache License, Version 2.0 (the "License");
120
+ you may not use this file except in compliance with the License.
121
+ You may obtain a copy of the License at
122
+
123
+ http://www.apache.org/licenses/LICENSE-2.0
124
+
125
+ Unless required by applicable law or agreed to in writing, software
126
+ distributed under the License is distributed on an "AS IS" BASIS,
127
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
128
+ implied. See the License for the specific language governing
129
+ permissions and limitations under the License.
bxp_sdk-2.1.0/PKG-INFO ADDED
@@ -0,0 +1,414 @@
1
+ Metadata-Version: 2.4
2
+ Name: bxp-sdk
3
+ Version: 2.1.0
4
+ Summary: BXP (Breathe Exposure Protocol) Python SDK โ€” Universal atmospheric exposure data interoperability
5
+ Author-email: BXP Protocol Contributors <bxpprotocol@proton.me>
6
+ Maintainer-email: Elvarin <bxpprotocol@proton.me>
7
+ License-Expression: Apache-2.0
8
+ Project-URL: Homepage, https://bxpprotocol.github.io/
9
+ Project-URL: Repository, https://github.com/bxpprotocol/bxp-spec
10
+ Project-URL: Documentation, https://bxpprotocol.github.io/
11
+ Project-URL: Changelog, https://github.com/bxpprotocol/bxp-spec/blob/main/CHANGELOG.md
12
+ Project-URL: Issues, https://github.com/bxpprotocol/bxp-spec/issues
13
+ Project-URL: Discussions, https://github.com/bxpprotocol/bxp-spec/discussions
14
+ Project-URL: Spec DOI, https://doi.org/10.5281/zenodo.18906812
15
+ Project-URL: Impl DOI, https://doi.org/10.5281/zenodo.18907003
16
+ Keywords: air-quality,atmospheric-exposure,environmental-data,data-interoperability,open-standard,health-risk-index,federated-network,protocol,sensor-data,pm25,environmental-monitoring,public-health
17
+ Classifier: Development Status :: 4 - Beta
18
+ Classifier: Intended Audience :: Developers
19
+ Classifier: Intended Audience :: Science/Research
20
+ Classifier: Intended Audience :: Healthcare Industry
21
+ Classifier: Operating System :: OS Independent
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
28
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
29
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
30
+ Classifier: Topic :: System :: Distributed Computing
31
+ Requires-Python: >=3.10
32
+ Description-Content-Type: text/markdown
33
+ License-File: LICENSE
34
+ Requires-Dist: requests>=2.31.0
35
+ Requires-Dist: pydantic>=2.0.0
36
+ Provides-Extra: async
37
+ Requires-Dist: httpx>=0.25.0; extra == "async"
38
+ Provides-Extra: dev
39
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
40
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
41
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
42
+ Requires-Dist: pip-audit>=2.6.0; extra == "dev"
43
+ Requires-Dist: build>=1.0.0; extra == "dev"
44
+ Requires-Dist: twine>=4.0.0; extra == "dev"
45
+ Provides-Extra: docs
46
+ Requires-Dist: mkdocs>=1.5.0; extra == "docs"
47
+ Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
48
+ Requires-Dist: mkdocstrings[python]>=0.24.0; extra == "docs"
49
+ Dynamic: license-file
50
+
51
+ <p align="center">
52
+ <img src="assets/banner.svg" alt="BXP โ€” Breathe Exposure Protocol" width="100%">
53
+ </p>
54
+
55
+ <p align="center">
56
+ <a href="LICENSE"><img alt="License" src="https://img.shields.io/badge/license-Apache%202.0-blue.svg"></a>
57
+ <a href="SPEC.md"><img alt="BXP Version" src="https://img.shields.io/badge/BXP-v2.0-2ea44f.svg"></a>
58
+ <a href="https://doi.org/10.5281/zenodo.18906812"><img alt="Spec DOI" src="https://zenodo.org/badge/DOI/10.5281/zenodo.18906812.svg"></a>
59
+ <a href="https://github.com/bxpprotocol/bxp-spec/actions"><img alt="CI" src="https://github.com/bxpprotocol/bxp-spec/actions/workflows/ci.yml/badge.svg"></a>
60
+ <a href="https://github.com/bxpprotocol/bxp-spec"><img alt="GitHub" src="https://img.shields.io/badge/GitHub-bxpprotocol-black.svg"></a>
61
+ <a href="https://pypi.org/project/bxp-sdk/"><img alt="PyPI" src="https://img.shields.io/badge/PyPI-bxp--sdk-3775A9.svg?logo=pypi&logoColor=white"></a>
62
+ <a href="https://www.npmjs.com/package/@bxp/sdk"><img alt="npm" src="https://img.shields.io/badge/npm-@bxp%2Fsdk-CB3837.svg?logo=npm&logoColor=white"></a>
63
+ <a href="https://discord.gg/bxp"><img alt="Discord" src="https://img.shields.io/badge/Discord-BXP%20Community-5865F2.svg?logo=discord&logoColor=white"></a>
64
+ <a href="GOVERNANCE.md"><img alt="Governance" src="https://img.shields.io/badge/Governance-Transparent-8A2BE2.svg"></a>
65
+ </p>
66
+
67
+ <p align="center">
68
+ <b>BXP is to air quality data what HTTP is to the web</b> โ€” a protocol, not a platform.<br>
69
+ A common data language that any sensor, any agency, and any application can speak.<br>
70
+ Owned by nobody. Usable by everyone. Free forever.
71
+ </p>
72
+
73
+ <p align="center">
74
+ <a href="https://bxpprotocol.github.io/bxp-spec/validator.html"><img alt="Try Validator" src="https://img.shields.io/badge/๐Ÿ”_Live_Validator-Try_It_Now-FF6B35.svg?style=for-the-badge"></a>
75
+ <a href="#quick-start"><img alt="Quick Start" src="https://img.shields.io/badge/๐Ÿš€_Quick_Start-30_Seconds-00D9AA.svg?style=for-the-badge"></a>
76
+ <a href="https://github.com/bxpprotocol/bxp-spec/discussions"><img alt="Discussions" src="https://img.shields.io/badge/๐Ÿ’ฌ_Discussions-Join_Us-6F42C1.svg?style=for-the-badge"></a>
77
+ </p>
78
+
79
+ <p align="center">
80
+ <a href="#the-problem">The Problem</a> ยท
81
+ <a href="#the-solution">The Solution</a> ยท
82
+ <a href="#quick-start">Quick Start</a> ยท
83
+ <a href="#architecture">Architecture</a> ยท
84
+ <a href="#bxp_hri--health-risk-index">Health Risk Index</a> ยท
85
+ <a href="#current-status">Status</a> ยท
86
+ <a href="#roadmap">Roadmap</a> ยท
87
+ <a href="#documentation">Docs</a> ยท
88
+ <a href="#contributing">Contributing</a>
89
+ </p>
90
+
91
+ ---
92
+
93
+ ## ๐ŸŽฏ The Problem
94
+
95
+ Air pollution causes **7 million premature deaths annually** โ€” more than HIV, malaria, and tuberculosis combined (WHO, 2021).
96
+
97
+ The sensors to measure it exist. The data infrastructure does not.
98
+
99
+ Every sensor manufacturer, government agency, and research network uses incompatible data formats. A sensor in Accra cannot feed a dashboard in Nairobi. A citizen reading in Delhi cannot contribute to a government pollution map. A researcher in London cannot query a database in Lagos using a single standard format.
100
+
101
+ **The barrier is not hardware. It is data fragmentation.**
102
+
103
+ ## โœจ The Solution
104
+
105
+ | | |
106
+ |---|---|
107
+ | ๐Ÿ“„ **`.bxp.json`** | A universal file format for atmospheric exposure data โ€” one schema for any source, any location, any pollutant |
108
+ | ๐Ÿฉบ **BXP-HRI (experimental)** | A composite Health Risk Index (0โ€“100) derived from all available agents, weighted by WHO disease-burden data โ€” **not clinically validated** |
109
+ | ๐ŸŒ **REST API** | A standard set of endpoints any BXP node must implement, so any client can query any node |
110
+ | ๐Ÿงช **30+ atmospheric agents** | PM1, PM2.5, PM10, NOโ‚‚, Oโ‚ƒ, CO, SOโ‚‚, benzene, formaldehyde, mold spores, heavy metals, and more โ€” see [Appendix A](SPEC.md#appendix-a--complete-agent-reference) |
111
+ | ๐Ÿ”’ **Privacy framework** | SHA-256 hashed identifiers, geohash precision floors, k-anonymisation, cryptographic deletion |
112
+ | ๐Ÿ•ธ๏ธ **Federated architecture** | No central owner โ€” any organisation can run a BXP node on their own infrastructure |
113
+
114
+ ## ๐Ÿ“ฆ Repository Structure
115
+
116
+ ```
117
+ bxp-protocol/
118
+ โ”œโ”€โ”€ SPEC.md Protocol specification v2.0
119
+ โ”œโ”€โ”€ CHANGELOG.md Development history
120
+ โ”œโ”€โ”€ CONTRIBUTING.md Contribution guide
121
+ โ”œโ”€โ”€ GOVERNANCE.md Project governance & transparency
122
+ โ”œโ”€โ”€ reference-server/
123
+ โ”‚ โ”œโ”€โ”€ server.py FastAPI reference node v2.1
124
+ โ”‚ โ”œโ”€โ”€ database.py SQLite persistence layer
125
+ โ”‚ โ”œโ”€โ”€ requirements.txt Python dependencies
126
+ โ”‚ โ””โ”€โ”€ tests/ Pytest suite
127
+ โ”œโ”€โ”€ sdk/
128
+ โ”‚ โ”œโ”€โ”€ python/bxp_sdk.py Python SDK v2.1
129
+ โ”‚ โ”œโ”€โ”€ python/bxp_binary.py Native binary .bxp codec
130
+ โ”‚ โ””โ”€โ”€ typescript/
131
+ โ”‚ โ”œโ”€โ”€ bxp-sdk.ts TypeScript SDK
132
+ โ”‚ โ””โ”€โ”€ bxp-binary.ts Native binary .bxp codec (TS)
133
+ โ”œโ”€โ”€ conformance/ Cross-implementation golden test vectors
134
+ โ”‚ โ”œโ”€โ”€ vectors/ 17 golden .bxp files (valid + malformed)
135
+ โ”‚ โ”œโ”€โ”€ generate_vectors.py
136
+ โ”‚ โ”œโ”€โ”€ verify_python.py
137
+ โ”‚ โ””โ”€โ”€ verify_typescript.mjs
138
+ โ”œโ”€โ”€ cli/bxp_cli.py Command-line tool v2.1
139
+ โ”œโ”€โ”€ integrations/
140
+ โ”‚ โ”œโ”€โ”€ mqtt_bridge.py MQTT โ†’ BXP bridge
141
+ โ”‚ โ””โ”€โ”€ openaq_import.py OpenAQ v3 API โ†’ BXP importer
142
+ โ”œโ”€โ”€ datasets/sample_readings.bxp.json 10 global city readings
143
+ โ”œโ”€โ”€ docs/
144
+ โ”‚ โ”œโ”€โ”€ api_documentation.md REST API reference
145
+ โ”‚ โ”œโ”€โ”€ developer_guide.md Developer guide
146
+ โ”‚ โ””โ”€โ”€ protocol_overview.md Protocol overview
147
+ โ”œโ”€โ”€ postman/BXP_Protocol.postman_collection.json
148
+ โ”œโ”€โ”€ assets/ README/site imagery
149
+ โ”œโ”€โ”€ Dockerfile
150
+ โ””โ”€โ”€ docker-compose.yml
151
+ ```
152
+
153
+ ## ๐Ÿš€ Quick Start
154
+
155
+ <details open>
156
+ <summary><b>๐Ÿณ Docker (Recommended)</b></summary>
157
+
158
+ ```bash
159
+ # Clone and start in one command
160
+ git clone https://github.com/bxpprotocol/bxp-spec.git
161
+ cd bxp-spec
162
+ docker compose up
163
+ ```
164
+
165
+ **Open:** `http://localhost:5000` โ€” Dashboard | `http://localhost:5000/docs` โ€” Interactive API | `http://localhost:5000/health` โ€” Health check
166
+
167
+ </details>
168
+
169
+ <details>
170
+ <summary><b>๐Ÿ Python (pip)</b></summary>
171
+
172
+ ```bash
173
+ # Install SDK
174
+ pip install bxp-sdk
175
+
176
+ # Or run from source
177
+ pip install -r reference-server/requirements.txt
178
+ cd reference-server && python server.py
179
+ ```
180
+
181
+ </details>
182
+
183
+ <details>
184
+ <summary><b>๐Ÿ“ฆ Node.js (npm)</b></summary>
185
+
186
+ ```bash
187
+ # Install SDK
188
+ npm install @bxp/sdk # TypeScript SDK ships in this repository; npm publish pending
189
+ ```
190
+
191
+ </details>
192
+
193
+ ### Using the Python SDK
194
+
195
+ ```python
196
+ from bxp_sdk import write_bxp, read_bxp, calculate_risk, BXPClient
197
+
198
+ # Calculate health risk from sensor values
199
+ risk = calculate_risk(pm25=67.0, no2=31.0, duration="24h", population="sensitive")
200
+ print(risk["score"]) # 89.6
201
+ print(risk["level"]) # VERY_HIGH
202
+
203
+ # Write a .bxp.json file
204
+ record = write_bxp("accra.bxp.json", {
205
+ "latitude": 5.6037, "longitude": -0.1870,
206
+ "pm25": 47.2, "no2": 18.3, "temp": 29.0,
207
+ "source": "native" # NEW in v2.0: source classification
208
+ })
209
+ print(record["bxpHri"]) # 61.2
210
+ print(record["bxpHriLevel"]) # HIGH
211
+
212
+ # Read and verify
213
+ data = read_bxp("accra.bxp.json")
214
+ print(data["_integrityOk"]) # True
215
+
216
+ # Submit to a BXP node
217
+ client = BXPClient("http://localhost:5000")
218
+ result = client.submit(latitude=5.6037, longitude=-0.1870, pm25=47.2)
219
+ ```
220
+
221
+ ### Using the CLI
222
+
223
+ ```bash
224
+ # Generate a .bxp.json file
225
+ python cli/bxp_cli.py generate --pm25 47.2 --no2 18.3 --lat 5.6037 --lon -0.1870
226
+
227
+ # Validate against BXP v2.0 spec
228
+ python cli/bxp_cli.py validate reading.bxp.json
229
+
230
+ # Calculate health risk
231
+ python cli/bxp_cli.py hri --pm25 67.0 --no2 31.0 --duration 8h --population sensitive
232
+
233
+ # Submit to a node
234
+ python cli/bxp_cli.py submit --server http://localhost:5000 --file reading.bxp.json
235
+
236
+ # Batch submit a directory of readings
237
+ python cli/bxp_cli.py batch-submit --dir ./sensor_data/
238
+
239
+ # Export as CSV
240
+ python cli/bxp_cli.py export reading.bxp.json --format csv
241
+
242
+ # Generate HTML map
243
+ python cli/bxp_cli.py map ./readings/ --output map.html
244
+ ```
245
+
246
+ ## ๐ŸŽฎ Live Demo
247
+
248
+ | Tool | Link | Description |
249
+ |------|------|-------------|
250
+ | **JSON Validator** | [bxpprotocol.github.io/bxp-spec/validator.html](https://bxpprotocol.github.io/bxp-spec/validator.html) | Paste JSON โ†’ instant validation + HRI calculation |
251
+ | **API Docs (Swagger)** | `http://localhost:5000/docs` | Interactive OpenAPI 3.0 docs (run server first) |
252
+ | **Dashboard** | `http://localhost:5000/` | Live city data, maps, health advisories |
253
+ | **Postman Collection** | `postman/BXP_Protocol.postman_collection.json` | Ready-to-use API requests |
254
+
255
+ > ๐Ÿ’ก **No install needed** โ€” try the validator in your browser right now.
256
+
257
+ ## API Examples
258
+
259
+ ```bash
260
+ # Submit a reading
261
+ curl -X POST http://localhost:5000/bxp/v2/readings \
262
+ -H "Content-Type: application/json" \
263
+ -d '{"readings":[{"latitude":5.6037,"longitude":-0.1870,
264
+ "agents":[{"agentId":"PM2_5","value":47.2,"unit":"ug/m3"}]}]}'
265
+
266
+ # Get latest for a location
267
+ curl http://localhost:5000/bxp/v2/locations/s1v0g/latest
268
+
269
+ # Get live city data
270
+ curl http://localhost:5000/bxp/v2/city/accra
271
+
272
+ # Server health
273
+ curl http://localhost:5000/bxp/v2/health
274
+ ```
275
+
276
+ ## Architecture
277
+
278
+ BXP uses a five-stage data pipeline:
279
+
280
+ ```mermaid
281
+ flowchart LR
282
+ A[๐Ÿ“ LOCATE] --> B[๐Ÿ”Ž DETECT] --> C[๐Ÿง  INTERPRET] --> D[๐Ÿ›ก๏ธ PROTECT] --> E[๐Ÿ“Š REPORT]
283
+ ```
284
+
285
+ | Stage | What Happens |
286
+ |-------|-------------|
287
+ | LOCATE | Geographic context attached (geohash, coordinates) |
288
+ | DETECT | Source classified (Tier 1 phone โ†’ Tier 3 reference instrument) |
289
+ | INTERPRET | QC applied, units normalised, quality flag assigned |
290
+ | PROTECT | BXP-HRI (experimental) calculated, risk level and advice generated |
291
+ | REPORT | Stored, queryable, privacy-safe |
292
+
293
+ ```mermaid
294
+ flowchart TB
295
+ subgraph Sources
296
+ S1[Phone sensor]
297
+ S2[Fixed IoT sensor]
298
+ S3[Reference instrument]
299
+ S4[Community report]
300
+ end
301
+ Sources --> N1[(BXP Node A)]
302
+ Sources --> N2[(BXP Node B)]
303
+ N1 <-->|federated sync โ€“ planned| N2
304
+ N1 --> C1[Dashboard / App]
305
+ N2 --> C2[Research query]
306
+ ```
307
+
308
+ No node owns the network โ€” any organisation runs its own, and clients can query across nodes using the same schema and API.
309
+
310
+ ## BXP-HRI (experimental) โ€” Health Risk Index
311
+
312
+ A composite 0โ€“100 score incorporating all available agents simultaneously, weighted by WHO disability-adjusted life year burden data. **Not clinically or epidemiologically validated โ€” do not use for medical decisions.**
313
+
314
+ | Score | Level | Guidance |
315
+ |-------|-------|----------|
316
+ | 0โ€“20 | ๐ŸŸข CLEAN | No restrictions |
317
+ | 21โ€“40 | ๐ŸŸก MODERATE | Sensitive groups: limit exertion |
318
+ | 41โ€“60 | ๐ŸŸ  ELEVATED | Reduce outdoor exertion |
319
+ | 61โ€“75 | ๐Ÿ”ด HIGH | N95 outdoors, close windows |
320
+ | 76โ€“90 | ๐ŸŸฃ VERY HIGH | Avoid outdoor activity |
321
+ | 91โ€“100 | โšซ HAZARDOUS | Health emergency |
322
+
323
+ ## Current Status
324
+
325
+ | Component | Status |
326
+ |-----------|--------|
327
+ | BXP v2.0 specification | โœ… Complete, with an explicit conformance model (ยง3.7, ยง15) |
328
+ | Reference server v2.1 | โœ… Core reading/query endpoints implemented, including `/nearby` and `/sync` |
329
+ | Python SDK v2.1 | โœ… Complete, including native binary format |
330
+ | TypeScript SDK | โœ… Complete, including native binary format (new) |
331
+ | CLI tool v2.1 | โœ… Complete |
332
+ | MQTT bridge | โœ… Complete |
333
+ | OpenAQ importer | โœ… Complete โ€” converts OpenAQ v3 data into valid BXP records |
334
+ | Sample dataset | โœ… Complete |
335
+ | Binary `.bxp` format | โœ… Implemented in Python and TypeScript; verified byte-for-byte interoperable via `conformance/` |
336
+ | Conformance test suite | โœ… 17 golden vectors, Python + TypeScript both passing |
337
+ | Embedded (C/Arduino/ESP32) | ๐Ÿ—“๏ธ Planned, not yet implemented |
338
+ | Federated node sync (`/sync`) | โœ… Implemented (ยง7 Stage 7) โ€” cursor-based pull replication, deletions propagate as tombstones; trust/reputation/dedup between nodes still unspecified |
339
+ | Nearby-observation query (`/nearby`) | โœ… Implemented (ยง7 Stage 6, ยง8.2.1) โ€” relevance-ranked by distance, freshness, quality |
340
+
341
+ ## Roadmap
342
+
343
+ **Near-term**
344
+ - Embedded C reference codec + ESP32/Arduino example, tested against the same conformance vectors as Python/TypeScript
345
+ - PurpleAir (or similar low-cost-network API) importer, following the same trust-preserving pattern as `openaq_import.py`
346
+
347
+ **v2.1 (planned)**
348
+ - Python SDK pip package publication
349
+ - JavaScript/TypeScript npm package
350
+ - Arduino SDK
351
+ - ESP32 SDK
352
+ - BXP-STREAM real-time extension
353
+
354
+ **v3.0 (planned, 2027)**
355
+ - Waterborne contamination extension
356
+ - Soil contamination extension
357
+ - IoT mesh networking protocol
358
+ - BXP-HEALTH (HL7 FHIR R4 full mapping)
359
+
360
+ ## Limitations
361
+
362
+ BXP is an independent research project at prototype stage:
363
+ - Federation (`/sync`) is pull-only replication; node trust/reputation, dedup
364
+ policy for readings arriving via multiple paths, and conflict resolution
365
+ are explicitly out of scope for now (SPEC.md ยง7 Stage 7) โ€” a caller
366
+ replicating from several peers must handle its own dedup (e.g. by
367
+ `readingId`)
368
+ - `/sync`'s "Node Token" auth (SPEC.md ยง8.2) is a shared-secret placeholder
369
+ (`BXP_NODE_SYNC_TOKEN` env var) โ€” real node identity/trust is deferred to
370
+ a future RFC, same as encryption in the binary `.bxp` format
371
+ - `/nearby`'s relevance ranking (distance + freshness + quality) is an
372
+ implementation detail, not a frozen formula โ€” SPEC.md ยง7 Stage 6
373
+ intentionally leaves this open so heuristics can improve without
374
+ breaking the API shape
375
+ - No embedded (C/Arduino/ESP32) implementation exists yet
376
+ - No third-party has independently implemented the protocol
377
+ - BXP_HRI has not been clinically or epidemiologically validated
378
+ - The reference server is a prototype โ€” not load-tested or security-audited in production
379
+ - The OpenAQ importer's live HTTP path has not been exercised against the real
380
+ api.openaq.org (built and tested against a realistic offline fixture only,
381
+ due to this development environment having no outbound network access) โ€”
382
+ confirm against the live API before relying on it in production
383
+
384
+ ## Documentation
385
+
386
+ | Document | Location |
387
+ |----------|----------|
388
+ | Protocol specification | [`SPEC.md`](SPEC.md) |
389
+ | API reference | [`docs/api_documentation.md`](docs/api_documentation.md) |
390
+ | Developer guide | [`docs/developer_guide.md`](docs/developer_guide.md) |
391
+ | Protocol overview | [`docs/protocol_overview.md`](docs/protocol_overview.md) |
392
+ | Changelog | [`CHANGELOG.md`](CHANGELOG.md) |
393
+
394
+ ## Contributing
395
+
396
+ BXP is open source under Apache 2.0. Contributions welcome.
397
+
398
+ See [`CONTRIBUTING.md`](CONTRIBUTING.md) for the RFC process. All specification changes require a 30-day public comment period via GitHub Issues.
399
+
400
+ GitHub: https://github.com/bxpprotocol/bxp-spec
401
+
402
+ ## License
403
+
404
+ Apache 2.0 โ€” Free to use, implement, modify, and distribute. No royalties. No restrictions. No gatekeepers.
405
+
406
+ ## Citation
407
+
408
+ **Specification DOI:** https://doi.org/10.5281/zenodo.18906812
409
+ **Implementation DOI:** https://doi.org/10.5281/zenodo.18907003
410
+ **ORCID:** https://orcid.org/0009-0001-4856-4986
411
+
412
+ ---
413
+
414
+ <p align="center"><i>The air is public. The data should be too.</i></p>