Eclipse web service application programming interface

Objective. Low-coupling seamless integration of multiple systems is the core foundation of smart radiotherapy. Following Service-Oriented Architecture style, a set of named operations (Eclipse Web Service API, EWSAPI) was developed for realizing network call of Eclipse. Approach. Under the guidance of Vertical Slice Architecture, EWSAPI was implemented in the C# language and based on ASP .Net Core 6.0. Each operation consists of three components: Request, Endpoint and Response. Depending on the function, the exchanged data for each operation, as input or output parameters, is the empty or a predefined JSON data. These operations were realized and enriched gradually, layer by layer, with reference to the clinical business classification. The business logic of each operation was developed and maintained independently. In situations where Eclipse Scripting API(ESAPI) was required, constraints of ESAPI were followed. Main results. Selected features of Eclipse TPS were encapsulated as standard web services, which can be invocated by other software through network. Several processes for data quality control and planning were encapsulated into interfaces, thereby extending the functionality of Eclipse. Currently, EWSAPI already covers testing of service interface, quality control of radiotherapy data, automation tasks for plan designing and DICOM RT files’ transmission. All the interfaces support asynchronous invocation. A separate Eclipse context will be created for each invocation, and is released in the end. Significance. EWSAPI which is a set of standard web services for calling Eclipse features through network is flexible and extensible. It is an efficient way to integration of Eclipse and other systems and will be gradually enriched with the deepening of clinical applications.


Introduction
The Scripting API which allows users to achieve more efficient and higher quality work is an attractive feature of Treatment Planning System (TPS).Its applications include: auditing quality of radiotherapy plan (Dewhurst et al 2015), automatically designing of plan for certain diseases (Guo et al 2019, Yang et al 2020, Gleeson et al 2023), searching for the most optimal plan (Janssen et al 2013, Huang et al 2018), etc. Eclipse (Varian Medical Systems, Palo Alto, CA) (Saw et al 2018), as a widely used treatment planning system (TPS), provides its own scripting programming interface solution -Eclipse Scripting API (ESAPI).
However, ESAPI is strongly dependent on the Eclipse workstation environment and cannot be used as a neutral high-level interface.Moreover, for the execution of scripted programs, human interaction is essential.It involves clicking buttons on Eclipse's GUI and manually starting a stand-alone application.ESAPI cannot be used directly as a neutral interface to support agile integration of thirdparty business systems to enable smart radiotherapy.We will create a set of high-level neutral operations (Eclipse Web Service API, EWSAPI) based on ESAPI to support standard Representational State Transfer (REST) invocation in a serviceoriented architecture perspective.
EWSAPI provides web services in a standardized mode, facilitating multi-system integration of radiotherapy services and process-driven automation.

Materials and methods
2.1.Software architecture Service-Oriented Architecture (SOA), as a paradigm for organizing and coordinating multiple functional units, provides a framework for easy-to-maintain information technology solutions for various domains.Under this framework, the capabilities of a domain are defined as services distributed over a network.These services are made available to all potential users (Applications) through predefined interfaces in a standardized invocation.In SOA, each specific business logic is concretely implemented by its corresponding service, and the domain users can focus their efforts on the actual business requirements.SOA is not a set of commercial products, but a model for building IT solutions.It can leverage any valuable resource (which may be owned by different people or organizations) distributed across a network.It allows for interaction between device manufacturers and users, who can provide valuable solutions around real clinical needs.EWSAPI was designed as a set of web services under the SOA framework, which is a set of high-level encapsulated features of Eclipse (core business system in the domain of radiotherapy).
Vertical Slice Architecture (VSA) is a technique that helps us build maintainable applications by separating the application around features or 'vertical slices'.VSA was selected as the development paradigm for the implementation of EWSAPI.Each interface is independent, facilitating collaboration in implementation and subsequent maintenance (Laskey and Laskey 2009).

RESTful interface
The definition of each interface conforms to the Representational State Transfer (REST) approach, which has the Http protocol as its network transport protocol.Interfaces (web services) are viewed as resources and are uniquely identified by their URIs.Each interface consists of three components: request, endpoint and response.
Each interface supports one or more CRUD (Create, Retrieve, Update, Delete) operations depending on how the program is implemented.Depending on the needs of business, interfaces can be implemented in either a mode with data exchange or a mode without data exchange.For interfaces with data exchanges, both the input and the output will be in JSON object format whose content will be predefined according to the business needs (Sumithra and Sarath 2015).

