Skip to main content

findingmodel

Core Python library for Open Imaging Finding Models - structured data models for describing medical imaging findings in radiology reports.

Installation

pip install findingmodel

Features

  • Finding Model Management: Create and manage structured medical finding models with attributes
  • Finding Model Index: Fast lookup and search across finding model definitions with DuckDB
  • MCP Server: Model Context Protocol server for AI agent integration
  • Medical Ontology Support: Index codes from RadLex, SNOMED-CT, and other vocabularies

Configuration

Create a .env file in your project root:

# Required for embedding-based search
OPENAI_API_KEY=your_key_here

# Optional: Custom database path
FINDINGMODEL_DB_PATH=/mnt/data/finding_models.duckdb

The finding model database is automatically downloaded on first use.

CLI (findingmodel)

# View configuration
findingmodel config


# Show index statistics
findingmodel stats

# Search for finding models
findingmodel search "lung nodule"

# Validate one model JSON file
findingmodel validate model.fm.json

# Validate and reformat all models under a directory
findingmodel validate ./defs --reformat
# - validates all matching files and exits non-zero if any fail
# - --reformat updates valid files in place

# Convert finding model to Markdown
findingmodel fm-to-markdown model.json

Models

FindingModelBase

Basic finding model structure with name, description, and attributes.

from findingmodel import FindingModelBase

model = FindingModelBase(
    name="pneumothorax",
    description="Presence of air in the pleural space",
    attributes=[...]
)

# Export to Markdown
print(model.as_markdown())

FindingModelFull

Extended model with OIFM IDs, index codes, and contributor information.

from findingmodel import FindingModelFull

# Load from JSON
model = FindingModelFull.model_validate_json(json_content)

print(f"Model ID: {model.oifm_id}")
for attr in model.attributes:
    print(f"  {attr.name}: {attr.oifma_id}")

FindingInfo

Metadata about a finding including description, synonyms, and optional citations.

from findingmodel import FindingInfo

info = FindingInfo(
    name="pneumothorax",
    synonyms=["PTX", "collapsed lung"],
    description="Presence of air in the pleural space"
)

Index API

The Index class provides async access to the finding model database.

import asyncio
from findingmodel import Index

async def main():
    async with Index() as index:
        # Count indexed models
        count = await index.count()
        print(f"Total models: {count}")

        # Lookup by name or ID
        model = await index.get("pneumothorax")
        if model:
            print(f"Found: {model.name} ({model.oifm_id})")

        # Search for models
        results = await index.search("lung nodule", limit=5)
        for result in results:
            print(f"- {result.name}: {result.description}")

        # List all with pagination
        models, total = await index.all(limit=20, offset=0)

asyncio.run(main())

MCP Server

The package includes an MCP server for AI agent integration.

Tools Provided

  • search_finding_models: Hybrid search (FTS + semantic) for finding models
  • get_finding_model: Retrieve specific models by ID, name, or synonym
  • list_finding_model_tags: List all available tags
  • count_finding_models: Get index statistics

Running the Server

# Run directly
python -m findingmodel.mcp_server

# Or use the CLI entry point
findingmodel-mcp

Claude Desktop Configuration

{
  "mcpServers": {
    "finding-model-search": {
      "command": "python",
      "args": ["-m", "findingmodel.mcp_server"],
      "env": {
        "OPENAI_API_KEY": "your-key-here"
      }
    }
  }
}

See MCP Server Guide for complete documentation.

Documentation

Metadata

Release files for findingmodel 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for findingmodel 1.0.4
File Size Uploaded Provenance Actions
findingmodel-1.0.4.tar.gz 29.6 kB Without provenance Details for findingmodel-1.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for findingmodel 1.0.4
File Interpreter ABI Platform Actions
findingmodel-1.0.4-py3-none-any.whl Python 3 none any Details for findingmodel-1.0.4-py3-none-any.whl

Total release size: 66.3 kB

Release files / findingmodel-1.0.4.tar.gz

Download URL findingmodel-1.0.4.tar.gz
Size 29.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e822915649bff6cefd01e6e91347907771b2bf871e37ad5579db8284e3df47b9
BLAKE2b-256 checksum
How to use checksums
da64f9d11b5282334f409c5c8de0740b4fb183a7a05a422faa9186854104ff42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / findingmodel-1.0.4-py3-none-any.whl

Download URL findingmodel-1.0.4-py3-none-any.whl
Size 36.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
127f3e7b1a82dbbe6b0f92a080be67fc5d866dcd077eba1b7f0474518c4d1df1
BLAKE2b-256 checksum
How to use checksums
b2d1370861691ad123606e95bc0f88ab82fc47492f247a4a6a6216cc467883c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for findingmodel 1.0.4

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page