Oneliac Python SDK
A Python client library for the Privacy-Preserving Healthcare Agents API. Enables secure medical data analysis with zero-knowledge proofs and federated learning.
🚀 Features
- 🔐 Zero-Knowledge Proofs: Patient privacy guaranteed mathematically
- 🏥 Eligibility Verification: Check insurance coverage without exposing data
- 💊 Prescription Validation: Verify drug safety with encrypted medical history
- 🤖 Federated Learning: Participate in collaborative AI training
- ⛓️ Blockchain Integration: Solana-based proof verification
- 🔒 HIPAA Compliant: Meets healthcare privacy standards
📦 Installation
pip install oneliac
🔧 Quick Start
Async Usage (Recommended)
import asyncio
from oneliac import HealthcareAgentsClient, PatientData, EligibilityRequest
async def main():
# Initialize client
async with HealthcareAgentsClient("https://healthcare-agents-api.onrender.com") as client:
# Check API health
health = await client.health_check()
print(f"API Status: {health['status']}")
# Create patient data
patient_data = PatientData.create(
patient_id="PATIENT_001",
raw_data={
"age": 45,
"insurance_id": "INS123456",
"medical_conditions": ["diabetes", "hypertension"]
}
)
# Check eligibility
eligibility_request = EligibilityRequest(
patient_data=patient_data,
procedure_code="PROC001"
)
result = await client.verify_eligibility(eligibility_request)
print(f"Eligible: {result['eligible']}")
print(f"Coverage: {result['coverage_percentage']}%")
# Run async function
asyncio.run(main())
Synchronous Usage
from oneliac import HealthcareAgentsClientSync, PatientData, EligibilityRequest
# Initialize sync client
client = HealthcareAgentsClientSync("https://healthcare-agents-api.onrender.com")
# Check API health
health = client.health_check()
print(f"API Status: {health['status']}")
# Create patient data
patient_data = PatientData.create(
patient_id="PATIENT_001",
raw_data={
"age": 45,
"insurance_id": "INS123456",
"medical_conditions": ["diabetes", "hypertension"]
}
)
# Check eligibility
eligibility_request = EligibilityRequest(
patient_data=patient_data,
procedure_code="PROC001"
)
result = client.verify_eligibility(eligibility_request)
print(f"Eligible: {result['eligible']}")
📚 API Reference
Client Initialization
# Async client
client = HealthcareAgentsClient(
base_url="https://healthcare-agents-api.onrender.com",
api_key="your-api-key", # Optional
timeout=30 # Request timeout in seconds
)
# Sync client
client = HealthcareAgentsClientSync(
base_url="https://healthcare-agents-api.onrender.com",
api_key="your-api-key", # Optional
timeout=30
)
Eligibility Verification
from healthcare_agents import EligibilityRequest, PatientData
# Create request
request = EligibilityRequest(
patient_data=patient_data,
procedure_code="PROC001" # Medical procedure code
)
# Verify eligibility
result = await client.verify_eligibility(request)
# Returns: {"eligible": bool, "coverage_percentage": float, "zk_proof_hash": str}
Prescription Validation
from healthcare_agents import PrescriptionRequest
# Create request
request = PrescriptionRequest(
patient_data=patient_data,
drug_code="DRUG001" # Drug identifier
)
# Validate prescription
result = await client.validate_prescription(request)
# Returns: {"safe": bool, "interactions": list, "confidence": float}
Federated Learning
from healthcare_agents import FederatedLearningRequest
# Create request with multiple patient datasets
request = FederatedLearningRequest(
patient_datasets=[patient_data1, patient_data2, patient_data3]
)
# Participate in training
result = await client.federated_learning_train(request)
# Returns: {"model_updated": bool, "training_round": int, "model_accuracy": float}
# Check FL status
status = await client.federated_learning_status()
# Returns: {"active_agents": int, "training_rounds": int, "model_accuracy": float}
🔐 Privacy & Security
Data Encryption
# Patient data is automatically encrypted
patient_data = PatientData.create(
patient_id="PATIENT_001",
raw_data={
"ssn": "123-45-6789", # Sensitive data
"medical_history": ["surgery_2020", "allergy_penicillin"]
}
)
# Raw data is encrypted before API calls
print(patient_data.encrypted_data) # Base64 encoded encrypted data
print(patient_data.data_hash) # SHA256 hash for verification
Zero-Knowledge Proofs
All eligibility and prescription validations use zero-knowledge proofs:
result = await client.verify_eligibility(request)
# ZK proof hash verifies the computation without revealing data
zk_proof = result['zk_proof_hash']
print(f"ZK Proof: {zk_proof}") # Cryptographic proof of eligibility
🏥 Healthcare Use Cases
Hospital Integration
class HospitalSystem:
def __init__(self):
self.client = HealthcareAgentsClientSync("https://your-api.onrender.com")
def check_patient_eligibility(self, patient_id: str, procedure: str):
"""Check if patient is eligible for procedure"""
patient_data = self.get_patient_data(patient_id)
request = EligibilityRequest(patient_data, procedure)
return self.client.verify_eligibility(request)
def validate_prescription(self, patient_id: str, drug_code: str):
"""Validate prescription safety"""
patient_data = self.get_patient_data(patient_id)
request = PrescriptionRequest(patient_data, drug_code)
return self.client.validate_prescription(request)
Pharmacy Integration
class PharmacySystem:
def __init__(self):
self.client = HealthcareAgentsClientSync("https://your-api.onrender.com")
def dispense_medication(self, patient_id: str, drug_code: str):
"""Check safety before dispensing"""
patient_data = self.get_patient_data(patient_id)
request = PrescriptionRequest(patient_data, drug_code)
result = self.client.validate_prescription(request)
if result['safe']:
return self.dispense_drug(drug_code)
else:
return {"error": "Prescription validation failed", "warnings": result['warnings']}
🔧 Error Handling
from healthcare_agents.exceptions import APIError, ValidationError
try:
result = await client.verify_eligibility(request)
except APIError as e:
print(f"API Error: {e}")
print(f"Status Code: {e.status_code}")
except ValidationError as e:
print(f"Validation Error: {e}")
except Exception as e:
print(f"Unexpected Error: {e}")
🧪 Testing
# Install development dependencies
pip install healthcare-agents[dev]
# Run tests
pytest
# Run with coverage
pytest --cov=healthcare_agents
📖 Documentation
- API Documentation: https://healthcare-agents-api.onrender.com/docs
- SDK Documentation: https://healthcare-agents-sdk.readthedocs.io/
- GitHub Repository: https://github.com/razaahmad9222/healthcare-agents-sdk-python
🤝 Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make changes and add tests
- Run tests:
pytest - Submit a pull request
📄 License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
🆘 Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: raza@healthcare-agents.com
Built with ❤️ for privacy-preserving healthcare
Metadata
Release files for oneliac 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| oneliac-0.1.0.tar.gz | 10.8 kB | Without provenance | Details for oneliac-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| oneliac-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for oneliac-0.1.0-py3-none-any.whl |
Total release size: 19.8 kB
Release files / oneliac-0.1.0.tar.gz
| Download URL | oneliac-0.1.0.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7b99c90d31ec2b929ac8040b7f06489fb3a1634bffe075fd77893676ac8e2a6
|
|
BLAKE2b-256 checksum How to use checksums |
81887f38c47e73bec6dec2eecc69148538131c76e577f99305fefc8bc137bf8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.1
|
Release files / oneliac-0.1.0-py3-none-any.whl
| Download URL | oneliac-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b3be3122081b0aca6a34816fc84e7e60299b0cea82e07ce4537e9bf6a44cd91e
|
|
BLAKE2b-256 checksum How to use checksums |
9166afca31dee03c77bd18621f908e09612470d91620de931fbeabccaff4ef6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.1
|
Security for oneliac 0.1.0
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.