Development constraints
EWSAPI follows the Vertical Slice Architecture technical guidelines and is implemented in the C# programming language, based on ASP .Net Core 6.0.EWSAPI as a web service extension of ESAPI, the version of EWSAPI corresponds to the version of ESAPI one by one.The encapsulated features of Eclipse in EWSAPI were realized by calling ESAPI.This project relies on Eclipse V16.1.
For each web service interface, there is a corresponding command line servo program (stand-alone executable application) whose target framework is Microsoft .NET Framework 4.6.1.All the command line servo programs should be approved by qualified physicist before they have been used in the clinic (2020).Safety is the most important factor considered during the approving.

EWSAPI invoke
There are two conditions that must be met before EWSAPI can provide service to the outside world.First, there is an Eclipse workstation environment that supports the running of scripted applications.Second, there is a Web Server that provides web services for EWSAPI.A high-performance server with Windows Server 2016 is used as a dedicated server for EWSAPI in this project.On this server, the Eclipse V16.1 software was installed for running scripted applications, and the Internet Information Services (IIS) was installed as a Web Server.
For using, EWSAPI is called in the same way as any type of Web Service.The specified interface (URI location) is accessed directly via the HTTP protocol.For an interface with incoming data, a predefined JSON data object is passed in; for an interface with returning data, a predefined JSON data object is returned.The endpoint function of an interface is responsible for starting the paired command line servo program and processing both the input parameters and the returned data of it.ESAPI will be invocated internally by the servo program to complete the actual business logic which depends on features of Eclipse.A schematic is shown in figure 1.

Results
EWSAPI has been developed and tested as a first published version, and will be expanded and enhanced gradually according to the actual clinical needs.The default operation of an interface is the post operation, denoted by Post ('URI').Interfaces were classified by the path of the URI.The endpoint function of an interface will complete different business logics according to the content of the incoming JSON data, thus realizing the diversity of a given interface.These interfaces that have been implemented are described as follows.

Test interfaces
All interfaces in the Test category were implemented to test the basic service function of EWSAPI.These are interfaces with no input parameters.The Post ('/Test/ WebService') interface is used to test whether the underlying Web Server is working properly.The data returned by it is a JSON object representing the working status of the Web Server.The Post ('/Test/ EWSAPI') interface is used to jointly test the functionality of the Web Server and the Eclipse runtime environment.ESAPIInitial.exe is the command line servo program that accompanies this interface.This interface allows you to obtain comprehensive diagnostic information on user authorization, initialization of the Eclipse running context, approval of servo program, and invocation of command-line servo program.

TG263 interfaces
Although the TG263 report gives a set of standard nomenclature for normal tissues in radiotherapy planning (Mayo et al 2018), it is not easy to achieve a high rate of compliance of normal tissues' labels with standardizing nomenclatures in a clinical setting (Cardan et al 2019).This involves a variety of factors such as physician habits, tools for outlining, the impact of multi-person interactions, and the management of workflow.In this project, Post ('/TG263/ASTRO-Sites') and Post ('/TG263/ASTROStructures') were implemented with reference to the ASTRO experts' consensus (Wright et al 2019).When Post ('/TG263/ ASTROSites') is called with a specified anatomical region name as an input parameter, a list of treatment sites belonging to that anatomical region is returned.Specifying an anatomical region and a treatment site, the invocation of Post ('/TG263/ASTROStructures') leads to a list of recommended normal tissues and a list of normal tissues to be considered.

Data quality assurance interface
At each stage of the radiotherapy workflow, valuable data is produced that forms the basis for clinical information transfer and retrospective analysis.The quality of these data has a direct impact on the effectiveness and safety of radiation therapy.It is an effective means of ensuring high quality clinical data that software checks these data according to quality assurance (QA) rules (Covington et al 2016).In this project, Post ('/RTWorkflow/DataQA') is the QA solution for radiotherapy data.
The request parameter of this interface is a predefined JSON data structure.It contains basic information about patient, the current workflow node information, and various concrete meaning data structures that are incremented as the workflow progresses.It also contains a (Key, Value) parameter dictionary, which is used to support any future extension requirements.
By parsing the input parameters, the program can obtain a priori knowledge associated with radiotherapy data.Based on that, reasonable data quality judgments can be made.For each QA rule, there is a corresponding task function.For QA rules that do not depend on Eclipse, the task functions will be implemented directly using the C# programming language.For QA rules that need to rely on Eclipse, a servo program based on ESAPI is required.RTWFDataQA.exe is the servo program that accompanies this interface.
The response data for this interface is also a predefined JSON data structure.It contains: basic patient information, workflow node information, data QA findings and a list of text messages.For cases where the data QA criteria are met, the message list will only contain a 'Congratulations on Success' message.Where there is an unmet criterion, there is a message which is the aggregation of feedback and correction suggestion.For failed cases, their message list will contain all the messages corresponding to failed criteria.

