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.0 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.0'}

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

# Upload a file to staging
result = client.post("/api/v1/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/v1/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/v1/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/v1/batch-convert/folder", data={
    "Input_Subfolder": "incoming",
    "Config_Profile": "835_to_rmap"
})
job_id = job["Job_Id"]

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

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

File Operations

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

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

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

# Download converted file
client.download("/api/v1/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/v1/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.0.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.0-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: redix_client-2.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 b056baaadfb7a371b1ef09cb9253f568d56ec6a1f45039c450741ccaf961eb4b
MD5 6fd5ec253852bd241483f9dcf251121c
BLAKE2b-256 0a6d6aaa14df5a8793c74812229c2934d4ff817c2c3c1cc7c664f5df2c349942

See more details on using hashes here.

File details

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

File metadata

  • Download URL: redix_client-2.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d91928dc2f4be6270a845ba5e5037678e434cde6aabb9973eb784fa23526ee4
MD5 3ab7e0e546f3f31aae243c6b18576ae7
BLAKE2b-256 bb9eaa7a7993f22d168eb4d69ad1406495cb13d4bcec1cf3d7d7378d4768baf7

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