ResDAC Knowledge Base (resdac-knowledge-base aka rkb)
A Python library and command-line toolkit for crawling, archiving, parsing, and searching public CMS (Centers for Medicare & Medicaid Services) and ResDAC (Research Data Assistance Center) documentation.
It enables researchers, data engineers, and AI agents to query dataset metadata, variable definitions, and document structures offline with strict citation-backed provenance.
Key Features
- Offline-First Preservation: Rebuild the entire knowledge base from pre-packaged raw snapshots containing HTML, PDF, and spreadsheet documentation.
- Pipeline Processing: Pipeline commands to crawl/inventory, archive, parse, extract variables, and perform quality assurance audits.
- Lexical Search: Query the compiled SQLite FTS5 index for variables, datasets, and document chunks.
- Model Context Protocol (MCP) Support: Run an MCP server to connect the knowledge base directly to AI editors and tools (e.g., Claude Desktop, Cursor).
- Provenance-First Design: Every retrieved definition or document chunk is mapped back to its source URL and local archived path.
Installation
Install using pip or uv:
pip install resdac-doc-archive
For optional semantic search support:
pip install "resdac-doc-archive[semantic]"
Quick Start
1. Build the Search Index
Before querying, compile the SQLite FTS5 search index:
cms-kb-index
2. Search variables & definitions
Query the search index using the command-line interface:
cms-kb-search --query "BENE_ID" --limit 5
3. Expose as MCP Server
Start the Model Context Protocol server to connect your AI assistant:
cms-kb-mcp
See more options and entry points/paths in the user manual.
Programmatic API Example
You can query the knowledge base and retrieve citation-packed context directly in Python:
from pathlib import Path
from cms_kb import AgentContextConfig, build_agent_context
# Configure paths to manifests and search indices
config = AgentContextConfig(
archive_manifest_path=Path("manifests/archive_manifest.csv")
)
# Search for a variable and print definition and source citation
response = build_agent_context(config, query="DUAL_ELG", limit=1)
for hit in response.results:
print(f"Record: {hit.title} ({hit.record_type})")
print(f"Snippet: {hit.snippet}")
print(f"Source URL: {hit.citation.source_url}")
if hit.citation.variable_document:
print(f"Local Archive Path: {hit.citation.variable_document}")
Documentation
For full details on the data model, pipeline steps, and development guidelines, refer to the repository documentation:
Metadata
Release files for resdac-knowledge-base 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| resdac_knowledge_base-1.0.2.tar.gz | 18.9 MB | Without provenance | Details for resdac_knowledge_base-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| resdac_knowledge_base-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for resdac_knowledge_base-1.0.2-py3-none-any.whl |
Total release size: 27.9 MB
Release files / resdac_knowledge_base-1.0.2.tar.gz
| Download URL | resdac_knowledge_base-1.0.2.tar.gz |
|---|---|
| Size | 18.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74861cace43afc71ab04868f544f26f881aede5703c5d54cc634f4791b3df9f9
|
|
BLAKE2b-256 checksum How to use checksums |
3fd3023530dcd15c49319b1c4677ed6af4140c1b7dc02d217643c77e99918697
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / resdac_knowledge_base-1.0.2-py3-none-any.whl
| Download URL | resdac_knowledge_base-1.0.2-py3-none-any.whl |
|---|---|
| Size | 9.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8c3e9336c494996c03f970d0fd271cbd4c6dfd57424cc8fb81d491230e5ae24a
|
|
BLAKE2b-256 checksum How to use checksums |
32ed699fd2104709c55228b1e8bdf045ceeaf3874f1ffc50e56685173a550421
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for resdac-knowledge-base 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.