SWR-006- The REST API only accepts and outputs images in Base64 format
Internal ID | SWR_006 |
Title | The REST API only accepts and outputs images in Base64 format |
Category | INTERFACE |
Importance | HIGH |
System | REST API, Backend |
Editor(s) | Alejandro Carmena Magro , JD-017 |
Supervisor | Alfonso Medela , JD-005 |
Approval | PENDING |
Created at | 21 Jun 2024 |
Description​
Base64 encoding converts binary image data into a text format that can be easily included in JSON payloads. The REST API endpoints must be designed to handle images only in Base64 encoded format. This approach makes sure that image data can be reliably transmitted over HTTP within JSON documents, facilitating integration and compatibility with different client systems and maintaining data integrity during transmission.
Rationale​
Encoding images in Base64 format is essential for smooth and consistent data exchange between the client and server over HTTP. This universally supported format ensures that binary image data can be safely included in JSON requests and responses, preventing data corruption. It simplifies the process of handling image data in web services and ensures compatibility with existing web standards.
Source​
This requirement arises solely from the system's need to ensure reliable and secure transmission of image data over the REST API.
Tested by software tests​
- PLAN_011: Base64 encoded images are accepted and returned
- PLAN_012: Non-Base64 encoded images are rejected
Activities generated​
- Implement encoding and decoding functionalities in the server-side code.
- Implement encoding and decoding functionalities in client applications within the medical device.
- Update the API documentation to specify the requirement for Base64 encoded images.
Implements user needs​
This requirement ensures that users can reliably transmit image data for analysis and receive results without issues related to data corruption or incompatibility.
Causes failure modes​
- Incorrectly encoded images leading to API errors.
- Increased payload size due to Base64 encoding.
- Misinterpretation of image data if encoding/decoding processes fail.
Implements risk control measures​
- Binary image data is reliably transmitted within JSON payloads, reducing the risk of data corruption during transmission.
- Standardizing on a universally supported encoding format guarantees compatibility with many client systems, reducing integration issues and the likelihood of interface errors.
- Base64 encoding can provide an extra layer of protection for binary data, making it less vulnerable to easy interception or tampering during transmission.
Acceptance criteria​
- The API clinical endpoints accept and correctly process Base64 encoded images in requests.
- The API clinical endpoints return Base64 encoded images in responses.
- No data corruption or errors occur during the transmission of Base64 encoded images.
Constraints​
No specific constraints apply for this requirement.
Dependencies​
This requirement depends on the availability of libraries or functions in the client and server environments to handle Base64 encoding and decoding.
Performance considerations​
Base64 encoding increases the size of the image data by approximately 33%. The larger data size from this encoding can affect API performance, especially with big images. To avoid any issues, it's important to use efficient handling and optimization strategies.
Additional notes​
Ensure that any documentation or training materials provided to users include clear instructions on how to encode/decode images in Base64 format.
Revision history​
Document version | Date | Author | Description |
---|---|---|---|