vbd-api 0.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.
- vbd_api-0.1.0/.gitignore +105 -0
- vbd_api-0.1.0/PKG-INFO +79 -0
- vbd_api-0.1.0/README.md +61 -0
- vbd_api-0.1.0/pyproject.toml +31 -0
- vbd_api-0.1.0/src/vbd_api/__init__.py +4 -0
- vbd_api-0.1.0/src/vbd_api/client.py +91 -0
vbd_api-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
2
|
+
|
|
3
|
+
# IDE and editors
|
|
4
|
+
.idea/
|
|
5
|
+
.vscode/
|
|
6
|
+
|
|
7
|
+
# Dependencies
|
|
8
|
+
node_modules/
|
|
9
|
+
/node_modules
|
|
10
|
+
/.pnp
|
|
11
|
+
.pnp.js
|
|
12
|
+
.yarn/install-state.gz
|
|
13
|
+
.yarn/*
|
|
14
|
+
!.yarn/patches
|
|
15
|
+
!.yarn/plugins
|
|
16
|
+
!.yarn/releases
|
|
17
|
+
!.yarn/versions
|
|
18
|
+
|
|
19
|
+
# Testing
|
|
20
|
+
/coverage
|
|
21
|
+
|
|
22
|
+
# Next.js
|
|
23
|
+
.next/
|
|
24
|
+
/out/
|
|
25
|
+
next-env.d.ts
|
|
26
|
+
*.tsbuildinfo
|
|
27
|
+
|
|
28
|
+
# Production builds
|
|
29
|
+
/build
|
|
30
|
+
dist/
|
|
31
|
+
dist
|
|
32
|
+
|
|
33
|
+
# Environment files (comprehensive coverage)
|
|
34
|
+
|
|
35
|
+
*token.json*
|
|
36
|
+
*credentials.json*
|
|
37
|
+
|
|
38
|
+
# Logs and debug files
|
|
39
|
+
npm-debug.log*
|
|
40
|
+
yarn-debug.log*
|
|
41
|
+
yarn-error.log*
|
|
42
|
+
.pnpm-debug.log*
|
|
43
|
+
dump.rdb
|
|
44
|
+
|
|
45
|
+
# System files
|
|
46
|
+
.DS_Store
|
|
47
|
+
*.pem
|
|
48
|
+
|
|
49
|
+
# Python
|
|
50
|
+
__pycache__/
|
|
51
|
+
*pyc*
|
|
52
|
+
venv/
|
|
53
|
+
.venv/
|
|
54
|
+
|
|
55
|
+
# Development tools
|
|
56
|
+
chainlit.md
|
|
57
|
+
.chainlit
|
|
58
|
+
.ipynb_checkpoints/
|
|
59
|
+
.ac
|
|
60
|
+
|
|
61
|
+
# Deployment
|
|
62
|
+
.vercel
|
|
63
|
+
|
|
64
|
+
# Data and databases
|
|
65
|
+
agenthub/agents/youtube/db
|
|
66
|
+
|
|
67
|
+
# Archive files and large assets
|
|
68
|
+
**/*.zip
|
|
69
|
+
**/*.tar.gz
|
|
70
|
+
**/*.tar
|
|
71
|
+
**/*.tgz
|
|
72
|
+
*.pack
|
|
73
|
+
*.deb
|
|
74
|
+
*.dylib
|
|
75
|
+
|
|
76
|
+
# Build caches
|
|
77
|
+
.cache/
|
|
78
|
+
|
|
79
|
+
memory/test_credentials.md
|
|
80
|
+
|
|
81
|
+
# Mobile development
|
|
82
|
+
android-sdk/frontend/node_modules/@next/swc-linux-arm64-gnu/next-swc.linux-arm64-gnu.node
|
|
83
|
+
frontend/node_modules/@next/swc-linux-arm64-musl/next-swc.linux-arm64-musl.node
|
|
84
|
+
credentials.json
|
|
85
|
+
*.key
|
|
86
|
+
.credentials
|
|
87
|
+
frontend/node_modules/@next/swc-linux-arm64-gnu/next-swc.linux-arm64-gnu.node
|
|
88
|
+
frontend/.next/cache/webpack/client-production/0.pack
|
|
89
|
+
frontend/.next/cache/webpack/server-production/0.pack
|
|
90
|
+
frontend/.next/cache/webpack/server-production/1.pack
|
|
91
|
+
frontend/.next/cache/webpack/server-production/3.pack
|
|
92
|
+
frontend/.next/cache/webpack/server-production/7.pack
|
|
93
|
+
frontend/.next/cache/webpack/server-production/6.pack
|
|
94
|
+
frontend/.next/cache/webpack/server-production/8.pack
|
|
95
|
+
|
|
96
|
+
# Outreach claim-link exports (contain live claim tokens — never commit)
|
|
97
|
+
outreach_claim_links_*.csv
|
|
98
|
+
.env
|
|
99
|
+
.env.*
|
|
100
|
+
*.env
|
|
101
|
+
|
|
102
|
+
# Safe env templates (no real secrets) - explicitly allowed
|
|
103
|
+
!.env.example
|
|
104
|
+
!frontend/.env.example
|
|
105
|
+
!backend/.env.example
|
vbd_api-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: vbd-api
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Official Python client for the Veteran Benefit Desk API: structured, source linked VA benefits data with permanent VBD IDs and provenance.
|
|
5
|
+
Project-URL: Homepage, https://veteranbenefitdesk.com/developers
|
|
6
|
+
Project-URL: Documentation, https://veteranbenefitdesk.com/developers
|
|
7
|
+
Project-URL: Registry, https://veteranbenefitdesk.com/developers/registry
|
|
8
|
+
Author-email: Veteran Benefit Desk <support@veteranbenefitdesk.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
Keywords: api,benefits,disability,va,vbd,veterans
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Requires-Python: >=3.8
|
|
16
|
+
Requires-Dist: requests>=2.28
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# vbd-api
|
|
20
|
+
|
|
21
|
+
Official Python client for the [Veteran Benefit Desk API](https://veteranbenefitdesk.com/developers): structured, source linked VA benefits data with permanent VBD IDs, provenance in every response, and honest review tiers.
|
|
22
|
+
|
|
23
|
+
You are only charged credits for successful responses. Errors and not found lookups are always free.
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install vbd-api
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Quickstart
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from vbd_api import VBD
|
|
35
|
+
|
|
36
|
+
client = VBD(api_key="vbd_sbx_...") # free key at https://veteranbenefitdesk.com/developers/signup
|
|
37
|
+
|
|
38
|
+
# Diagnostic codes
|
|
39
|
+
ptsd = client.get_diagnostic_code("9411")
|
|
40
|
+
print(ptsd["data"]["title"]) # PTSD
|
|
41
|
+
print(ptsd["vbd"]["id"]) # VBD:DC:9411
|
|
42
|
+
print(ptsd["provenance"]["sources"]) # 38 CFR Part 4 ...
|
|
43
|
+
|
|
44
|
+
# Conditions
|
|
45
|
+
client.search_conditions(q="knee", limit=10)
|
|
46
|
+
client.get_condition("tinnitus")
|
|
47
|
+
|
|
48
|
+
# VA forms
|
|
49
|
+
client.search_forms(q="disability")
|
|
50
|
+
client.get_form("21-526EZ")
|
|
51
|
+
|
|
52
|
+
# State benefits (2 credits)
|
|
53
|
+
client.get_state_benefits("TX", category="property_tax")
|
|
54
|
+
|
|
55
|
+
# Your usage (free)
|
|
56
|
+
client.usage()
|
|
57
|
+
|
|
58
|
+
# Metering info from the last call
|
|
59
|
+
print(client.last_receipt_id, client.credits_remaining)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Errors
|
|
63
|
+
|
|
64
|
+
All API errors raise `vbd_api.VBDError` with `.status` and `.detail`:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from vbd_api import VBD, VBDError
|
|
68
|
+
|
|
69
|
+
try:
|
|
70
|
+
client.get_diagnostic_code("99999")
|
|
71
|
+
except VBDError as e:
|
|
72
|
+
print(e.status, e.detail) # 404 Unknown diagnostic code... (not billed)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Notes
|
|
76
|
+
|
|
77
|
+
- Veteran Benefit Desk is independent and not affiliated with the U.S. Department of Veterans Affairs or any government agency.
|
|
78
|
+
- Data is general educational information from public sources. It is not legal, medical, individualized claims, or representative advice.
|
|
79
|
+
- License: commercial use with attribution ("Data via Veteran Benefit Desk"). Training rights are not granted by default.
|
vbd_api-0.1.0/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# vbd-api
|
|
2
|
+
|
|
3
|
+
Official Python client for the [Veteran Benefit Desk API](https://veteranbenefitdesk.com/developers): structured, source linked VA benefits data with permanent VBD IDs, provenance in every response, and honest review tiers.
|
|
4
|
+
|
|
5
|
+
You are only charged credits for successful responses. Errors and not found lookups are always free.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install vbd-api
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quickstart
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from vbd_api import VBD
|
|
17
|
+
|
|
18
|
+
client = VBD(api_key="vbd_sbx_...") # free key at https://veteranbenefitdesk.com/developers/signup
|
|
19
|
+
|
|
20
|
+
# Diagnostic codes
|
|
21
|
+
ptsd = client.get_diagnostic_code("9411")
|
|
22
|
+
print(ptsd["data"]["title"]) # PTSD
|
|
23
|
+
print(ptsd["vbd"]["id"]) # VBD:DC:9411
|
|
24
|
+
print(ptsd["provenance"]["sources"]) # 38 CFR Part 4 ...
|
|
25
|
+
|
|
26
|
+
# Conditions
|
|
27
|
+
client.search_conditions(q="knee", limit=10)
|
|
28
|
+
client.get_condition("tinnitus")
|
|
29
|
+
|
|
30
|
+
# VA forms
|
|
31
|
+
client.search_forms(q="disability")
|
|
32
|
+
client.get_form("21-526EZ")
|
|
33
|
+
|
|
34
|
+
# State benefits (2 credits)
|
|
35
|
+
client.get_state_benefits("TX", category="property_tax")
|
|
36
|
+
|
|
37
|
+
# Your usage (free)
|
|
38
|
+
client.usage()
|
|
39
|
+
|
|
40
|
+
# Metering info from the last call
|
|
41
|
+
print(client.last_receipt_id, client.credits_remaining)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Errors
|
|
45
|
+
|
|
46
|
+
All API errors raise `vbd_api.VBDError` with `.status` and `.detail`:
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from vbd_api import VBD, VBDError
|
|
50
|
+
|
|
51
|
+
try:
|
|
52
|
+
client.get_diagnostic_code("99999")
|
|
53
|
+
except VBDError as e:
|
|
54
|
+
print(e.status, e.detail) # 404 Unknown diagnostic code... (not billed)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Notes
|
|
58
|
+
|
|
59
|
+
- Veteran Benefit Desk is independent and not affiliated with the U.S. Department of Veterans Affairs or any government agency.
|
|
60
|
+
- Data is general educational information from public sources. It is not legal, medical, individualized claims, or representative advice.
|
|
61
|
+
- License: commercial use with attribution ("Data via Veteran Benefit Desk"). Training rights are not granted by default.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "vbd-api"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Official Python client for the Veteran Benefit Desk API: structured, source linked VA benefits data with permanent VBD IDs and provenance."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.8"
|
|
12
|
+
authors = [{ name = "Veteran Benefit Desk", email = "support@veteranbenefitdesk.com" }]
|
|
13
|
+
keywords = ["va", "veterans", "benefits", "disability", "api", "vbd"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
]
|
|
20
|
+
dependencies = ["requests>=2.28"]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://veteranbenefitdesk.com/developers"
|
|
24
|
+
Documentation = "https://veteranbenefitdesk.com/developers"
|
|
25
|
+
Registry = "https://veteranbenefitdesk.com/developers/registry"
|
|
26
|
+
|
|
27
|
+
[tool.hatch.build.targets.wheel]
|
|
28
|
+
packages = ["src/vbd_api"]
|
|
29
|
+
|
|
30
|
+
[tool.hatch.build.targets.sdist]
|
|
31
|
+
include = ["src/vbd_api", "README.md"]
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
DEFAULT_BASE_URL = "https://veteranbenefitdesk.com"
|
|
4
|
+
_VERSION = "0.1.0"
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class VBDError(Exception):
|
|
8
|
+
"""Raised for any non 2xx API response. Carries .status and .detail."""
|
|
9
|
+
|
|
10
|
+
def __init__(self, status, detail):
|
|
11
|
+
self.status = status
|
|
12
|
+
self.detail = detail
|
|
13
|
+
super().__init__(f"{status}: {detail}")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class VBD:
|
|
17
|
+
"""Client for the Veteran Benefit Desk API.
|
|
18
|
+
|
|
19
|
+
Only successful responses consume credits. The last call's metering info is
|
|
20
|
+
available as client.last_receipt_id and client.credits_remaining.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
def __init__(self, api_key, base_url=DEFAULT_BASE_URL, timeout=30):
|
|
24
|
+
if not api_key or not api_key.startswith("vbd_"):
|
|
25
|
+
raise ValueError("Provide a VBD API key (vbd_sbx_... or vbd_live_...). Free keys: /developers/signup")
|
|
26
|
+
self._session = requests.Session()
|
|
27
|
+
self._session.headers.update({
|
|
28
|
+
"Authorization": f"Bearer {api_key}",
|
|
29
|
+
"User-Agent": f"vbd-python/{_VERSION}",
|
|
30
|
+
})
|
|
31
|
+
self._base = base_url.rstrip("/")
|
|
32
|
+
self._timeout = timeout
|
|
33
|
+
self.last_receipt_id = None
|
|
34
|
+
self.credits_remaining = None
|
|
35
|
+
|
|
36
|
+
def _get(self, path, params=None):
|
|
37
|
+
r = self._session.get(f"{self._base}/api/v1{path}", params=params or {}, timeout=self._timeout)
|
|
38
|
+
self.last_receipt_id = r.headers.get("X-Receipt-Id")
|
|
39
|
+
remaining = r.headers.get("X-Credits-Remaining")
|
|
40
|
+
self.credits_remaining = int(remaining) if remaining is not None else self.credits_remaining
|
|
41
|
+
if r.status_code >= 400:
|
|
42
|
+
try:
|
|
43
|
+
detail = r.json().get("detail", r.text[:200])
|
|
44
|
+
except ValueError:
|
|
45
|
+
detail = r.text[:200]
|
|
46
|
+
raise VBDError(r.status_code, detail)
|
|
47
|
+
return r.json()
|
|
48
|
+
|
|
49
|
+
# Conditions
|
|
50
|
+
def search_conditions(self, q="", body_system=None, limit=25, offset=0):
|
|
51
|
+
params = {"q": q, "limit": limit, "offset": offset}
|
|
52
|
+
if body_system:
|
|
53
|
+
params["body_system"] = body_system
|
|
54
|
+
return self._get("/conditions", params)
|
|
55
|
+
|
|
56
|
+
def get_condition(self, slug):
|
|
57
|
+
return self._get(f"/conditions/{slug}")
|
|
58
|
+
|
|
59
|
+
# Diagnostic codes
|
|
60
|
+
def search_diagnostic_codes(self, q="", limit=25, offset=0):
|
|
61
|
+
return self._get("/diagnostic-codes", {"q": q, "limit": limit, "offset": offset})
|
|
62
|
+
|
|
63
|
+
def get_diagnostic_code(self, code):
|
|
64
|
+
return self._get(f"/diagnostic-codes/{code}")
|
|
65
|
+
|
|
66
|
+
# VA forms
|
|
67
|
+
def search_forms(self, q="", limit=25, offset=0):
|
|
68
|
+
return self._get("/forms", {"q": q, "limit": limit, "offset": offset})
|
|
69
|
+
|
|
70
|
+
def get_form(self, form_name):
|
|
71
|
+
return self._get(f"/forms/{form_name}")
|
|
72
|
+
|
|
73
|
+
# State benefits
|
|
74
|
+
def list_states(self):
|
|
75
|
+
return self._get("/state-benefits")
|
|
76
|
+
|
|
77
|
+
def get_state_benefits(self, state, category=None):
|
|
78
|
+
params = {"category": category} if category else None
|
|
79
|
+
return self._get(f"/state-benefits/{state}", params)
|
|
80
|
+
|
|
81
|
+
# Account
|
|
82
|
+
def usage(self):
|
|
83
|
+
return self._get("/usage")
|
|
84
|
+
|
|
85
|
+
# Fuzzy resolution (2 credits)
|
|
86
|
+
def resolve(self, q, type=None):
|
|
87
|
+
"""Resolve messy text (misspellings ok) to canonical VBD IDs with confidence scores."""
|
|
88
|
+
params = {"q": q}
|
|
89
|
+
if type:
|
|
90
|
+
params["type"] = type
|
|
91
|
+
return self._get("/enrich", params)
|