Automation tasks interfaces
An important application scenario of EWSAPI lies in the automation of routine tasks, which is the same as ESAPI.In this project, each of automation tasks is defined as a separate interface with a matching ESAPIbased servo program.
The data structure returned by all the automation interfaces is defined as a JSON object containing basic metadata, execution results and comments.Input data structure of each interface is defined according to its specific application scenario.Currently, only Post ('/Automation/Create-StrucLables') is implemented to demonstrate the concept.It automatically creates a set of standardized structures in Eclipse based on specified patient id, anatomical region, treatment site and user preference (recommended only or including considered).Its internal logic is as follows: first, Post ('/TG263/ ASTROStructures') is called to get the aimed list of labels; then AutoCreatStrucLabels.exe (matched servo program) is called to create a set of structures with the specified labels in Eclipse.

DICOM RT files export interface
In radiotherapy, the DICOM protocol is widely accepted as the standard method for exchanging data between different systems.Post ('/FileIO/ExportDI-COMRT') is an interface that exports data from the ARIA database for a specified patient to a target system as DICOM-RT files.
This interface will successively call two servo programs: ProbeDICOM.exe and EvilDICOMSCU.exe.The function of ProbeDICOM.exe is to obtain the DICOM UID information of various modality data (Image, Structure Set, Plan, RT Dose, etc) of the specified patient through ESAPI.The functions of EvilDI-COMSCU.exe include: 1. pairing DICOM services between transmission endpoints; 2. Transferring patient data from the ARIA database to the target location in the form of DICOM-RT files based on the specified DICOM UIDs.

Discussion
Enhancing the interoperability of related business systems is the first step to realize industrial intelligence.Data interoperability and functional scalability of the TPS (as the hub system) are the keys to supporting smart radiotherapy.Although Eclipse provides a scripting interface to help users achieve customization requirements, there is no set of neutral interfaces to support data integration and business flow integration between multiple systems.A set of neutral interfaces based on service-oriented architecture is a smart choice for integrating Eclipse's functionality into a smart radiotherapy solution.
In this paper, we present a framework (EWSAPI) for Eclipse to enhance its interoperability and extend its functionality.Following SOA's style, EWSAPI is a set of web services that can be invocated by any system with a standardized schema.Considering the reusability and composability of the interfaces, we first divide the interfaces into multiple categories, and then define the content with commonality into specific interfaces under each category.A complex task interface may consist of multiple reusable base interfaces that are organically combined.In this way, it achieves two major goals.One is packaging Eclipse functionality into web services with ESAPI, facilitating the integration of Eclipse with other systems.The other is encapsulating solutions of clinical needs into interfaces to achieve efficient workflows.
The TG263 category contains all interfaces related to all clinical applications of TG263.These interfaces include querying predefined anatomical regions and radiotherapy sites, querying the list of recommended anatomical structures for a given treatment site, and so on.This category ensures consistency in the naming of anatomical structures of radiotherapy patients across all systems in the clinical environment.The Automation category brings together all the clinical steps that can be automated.The efficiency of clinical work will be greatly enhanced through direct calls from external related systems, organic combination of multiple business steps, etc. Post ('/RTWorkflow/DataQA') is a complex interface responsible for data quality control in radiotherapy process.Before the workflow node switching, it is responsible for calling multiple task interfaces to complete the rationality and standardization verification of patient data in the current node, and to complete the cross validation of patient data in multiple systems.
To the best of our knowledge, EWSAPI is the first service-oriented interface framework for Eclipse.Clinical applications of the ESAPI have covered review of data consistency and the evaluation of plan quality EWSAPI is tightly bound to the version of Eclipse running in the clinical environment (ESAPI version).Because of the evolution of ESAPI, in any version earlier than V15, If one wanted to realize data writing operations, one needed to call the macro functions generated by recording interface operations (Wang and Xing 2016).In environments higher than V15, EWSAPI will have a greater range of applications and better flexibility.
EWSAPI is only a set of middleware interfaces, not a specific application program.The true value of EWSAPI depends on how many clinical problems are actually solved.In other words, the more clinical problems that are solved, the more categories and numbers of interfaces there are.The clinical application of EWSAPI requires a well-established process for interface registration and approval.It is also necessary to develop a periodic quality control program for it.EWSAPI is like any other clinical tool.Whether it is a read-only interface or a task automation interface, the data obtained or generated by it ultimately needs to be reviewed and approved by qualified personnel.
The evolution of EWSAPI belongs to the customized development of medical software, which puts very high demands on the clinical application team.Each interface (read-only or read-write) should be developed in accordance with the methods recommended by the software engineering and medical software development paradigms, and should be fully tested.Compared with general software development: it also needs to conduct scientific clinical risk assessment before development; after completing the development, it also needs to design some test cases for preclinical commissioning (Covington et al 2020).Excellent open-source projects in the community (Cardan et al 2019, Teruel et al 2021) can serve as a solid foundation for interface implementation.
The next step is to develop a plug-in for calling external web services for our running Radiotherapy Workflow Management System (RWMS).RWMS acts as a dispatch center and integrates with TPS through EWSAPI.Upon completion of that, the jumps between workflow nodes will trigger events which will drive the invocation of various EWSAPI network services.Eventually, a versatile event-driven integration platform like SaftyNet (Hadley et al 2016) will be realized.The centralized deployment of Eclipse based on Citrix enables users to handle radiotherapy business via the Internet.Based on that, our hospital realized a tele-radiotherapy system for our medical alliance.In this system, we can handle patients from multiple primary hospitals in a unified manner (Zou et al 2019).EWSAPI can be easily integrated into this tele-radiotherapy system, and standard data QC to member hospitals can be realized through EWSAPI.
EWSAPI demonstrates the powerful advantages of service-oriented neutral interfaces.With EWSAPI, users can easily integrate Eclipse with third-party systems to form an intelligent radiotherapy program.The architecture pattern, programming strategy, as well as the practical experience of EWSAPI, can be applied to other brands of TPS without any obstacles, forming a new XWSAPI.

