# Best Practices

## Image quality

- Use a clear, well-lit, straight-on photo of the device display.
- Avoid glare, blur, or partial cropping of the screen.
- Ensure the device reading is fully visible and in focus.
- For PDF uploads, use exports with embedded text when available — image-only PDFs depend on OCR quality.


## Handling multi-device responses

When the image contains more than one device or multiple readings, the response includes an `items` array instead of top-level `deviceType` and `data` fields. Always check for the presence of `items` before reading top-level device fields:

```js
const result = response.data.extractions[0].result.data;

if (Array.isArray(result.items)) {
  // Multi-device response
  result.items.forEach(item => console.log(item.deviceType, item.data));
} else {
  // Single-device response
  console.log(result.deviceType, result.data);
}
```

## Confidence scores

- Check `confidence` on every extraction. A score below `0.7` is a signal to prompt your user to retake the photo.
- For multi-device responses, each item in `items[]` has its own `confidence` score — evaluate them independently.


## General

- Validate file size and format on the client side before uploading.
- Store the API key securely and never expose it in client-side code.
- Handle unknown `deviceType` values and unexpected `data` keys gracefully — new device types are added over time.


## Rate limits

No published per-second or daily rate limits. For high-volume integrations, contact [support@jonda.health](mailto:support@jonda.health) to discuss capacity planning.

## Data retention

Medical Device extraction records are stored and accessible via the transformation history endpoint (`GET /api/master/transformations?module=medical`) and the file retrieval endpoint (`GET /api/master/medical/:id`). There is no `uploadId` for medical device uploads — use the `id` returned in the transformation history to retrieve specific records.

## Environments

There is currently no separate sandbox or test environment. Use your production API key against the live endpoint. Test with sample device images before going live.