Skip to main content

Python client for Redix Universal Healthcare Conversion API

Project description

redix-client

Python client for Redix Universal Healthcare Conversion API.

Version: 2.1.1 Repository: PyPI

Install

pip install redix-client

Quick Start

from redix_client import RedixClient

# Initialize client
client = RedixClient(
    base_url="https://demo.redix.com",
    api_key="YOUR_API_KEY"
)

# Health check
response = client.get("/")
print(response)  # {'status': 'healthy', 'version': '2.1.1'}

# List staging files
files = client.get("/api/v2/staging-files")
print(files)

# Upload a file to staging
result = client.post("/api/v2/staging/upload", files={
    "file": "/path/to/input.txt"
})

# Convert HL7 to FHIR
result = client.post("/api/v2/convert/hl7-to-fhir", files={
    "file": "/path/to/message.hl7"
})

API Methods

The client provides simple HTTP methods that work with any API endpoint:

Method Description
client.get(endpoint, params=None) GET request
client.post(endpoint, data=None, json=None, files=None) POST request
client.put(endpoint, data=None, json=None, files=None) PUT request
client.patch(endpoint, data=None, json=None) PATCH request
client.delete(endpoint, params=None) DELETE request
client.download(endpoint, dest_path) Download file

Examples

File Conversion (v1 API - Redix Engine)

# Convert with file upload
result = client.post("/api/v2/convert/file-upload",
    files={
        "Input_File": "/path/to/input.txt",
        "IFD_File": "/path/to/rules/835.ifd",
        "OFD_File": "/path/to/rules/835.ofd"
    },
    data={
        "Conversion_Flag": "e - UN/EDIFACT/RMap",
        "WarningLevel": 1,
        "User_Data": "0*\\**:*?"
    }
)

# View output file
output = client.get(f"/api/v2/view-file/output/{result['filename_base']}.out")
print(output['content'])

FHIR Conversions (v2 API)

# HL7 to FHIR
result = client.post("/api/v2/convert/hl7-to-fhir", files={
    "file": "/path/to/message.hl7"
})

# CDA to FHIR
result = client.post("/api/v2/convert/cda-to-fhir", files={
    "file": "/path/to/document.xml"
})

# HIPAA X12 to FHIR
result = client.post("/api/v2/convert/hipaa-to-fhir", files={
    "file": "/path/to/835.x12"
})

# Smart convert (auto-detect format)
result = client.post("/api/v2/convert/smart", files={
    "file": "/path/to/unknown_format.dat"
})

Batch Processing

# Start batch conversion
job = client.post("/api/v2/batch-convert/folder", data={
    "Input_Subfolder": "incoming",
    "Config_Profile": "835_to_rmap"
})
job_id = job["Job_Id"]

# Check status
status = client.get(f"/api/v2/batch-status/{job_id}")
print(status)

# List all batch jobs
jobs = client.get("/api/v2/batch-jobs", params={"Limit": 10})

File Operations

# Upload to staging
client.post("/api/v2/staging/upload", files={"file": "data.txt"})

# List staging files
files = client.get("/api/v2/staging-files")

# Delete from staging
client.delete("/api/v2/staging/myfile.txt")

# Download converted file
client.download("/api/v2/download-file/output/result.out", "./downloads/")

Admin Operations (v2 API)

# List users
users = client.get("/api/v2/admin/users")

# Create user
client.post("/api/v2/admin/users", json={
    "username": "newuser",
    "password": "secure123",
    "role": "user"
})

# Get statistics
stats = client.get("/api/v2/statistics")

# Get conversion history
history = client.get("/api/v2/history", params={"limit": 50})

Configuration

Environment Variables

export REDIX_API_URL=https://demo.redix.com
export REDIX_API_KEY=your-api-key

Then initialize without parameters:

client = RedixClient()

SSL Verification

For self-signed certificates in development:

client = RedixClient(
    base_url="https://localhost:8080",
    api_key="your-key",
    verify_ssl=False
)

Error Handling

from redix_client import RedixClient, RedixAPIError

client = RedixClient(base_url="https://demo.redix.com", api_key="your-key")

try:
    result = client.get("/api/v2/batch-status/invalid_id")
except RedixAPIError as e:
    print(f"Error {e.status_code}: {e.message}")

Documentation

License

MIT - Redix International, Inc.

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

redix_client-2.1.1.tar.gz (28.4 kB view details)

Uploaded Source

Built Distribution

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

redix_client-2.1.1-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file redix_client-2.1.1.tar.gz.

File metadata

  • Download URL: redix_client-2.1.1.tar.gz
  • Upload date:
  • Size: 28.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.21

File hashes

Hashes for redix_client-2.1.1.tar.gz
Algorithm Hash digest
SHA256 84acd1dc9c34240c31ac2ba8396ca849ca7713d8c608f68655725cdff85b19fd
MD5 986032670d90900d1561f76bf27d0039
BLAKE2b-256 25e5a1e5cbb1a2d70f9eeddcc6e6f13c08563eac5ca0b9bd92dc027ffa809943

See more details on using hashes here.

File details

Details for the file redix_client-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: redix_client-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 28.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.21

File hashes

Hashes for redix_client-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c28ca129edbf50d998faec6d271b34389e997fabe35031df6ecb8fa52ef22812
MD5 ae2dccf30c6de78e08f41c52157bd826
BLAKE2b-256 76b9909e44b8725a99c3c5824f0f2a9361be467434e0a8bf1389ad4ff6361fe8

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