26
Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

Embed Size (px)

Citation preview

Page 1: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

Nadir Saghar, Tony Pan, Ashish SharmaREST for Data Services

Page 2: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services
Page 3: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

Motivation

• caBIG IMG TCGA Radiology Enterprise Use Case Phase I Pilot Project

Multiple Radiologists read MR images from NBIA and make annotation in AIM format. The AIM annotation documents are stored in and retrieved from AIME caGrid Data Service

Multiple review client applications (Osirix IPAD on Mac, ClearCanvas on Windows, XIP on Windows/Linux) requiring connectivities to caGrid services (NBIA, AIME)

Page 4: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

The Language Barrier

• Problem:– Osirix iPAD is ObjectiveC based

– ObjectiveC’s java support is limited

– ObjectiveC’s support for SOAP is limited

– A native grid service client in ObjectiveC would require investigation, time, and personnel that were not available from the project

• Solution:– Create a HTTP RESTful service proxy to the AIME

caGrid data service

– Osirix iPAD (ObjectiveC) then use the RESTful API to access the caGrid service.

Page 5: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

RESTful Services

• An architecture style, unlike SOAP (a messaging “standard”)

• Representational State Transfer– each URL is a representation of an object– Stateless– Content typed via MIME

• Operations on the objects are performed through standard HTTP methods– get, post, put, delete– May be mapped Create, Retrieve, Update, and Delete

operations

• Leverages ubiquitous support for HTTP, browser compatibility• Well known adoptors: Yahoo, eBay, Amazon, Facebook

Page 6: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

RESTful Service Design Consideration

• As a style, RESTful API designs vary, and can easily carry different approaches of information modeling and behavioral semantics from application to application

• Example 1:– http://host/Annotation lists the available annotations– http://host/Annotation/1 retreives annotation with id=1

• Example 2:– http://hostA/Annotation + HTTP post queries annotation– http://hostB/Annotation + HTTP getqueries annotation

• Result– non-computable API so no computable interoperability– Higher degree of manual effort to document and adopt API

Page 7: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

TCGA Radiology Phase 1 RESTful Service Impl

• SUCCESS!

Osirix IPAD can interact with AIME caGrid Data Service through a RESTful Service proxy

• Manually implemented URLs and HTTP methods to support:– List annotation identifiers (HTTP get)– Retrieve annotation by identifier (HTTP get)– Submit to grid service (HTTP put)– Full CQL query support (HTTP post)

• Bonus: Web Browsers can access caGrid Data Service content directly– track reader progress in TCGA Radiology Phase II

Page 8: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

BUT WAIT, THERE IS MORE…

Page 9: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

Automated RESTful Service Creation?

• Can we automate the generation of RESTful service from a caGRid data Service?

– Is there sufficient information for the automation?

– Is there enough expressivity in the RESTful style and HTTP methods to fully proxy caGrid Data Service capabilities, specifically CQL?

Page 10: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

RESTful Service Generation Tool (RSGT)

• Can we automate the generation of RESTful service from a caGRid data Service?

– Is there sufficient information for the automation?

YES

– Is there enough expressivity in the RESTful style and HTTP methods to proxy caGrid Data Service capabilities, specifically CQL?

PARTLY

Page 11: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

Architecture of the REST CodeGen Framework

Page 12: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

Key Features

• Minimal amount of user intervention– Eclipse IDE plugin to facilitate RESTful service generation

and deployment

• Generation– User supply the grid service source tree, domain model,

and where to put the generated code

– RSGT does the rest

– User can optionally modify the generated code

• Deployment– User supply the grid service URL, the tomcat container

– RSGT does the rest

Page 13: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

Generated RESTful Service

• Deployable as .war

• Two classes of operations are generated– One to One mapping for caGrid Service operations.

• URL is suffixed with name of operation, e.g. Query

• Complex objects like CQL xml are passed along using HTTP POST and PUT

• For advanced operations

– One to One mapping for service domain model classes• URL is suffixed with name of class, e.g. Patient

• Retrieve only URL using HTTP GET

• URL can be appended with attribute filters

• Retrieve in XML, JSON, CSV, and HTML formats

Page 14: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

Technologies Used by RSGT

• Apache Velocity for template-based code generation

• Apache Ant for scripting

• Eclipse plugin for user interface

• JAX-RS for RESTful

• Introduce generated artifacts

• caGrid 1.2/1.3

Page 15: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

USAGE

Page 16: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

Demo: Add RSGT Plugin to Eclipse

http://storage01.cci.emory.edu/mnt/vg1/repos/Drop-Box/caGridRSGTUpdateSite/

Page 17: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

Demo: Add RSGT Plugin to Eclipse

http://storage01.cci.emory.edu/mnt/vg1/repos/Drop-Box/caGridRSGTUpdateSite/

Page 18: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

Generate RESTFul Service

Page 19: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

Provide caGrid-Service Location and Domain Model

Page 20: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

Provide RESTFul Service Information

Page 21: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

Customize REST Service (optional)

Page 22: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

Deploy Service

Page 23: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

Deploy Service: Provide URL of the caGrid Service

Page 24: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

Food for thought

• RESTful service API provides a simple and fast way to access data through URLs and web browsers

• Complex operations/interactions with the service require sending parameters (e.g. CQL) via HTTP Headers– Hard to impossible to formulate a query TREE in URL

– Not browser compatible

• Interpretation of RESTful architecture style results in different API (URL and HTTP operation) patterns and behaviors

• No formal standard for computable description and documentation of RESTful APIs

• REST is easy to build, hard to consume programmatically

Page 25: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

Future Directions

• Security– Proxy for secure grid services– Integration with WSSO

• Formal description of RESTful API for computable interoperability

• RESTful API best practices?• More flexible result transform, perhaps through user

supplied XSLT– More user and web browser friendly (prettier) “views” of

the data

• Documentation and Eclipse plugin information at https://web.cci.emory.edu/confluence/display/INCUB/RESTful+Interfaces

Page 26: Nadir Saghar, Tony Pan, Ashish Sharma REST for Data Services

QUESTIONS