Skip to main content

Python SDK for Open Dental API - Integration tested with real API, 42 resources, full type safety

Project description

Open Dental Python SDK

A comprehensive, domain-driven Python SDK for the Open Dental API that provides type-safe access to all Open Dental resources.

✅ FULLY TESTED AND WORKING - Successfully tested with real Open Dental API

Features

Production Ready - Integration tested with real Open Dental API
Type Safe - Built with Pydantic models for full type safety
42 Resources - Complete coverage of all Open Dental API endpoints
Simple & Clean - Intuitive, Pythonic interface
Error Handling - Comprehensive error handling with detailed messages
Real Data Support - Handles actual Open Dental API response formats

Installation

pip install -e .

Or with uv:

uv pip install -e .

Quick Start

from opendental import OpenDentalClient

# Initialize client (uses environment variables)
client = OpenDentalClient()

# List all patients
patients = client.patients.list()
print(f"Found {patients.total} patients")

# Get specific patient
patient = client.patients.get(123)
print(f"Patient: {patient.first_name} {patient.last_name}")
print(f"Status: {patient.patient_status}")
print(f"Provider: {patient.primary_provider_abbr}")

# Search patients (client-side filtering)
from opendental.resources.patients.models import PatientSearchRequest

search_results = client.patients.search(
    PatientSearchRequest(last_name="Smith")
)
print(f"Found {len(search_results.patients)} patients named Smith")

# Limited results
recent_patients = client.patients.list(limit=5)

Authentication

Set your Open Dental API keys as environment variables:

export OPENDENTAL_DEVELOPER_KEY="your_developer_key"
export OPENDENTAL_CUSTOMER_KEY="your_customer_key"

Or create a .env file:

OPENDENTAL_DEVELOPER_KEY=your_developer_key
OPENDENTAL_CUSTOMER_KEY=your_customer_key

Or pass them directly:

client = OpenDentalClient(
    developer_key="your_developer_key",
    customer_key="your_customer_key"
)

Available Resources

The SDK provides clients for all 42 Open Dental API resources:

Core Resources

  • client.patients - Patient management ✅ Tested
  • client.appointments - Appointment scheduling
  • client.providers - Healthcare providers
  • client.procedures - Medical procedures
  • client.payments - Payment processing

Clinical Resources

  • client.medications - Medication management
  • client.allergies - Allergy tracking
  • client.diseases - Disease management
  • client.lab_cases - Laboratory cases

Financial Resources

  • client.claims - Insurance claims
  • client.adjustments - Account adjustments
  • client.insurance_plans - Insurance plan management
  • client.pay_plans - Payment plans

Administrative Resources

  • client.employees - Staff management
  • client.users - User accounts
  • client.clinics - Clinic locations
  • client.operatories - Operatory management

System Resources

  • client.definitions - System definitions
  • client.communications - Communication logs
  • client.documents - Document management
  • client.computers - Computer tracking

...and 25+ more resources!

Real-World Usage

This SDK has been tested with actual Open Dental systems and handles real data correctly:

# Example with real data types
patient = client.patients.get(11)

# Returns actual data like:
# patient.first_name = "Allen"
# patient.last_name = "Allowed" 
# patient.patient_status = "Patient"  # String, not integer
# patient.gender = "Male"             # String, not integer
# patient.billing_type = "Standard"   # String, not integer
# patient.birth_date = date(1980, 6, 5)
# patient.primary_provider_abbr = "DOC1"

API Limitations & SDK Solutions

The Open Dental API has some limitations that this SDK handles gracefully:

No Server-Side Search

API Limitation: No /patients/search endpoint
SDK Solution: Client-side filtering with full search functionality

# This works despite API limitations
search_results = client.patients.search(
    PatientSearchRequest(
        last_name="Smith",
        email="john@example.com"
    )
)

No Pagination

API Limitation: No page/per_page parameters
SDK Solution: Client-side limiting and all results returned

# Returns all patients, limited client-side
patients = client.patients.list(limit=10)

String-Based Enums

API Limitation: Returns "Patient" instead of status codes
SDK Solution: Models handle string values correctly

Error Handling

from opendental import OpenDentalClient
from opendental.exceptions import OpenDentalAPIError

client = OpenDentalClient()

try:
    patient = client.patients.get(999999)
except OpenDentalAPIError as e:
    print(f"API Error: {e.message}")
    print(f"Status Code: {e.status_code}")
    print(f"Response: {e.response_data}")

Testing

Run the integration tests with your API keys:

# Set up environment
export OPENDENTAL_DEVELOPER_KEY="your_key"
export OPENDENTAL_CUSTOMER_KEY="your_key"

# Run integration tests
python run_integration_tests.py

# Or run basic example
python examples/basic_usage.py

# Or run comprehensive demo
python demo_sdk.py

Development

Setup

# Clone and install
git clone <repository>
cd python
uv pip install -e ".[dev]"

# Run tests
python final_integration_test.py

Architecture

The SDK follows domain-driven design:

src/opendental/
├── base/              # Base classes
│   ├── models.py      # BaseModel with Pydantic config
│   └── resource.py    # BaseResource with HTTP methods
├── resources/         # 42 resource modules
│   ├── patients/      # Patient domain
│   │   ├── models.py  # Patient, CreatePatientRequest, etc.
│   │   ├── client.py  # PatientsClient
│   │   └── types.py   # Patient-specific enums
│   └── ...           # 41 other resources
├── client.py          # Main OpenDentalClient
└── exceptions.py      # SDK exceptions

Key Design Principles

  1. Keep It Simple - Direct API wrapper with minimal abstraction
  2. Domain Ownership - Each resource owns its models
  3. Type Safety - Pydantic models throughout
  4. Real Data First - Built for actual API responses, not documentation

HIPAA Compliance

⚠️ Important: This SDK handles sensitive patient data. Ensure you:

  • Have a Business Associate Agreement (BAA) with Open Dental
  • Follow all HIPAA compliance requirements
  • Implement proper security measures in your applications
  • Use secure connections and proper authentication

License

MIT License - see LICENSE file for details.

Support

  • Integration tested and working with Open Dental API
  • See examples/ directory for working code samples
  • Run python demo_sdk.py to verify functionality
  • Check error messages for detailed troubleshooting information

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

opendental_sdk-0.1.1.tar.gz (79.5 kB view details)

Uploaded Source

Built Distribution

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

opendental_sdk-0.1.1-py3-none-any.whl (144.3 kB view details)

Uploaded Python 3

File details

Details for the file opendental_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: opendental_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 79.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for opendental_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cf1396afec98aa658256af38ab3871ffe346b3a2a68db528f3cff894ff3c9cdf
MD5 f4331a64eccf8873a794c5b6de77904f
BLAKE2b-256 d74c9d40d7d9ec1c6df2c2cc69cb7a5542fa6b22b7e3401de095a6681f7aea7e

See more details on using hashes here.

File details

Details for the file opendental_sdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: opendental_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 144.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for opendental_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5e39247db09d884402b973ecfc60cc481c1dfdbc5b7804ecb5a7f88eb81660de
MD5 686d8a59baf4211f832ea32f1be78e00
BLAKE2b-256 f2f6829893c08e948339dc206c1ddfbbedbe8492e435c9f4c438dfd2eb27802f

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