Skip to main content

Overview

Report Parsing SDK on GitHub A Java Spring Boot SDK for processing medical documents through the Eka Care API. This SDK supports document submission, result polling, and FHIR data extraction.

Prerequisites

  • JDK 17+ (verify with java -version)
  • Maven (verify with mvn -version)
  • IDE: IntelliJ IDEA, Eclipse, or VS Code with Java extensions
  • Eka Care API Credentials: Valid client ID and secret

Project Structure

ekacare-sdk/
├── src/main/java/com/example/ekacare/
│   ├── sdk/EkaCareSDK.java
│   ├── service/EkaCareService.java
│   └── controller/DocumentController.java
├── src/main/resources/application.properties
└── pom.xml

Setup Instructions

Step 1: Create Spring Boot Project

Via Spring Initializr:
  • Visit start.spring.io
  • Select Maven, Java 17, Spring Boot 3.2.0
  • Add “Spring Web” dependency
  • Generate and extract
Via IntelliJ IDEA: File → New → Project → Spring Initializr → Configure with Java 17 and Spring Boot 3.2.0

Step 2: Add SDK Files

Copy files from the repository to respective directories:
  • EkaCareSDK.javasrc/main/java/com/example/ekacare/sdk/
  • EkaCareService.javasrc/main/java/com/example/ekacare/service/
  • application.propertiessrc/main/resources/
  • pom.xml → project root

Step 3: Configure Credentials

Update application.properties:
ekacare.client.id=YOUR_CLIENT_ID_HERE
ekacare.client.secret=YOUR_CLIENT_SECRET_HERE

Step 4: Build

mvn clean install

Quick Start

Direct SDK Usage

try (EkaCareSDK sdk = new EkaCareSDK("CLIENT_ID", "CLIENT_SECRET")) {
    Map<String, Object> result = sdk.processAndWait(
        "/path/to/document.jpg",
        "smart",
        10,  // poll interval (seconds)
        300  // timeout (seconds)
    );
    Map<String, Object> data = (Map<String, Object>) result.get("data");
    System.out.println("FHIR: " + data.get("fhir"));
}

Spring Boot Service

@Component
public class MyDocumentProcessor {
    @Autowired
    private EkaCareService ekaCareService;

    public void process() throws InterruptedException {
        Map<String, Object> result = ekaCareService
            .processDocumentAndWait("/path/to/document.jpg", "smart");
        System.out.println("Result: " + result);
    }
}

REST API Endpoints

The SDK provides REST endpoints for document processing:
MethodEndpointPurpose
POST/api/documents/process?task=smartAsync document submission
GET/api/documents/{id}/resultRetrieve processing result
POST/api/documents/process-sync?task=smartSync processing (waits for completion)

Task Options

When processing documents, you can specify different task types:
TaskDescription
smartSmart report parsing
piiPII (Personally Identifiable Information) detection
bothCombined smart parsing and PII detection

Example cURL Requests

# Submit document asynchronously
curl -X POST http://localhost:8080/api/documents/process?task=smart \
  -F "file=@/path/to/document.jpg"

# Get processing result
curl http://localhost:8080/api/documents/abc123/result

# Synchronous processing (waits for completion)
curl -X POST http://localhost:8080/api/documents/process-sync?task=smart \
  -F "file=@/path/to/document.jpg"

Troubleshooting

IssueSolution
File Not FoundUse absolute paths or verify relative path correctness
Authorization (401)Validate credentials in properties file
Maven Build FailsRun mvn clean install -U
Port 8080 In UseChange in application.properties: server.port=8081

Large File Upload

For large files, increase limits in application.properties:
spring.servlet.multipart.max-file-size=50MB
spring.servlet.multipart.max-request-size=50MB