Skip to main content

ResDAC/CMS documentation archive and inventory tooling

Project description

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:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

resdac_knowledge_base-1.0.2.tar.gz (18.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

resdac_knowledge_base-1.0.2-py3-none-any.whl (9.1 MB view details)

Uploaded Python 3

File details

Details for the file resdac_knowledge_base-1.0.2.tar.gz.

File metadata

  • Download URL: resdac_knowledge_base-1.0.2.tar.gz
  • Upload date:
  • Size: 18.9 MB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for resdac_knowledge_base-1.0.2.tar.gz
Algorithm Hash digest
SHA256 74861cace43afc71ab04868f544f26f881aede5703c5d54cc634f4791b3df9f9
MD5 6f1bca05ba84dacd4bee003d7c70b62a
BLAKE2b-256 3fd3023530dcd15c49319b1c4677ed6af4140c1b7dc02d217643c77e99918697

See more details on using hashes here.

File details

Details for the file resdac_knowledge_base-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: resdac_knowledge_base-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.1 MB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for resdac_knowledge_base-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8c3e9336c494996c03f970d0fd271cbd4c6dfd57424cc8fb81d491230e5ae24a
MD5 56226ed39dff36f7e2676049be3ae10d
BLAKE2b-256 32ed699fd2104709c55228b1e8bdf045ceeaf3874f1ffc50e56685173a550421

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page