Skip to main content

Definition and tools for Open Imaging Finding Models

Project description

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"

# 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.

Related Packages

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

findingmodel-1.0.2.tar.gz (27.5 kB view details)

Uploaded Source

Built Distribution

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

findingmodel-1.0.2-py3-none-any.whl (34.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: findingmodel-1.0.2.tar.gz
  • Upload date:
  • Size: 27.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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}

File hashes

Hashes for findingmodel-1.0.2.tar.gz
Algorithm Hash digest
SHA256 26794066fbdbb5f10f04f40bfad1885c61503e2c48d9c3c30079b6c14a9f1828
MD5 83f7cbdc825117f009ce8676312f1538
BLAKE2b-256 a50a9608fb721540f2481ddb67065d3bbefe60acbec9b72afb10c62a422e5791

See more details on using hashes here.

File details

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

File metadata

  • Download URL: findingmodel-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 34.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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}

File hashes

Hashes for findingmodel-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 77163ac4a69d50e6e8f36e905c641f55e6c6508f33fc1969d3c7354575af6edc
MD5 9c81c166505aed9d091454cb92cedfb5
BLAKE2b-256 c168d1f7ed86eccfdcfb86ced1c5a54dfbf662f36d18eee90c1ec8a6d13419c3

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