Conclusion
EWSAPI is flexible and extensible.As a SOA service provider, EWSAPI has a set of attracting interfaces, which are independent of each other and have their own unique contexts for easy development and maintenance.EWSAPI provides solid support for building a service-oriented platform for smart radiotherapy.

Figure 1 .
Figure 1.Calling logic of web service interface.

(
Covington et al 2016, Zhou et al 2022, Cheng et al 2023) and the automation of VMAT planning for whole-body radiotherapy (Simiele et al 2021, Teruel et al 2021).EWSAPI is more macroscopic compared to ESAPI, focusing on improving the interoperability and extensibility of Eclipse.EWSAPI requires ESAPI in order to encapsulate Eclipse functionality into services.The results of ESAPI-based automatic planning and analysis (Teruel et al 2020, Chalise and Bojechko 2022, Romero et al 2023) can be encapsulated into interfaces of EWSAPI.
Romero I O et al 2023 Automating the treatment planning process for volumetric modulated arc therapy craniospinal irradiation (VMAT-CSI) Practical Radiation Oncology 14 E165-72 Saw C B, LI S, Battin F, Mckeague J and Peters C A 2018 External beam planning module of Eclipse for external beam radiation therapy Med.Dosim.43 195-204 Simiele E, Skinner L, Yang Y, Blomain E S, Hoppe R T, Hiniker S M and Kovalchuk N 2021 A step toward making VMAT TBI more prevalent: automating the treatment planning Process Practical Radiation Oncology 11 415-23 Sumithra R P and Sarath R 2015 Towards restful web service composition for healthcare domain 2015 International Conference on Control, Instrumentation, Communication and Computational Technologies (ICCICCT) 2015 845-8 Teruel J R, Malin M, Liu E K, Mccarthy A, HU K, Cooper B T, Sulman E P, Silverman J S and Barbee D 2020 Full automation of spinal stereotactic radiosurgery and stereotactic body radiation therapy treatment planning using Varian Eclipse scripting Journal of Applied Clinical Medical Physics 21 122-31 Teruel J R, Taneja S, Galavis P E, Osterman K S, Mccarthy A, Malin M, Gerber N K, Hitchen C and Barbee D L 2021 Automatic treatment planning for VMAT-based total body irradiation using Eclipse scripting Journal of Applied Clinical Medical Physics 22 119-30 Wang H and Xing L 2016 Application programming in C# environment with recorded user software interactions and its application in autopilot of VMAT/IMRT treatment planning J. Appl.Clin.Med.Phys.17 189-203 Wright J L, Yom S S, Awan M J, Dawes S, Fischer-Valuck B, Kudner R, Mailhot Vega R and Rodrigues G 2019 Standardizing normal tissue contouring for radiation therapy treatment planning: an ASTRO consensus paper Pract Radiat Oncol 9 65-72 Yang Y, Shao K, Zhang J, Chen M, Chen Y and Shan G 2020 Automatic planning for nasopharyngeal carcinoma based on progressive optimization in raystation treatment planning system Technol.Cancer Res.Treat.19 1533033820915710 Zhou D, Nakamura M, Sawada Y, Ono T, Hirashima H, Iramina H, Adachi T, Fujimoto T and Mizowaki T 2022 Development of independent dose verification plugin using eclipse scripting API for brachytherapy J. Radiat.Res.64 180-5 Zou L, Chen X, XU C, Xing L and Xie Y 2019 Design and preliminary experience of a tele-radiotherapy system for a medical alliance in China Telemedicine and e-Health 26 235-43