#discovery #upload #connect #api #graphql #bindings #public

discovery-connect

Library to upload data to RetinAI Discovery via the public API

1 stable release

1.0.0 Mar 27, 2024

#711 in Web programming

Download history 116/week @ 2024-03-27 17/week @ 2024-04-03 3/week @ 2024-04-10

136 downloads per month

Apache-2.0

49KB
497 lines

Discovery Connect (Rust)

Rust interface for data exchange via the Discovery API, with C-compatible bindings.

  • bindings/cpp: C-compatible bindings - experimental
  • connect: Rust graphql interface
  • example: terminal application for the graphql interface

Getting started

Make sure you have a working Rust installation according to the installation instructions.

Open a terminal and type:

cargo run --p example

You should see the following output:

Usage: ExampleUploadAcquisition <api_url> <client_id> <client_secret> <username> <password> <timeout> <workbook_uuid> <acquisition_name> <file1> <file2> ...

If you receive an error, please review or update your Rust installation.

Compile

You can use cargo build --release to generate a library that you can include in your project.

cargo build --release

A C interface is automatically generated in target/release/:

  • include/discovery.h - header file (cross-platform)
  • libdiscovery.so - shared library (Linux only)
  • libdiscovery.dylib - shared library (MacOS only)
  • discovery.dll - shared library (Windows only)

Testing

To access the Discovery API, you will need:

  • valid Discovery service account credentials
  • valid API client credentials

When collaborating with Ikerian on a particular project, you will be issued those credentials as part of the project setup. If you have not been issued credentials, please reach out to your contact person.

Below is an example call for Linux / Mac:

API_URL='https://api.example.discovery.com' \
CLIENT_ID='12345678-1234-1234-1234-1234567890ab' \
CLIENT_SECRET='1234567890' \
USER='upload-service@example.com' \
PASS='abcdefghij' \
TIMEOUT=300 \
WORKBOOK_UUID='12345678-1234-1234-1234-1234567890ab' \
ACQUISITION_NAME='test-acquisition' \
cargo run -q --p example \
  $API_URL $CLIENT_ID $CLIENT_SECRET $USER $PASS $TIMEOUT \
  $WORKBOOK_UUID $ACQUISITION_NAME \
  00000001.dcm 00000002.dcm 00000003.dcm 00000004.dcm

Below is an example call for Windows:

set API_URL= 'https://api.example.discovery.com'
set CLIENT_ID='12345678-1234-1234-1234-1234567890ab'
set CLIENT_SECRET='1234567890'
set USER='upload-service@example.com'
set PASS='abcdefghij'
set TIMEOUT=300
set WORKBOOK_UUID='12345678-1234-1234-1234-1234567890ab'
set ACQUISITION_NAME='test-acquisition'
cargo run -q --project example/DiscoveryExample.csproj ^
    %API_URL% %CLIENT_ID% %CLIENT_SECRET% %USER% %PASS% %TIMEOUT% ^
    %WORKBOOK_UUID% %ACQUISITION_NAME% ^
   00000001.dcm 00000002.dcm 00000003.dcm 00000004.dcm

License

Copyright 2023 Ikerian AG

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Dependencies

~14–29MB
~503K SLoC