Metadata-Version: 2.4
Name: moa-telehealth
Version: 1.0.1
Summary: Magnetic Outlier Agent: Patent-pending outlier detection for RAG systems and telehealth compliance
Author-email: Michael Ordon <grzywajk@gmail.com>
License: Business Source License 1.1
Project-URL: Homepage, https://github.com/grzywajk-beep/moa_v1
Project-URL: Repository, https://github.com/grzywajk-beep/moa_v1
Project-URL: Documentation, https://github.com/grzywajk-beep/moa_v1/blob/main/README.md
Project-URL: Bug Tracker, https://github.com/grzywajk-beep/moa_v1/issues
Project-URL: Patent Pending, https://github.com/grzywajk-beep/moa_v1/blob/main/PATENT_PENDING.md
Keywords: RAG,outlier-detection,telehealth,compliance,embeddings,LLM
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Healthcare Industry
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24.0
Requires-Dist: scipy>=1.10.0
Requires-Dist: scikit-learn>=1.2.0
Requires-Dist: pandas>=2.0.0
Requires-Dist: click>=8.1.7
Requires-Dist: fastapi>=0.100.0
Requires-Dist: uvicorn>=0.20.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: httpx>=0.24.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: requests>=2.28.0
Requires-Dist: langchain>=0.1.0
Requires-Dist: langchain-core>=0.1.0
Provides-Extra: dev
Requires-Dist: pytest>=7.4.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Requires-Dist: streamlit>=1.28.0; extra == "dev"
Provides-Extra: mcp
Requires-Dist: mcp>=1.0.0; extra == "mcp"
Requires-Dist: langchain>=0.1.0; extra == "mcp"
Requires-Dist: langchain-openai>=0.0.5; extra == "mcp"
Dynamic: license-file

# Magnetic Outlier Agent (MOA)

**Patent Pending** • U.S. Provisional Serial No. 63/926,578 filed November 27, 2025  
**License** • Business Source License 1.1 (Change Date: November 27, 2029)  
**Trademarks Pending** • "Magnetic Outlier Agent" and "MOA"

---

## Overview

MOA is a geometric multi-metric outlier detection system for embedding vectors in Retrieval-Augmented Generation (RAG) pipelines. It uses a patented triple-metric approach combining centroid distance, local density, and graph curvature to identify low-quality or non-compliant documents before they reach your LLM.

**Use cases**:

- RAG quality filtering (remove hallucination-prone chunks)
- Telehealth compliance auditing (detect missing consent/risks language)
- Regulatory integration via MCP (ICD-10, CPT billing, state bills)

---

## Quick Start

```bash
pip install moa-telehealth
```

### Basic Usage

```python
from moa.filters import MOAOutlierFilter

# Initialize filter
moa = MOAOutlierFilter(threshold=1.5)

# Score documents
embeddings = [[0.1, 0.2, ...], ...]  # Your doc embeddings
scores, outliers = moa.score(embeddings)

# Filter out outliers
clean_docs = [doc for i, doc in enumerate(docs) if i not in outliers]
```

### LangChain Integration

```python
from langchain.chains import RetrievalQA
from moa.integrations.langchain_moa_filter import MOAFilterRunnable

qa_chain = RetrievalQA.from_chain_type(
    llm=llm,
    retriever=vectorstore.as_retriever() | MOAFilterRunnable(MOAOutlierFilter())
)
```

---

## IP & Security Status

- **Patent**: U.S. Provisional 63/926,578 (filed Nov 27, 2025) – See [PATENT_PENDING.md](./PATENT_PENDING.md)
- **License**: BUSL 1.1 (change date: 2029-11-27) – See [LICENSE](./LICENSE)
- **PyPI**: [moa-telehealth 1.0.0](https://pypi.org/project/moa-telehealth/1.0.0/) live
- **MCP Layer 3**: Regulatory integration complete – See [docs/REGULATORY_MCP_INTEGRATION.md](./docs/REGULATORY_MCP_INTEGRATION.md)
- **Security**: PHI handling & key management policies – See [SECURITY.md](./SECURITY.md)
- **Trademarks**: Filing in progress (deadline: Dec 4, 2025)

---

## Documentation

- **[Regulatory MCP Integration](./docs/REGULATORY_MCP_INTEGRATION.md)** - Free gov/insurance API integration
- **[Deployment Summary](./docs/DEPLOYMENT_SUMMARY.md)** - Production deployment guide
- **[Patent Pending](./PATENT_PENDING.md)** - Algorithm claims and scope
- **[Security](./SECURITY.md)** - Vulnerability reporting and responsible use

---

## Features

### Core Algorithm (Patent Pending)

- **Triple-metric scorer**: Combines centroid distance (d), local density (δ), and graph curvature (κ)
- **Bridge-path detection**: Identifies weak links in k-NN graphs
- **Spectral degradation**: Fourier analysis for time-ordered corpora

### Integrations

- ✅ **LangChain** - Drop-in RAG filter
- ✅ **MCP** - Claude Desktop tools for regulatory lookups
- ✅ **FastAPI** - RESTful endpoints for web/n8n
- ✅ **Streamlit** - Interactive compliance editor

### Regulatory Layer (MCP)

- **ICD-10 lookup** (NLM Clinical Tables) - Free, 1000/day
- **CPT billing** (eCFR §410.78) - Free, unlimited
- **State bills** (OpenStates) - Free, 5000/day (API key required)
- **PHI guard** - Automatic blocking of SSN/phone/names

---

## License

**Business Source License 1.1**  
© 2025 Michael Ordon. Patent Pending U.S. Provisional 63/926,578. All Rights Reserved.

- **Permitted**: Evaluation, research, internal use (≤100 visits/month)
- **Restricted**: Commercial SaaS offerings before change date (2029-11-27)
- **Change License**: Apache 2.0 (after Nov 27, 2029)

For commercial licensing: <grzywajk@gmail.com>

---

## Citation

If you use MOA in research, please cite:

```bibtex
@misc{ordon2025moa,
  title={Magnetic Outlier Agent: Geometric Multi-Metric Outlier Detection for RAG Systems},
  author={Ordon, Michael},
  year={2025},
  note={U.S. Provisional Patent Application Serial No. 63/926,578}
}
```

---

## Contact

**Inventor**: Michael Ordon (Culver City, CA)  
**Email**: <grzywajk@gmail.com>  
**Patent**: U.S. Provisional 63/926,578  
**License**: BUSL 1.1  
**Links**: [PyPI](https://pypi.org/project/moa-telehealth/) | [Patent Center](https://patentcenter.uspto.gov)
