how to build and deploy openclinicacrf data service...

18
How to Build and Deploy OpenClinicaCRF Data Service Version 1.2 1 Overview This document describes the process to follow for setting up the OpenClinicaCRF Data Service. The OpenClinicaCRF Data Service provides grid‐enabled access to clinical data stored in OpenClinica through the information model shown in Figure 1. The information model corresponds to a subset of the OpenClinica database schema and describes the relationship of studies, subjects, and case report form information. The OpenClinicaCRF Data Service allows users to navigate this model by subject, study, or type of case report form data. 2 Required Software Name Version Java 1.5 (Note: 1.6 will not work) Ant 1.6.5 Tomcat 5.0.28 PostgreSQL 8.1.11 Subversion client 1.4.2 OpenClinica 2.0 caGrid 1.2 caCORE SDK 4.0 (modified; see section 3.1) 3 Building the OpenClinicaCRF Data Service 3.1 Building and Deploying the OpenClinica caCORE SDK Application The OpenClinica caCORE SDK application is built with caCORE 4.0, modified to support the PostgreSQL database system – data in OpenClinica is stored in a PostgreSQL database, but caCORE does not it support it by default. Please contact the CVRG team to obtain the modified caCORE SDK instance. The modifications are configuration changes to enable a caCORE SDK generated application to access a PostgreSQL database backend. No modifications have been done to the core caCORE SDK system. In this document, $CACORE_SDK_HOME refers to the path of the caCORE SDK application directory. Before building the caCORE SDK application, you must perform two preparation steps: 1. Install PostgreSQL and create the OpenClinica database. Instructions for doing this can be found on the OpenClinica web site: http://www.openclinica.org/ . 2. Install a Tomcat container. a. This Tomcat container instance will host the OpenClinica caCORE SDK application.

Upload: phamthien

Post on 22-Feb-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

HowtoBuildandDeployOpenClinicaCRFDataServiceVersion1.21OverviewThisdocumentdescribestheprocesstofollowforsettinguptheOpenClinicaCRFDataService.TheOpenClinicaCRFDataServiceprovidesgrid‐enabledaccesstoclinicaldatastoredinOpenClinicathroughtheinformationmodelshowninFigure1.TheinformationmodelcorrespondstoasubsetoftheOpenClinicadatabaseschemaanddescribestherelationshipofstudies,subjects,andcasereportforminformation.TheOpenClinicaCRFDataServiceallowsuserstonavigatethismodelbysubject,study,ortypeofcasereportformdata.2RequiredSoftwareName VersionJava 1.5(Note:1.6willnotwork)Ant 1.6.5Tomcat 5.0.28PostgreSQL 8.1.11Subversionclient 1.4.2OpenClinica 2.0caGrid 1.2caCORESDK 4.0(modified;seesection3.1)3BuildingtheOpenClinicaCRFDataService3.1BuildingandDeployingtheOpenClinicacaCORESDKApplicationTheOpenClinicacaCORESDKapplicationisbuiltwithcaCORE4.0,modifiedtosupportthePostgreSQLdatabasesystem–datainOpenClinicaisstoredinaPostgreSQLdatabase,butcaCOREdoesnotitsupportitbydefault.PleasecontacttheCVRGteamtoobtainthemodifiedcaCORESDKinstance.ThemodificationsareconfigurationchangestoenableacaCORESDKgeneratedapplicationtoaccessaPostgreSQLdatabasebackend.NomodificationshavebeendonetothecorecaCORESDKsystem.Inthisdocument,$CACORE_SDK_HOMEreferstothepathofthecaCORESDKapplicationdirectory.BeforebuildingthecaCORESDKapplication,youmustperformtwopreparationsteps:

1. InstallPostgreSQLandcreatetheOpenClinicadatabase.InstructionsfordoingthiscanbefoundontheOpenClinicawebsite:http://www.openclinica.org/.

2. InstallaTomcatcontainer.

a. ThisTomcatcontainerinstancewillhosttheOpenClinicacaCORESDKapplication.

b. ThelocationofthisTomcatinstancewillbereferredtoas$CACORE_SDK_CATALINA_HOMEinthisdocument.

c. Instructionsforinstallinganon‐secureTomcatcontainerviathecaGridinstallercanbefoundat:http://wiki.cagrid.org/display/caGrid12/caGrid+Installer+User%27s+Guide#caGridInstallerUser%27sGuide‐ConfigureContainer.

3. YoumustconfigurethecaCORESDKpropertiesfiletoproperlybuildthe

application.a. Openthefile$CACORE_SDK_HOME/conf/deploy.properties.b. FindthesectionlabeledAPPLICATIONSERVERPROPERTIES.c. SetSERVER_TYPEto“other”,andsetSERVER_URLtothepathtotheTomcat

instancethatwillcontaintheapplication.Forexample,ifTomcatisrunningonlocalhostonport8081,thetwolinesinthissectionwouldreadasfollows:

SERVER_TYPE=other SERVER_URL=http://localhost:8081/${PROJECT_NAME}

Figure1.OpenClinicainformationmodel

4. FindthesectionlabeledMODELPROPERTIES,andsettheMODEL_FILEand

MODEL_FILE_TYPEvariablestomatchthepropertiesofyourmodelfile.a. Forexample,ifyourmodelXMIfileiscalledopenclinica‐model.xmiandit

wasgeneratedbyEnterpriseArchitect,thevariableswouldbesetasfollows:

MODEL_FILE=openclinica-model.xmi MODEL_FILE_TYPE=EA

Note:Themodelfilemustbestoredin$CACORE_SDK_HOME/models.

5. FindthesectionlabeledDATABASECONNECTIONPROPERTIESandmodifyittoreflectyourPostgreSQLdatabasesettings.Forexample:

# A database named “openclinica” running on localhost DB_CONNECTION_URL=jdbc:postgresql://localhost/openclinica

# Database user that owns the openclinica database DB_USERNAME=clinica

# No password needed for the clinica user to access the database DB_PASSWORD=

# JDBC PostgreSQL driver DB_DRIVER=org.postgresql.Driver

# Hibernate dialect value DB_DIALECT=org.hibernate.dialect.PostgreSQLDialect

6. NowyouarereadytobuildtheOpenClinicacaCORESDKapplication.Dosousing

Ant:

cd $CACORE_SDK_HOME ant build-system

Theresultofthisbuildprocessisafilecalledopenclinica.warin$CACORE_SDK_HOME/output/openclinica/package/webapp.CopythisfiletoyourTomcatinstance:

cp $CACORE_SDK_HOME/output/openclinica/package/webapp/openclinica.war $CACORE_SDK_CATALINA_HOME/webapps/

7. Toverifythatthebuildanddeploymentweresuccessful,navigatetotheURLofyourapplicationinaWebbrowser.

a. Usingtheexamplesettingsdefinedearlier,theURLwouldbe:http://localhost:8081/openclinica.

3.2GeneratingandDeployingtheOpenClinicaCRFDataServiceTheOpenClinicaCRFdataserviceisgeneratedusingthecaGridIntroducetoolkit.Tobegin,navigateto$CAGRID_LOCATIONandloadIntroduce.

cd $CAGRID_LOCATION ant introduce

WhenthemainIntroducescreencomesup,clickCreatecaGridServiceSkeleton.

ThiswillstartthecaGridServiceSkeletoncreationwizard.Thefirstwindowasksyoutodefinetheservice;thereare4stepstodoingso:

Step1:Selectadirectorytoyourservice.Thiscanbewhateveryoulike.Step2:Nameyourservice.Itshouldbenamed:OpenClinicaCRF.Step3:SpecifyaJavapackageforthegeneratedcode.Thiscanalsobewhateveryoulike,butsomethinglikeorg.cvrgrid.openclinicacrfworkswell.Step4:SpecifythenamespacefortheWSDL.Thisfieldisautomaticallyfilledinbasedontheprevioussteps.

Under“CustomizetheService”,selectDataService.ClickCreate.Sincethisisadataservice,theDataServiceConfigurationwizardappears.ItfirstasksyouselectaServiceStyle.Select“caCORESDKv4.0”andclickOK.ThiswillstarttheCreatecaCORESDKBackendcaGridDataServicewizard.Thefirstwindowwilldisplayadescriptionofthewizard.Click“Next:Configuration”.Intheconfigurationstep,selectSimpleandclickBrowsetoselecttheSDKOutputDirectory.Inthefilechooserdialog,navigateintothecaCORESDKdirectoryandselecttheoutputdirectory.Thiswillautomaticallyfillinseveralotherfields.

FortheAPI,selectRemoteAPI.ThiswillrequireyoutoenterthehostnameandportofwhereyoudeployedtheOpenClinicacaCOREapplicationto.

Note:Thehostnamemustbeginwith“http://”.ThenextwindowallowsyoutospecifywhetherornotthecaCORESDKapplicationusessecurity.Leavethe“UseSecurity”boxunchecked.Step4istospecifythedomainmodel.Selectthe“DomainModelFromFile”option,thenclicktheBrowsebuttontoselectthedomainmodelfile.Inthefileselectiondialog,navigatetotheOpenClinicadomainmodelXMIfile.

Note:BesuretochangethefileselectionfiltertoXMLMetadataInterchangeFiles(*.xmi).

ThisbringsuptheGenerateDomainModelwindow,withtheXMIFilefieldprefilled.ForXMIType,selectSDK4.0XMIfromEA.ForProjectShortNameandProjectVersion,enterOpenClinicaCRFand1.0,respectively,andclickOK.

OncecontrolreturnstotheDomainModelSelectionwindow,clickNext:Schemas.InthePackagetoSchemaMappingwindow,clickMapFromConfig,thenclickDone.Introducewillnowcompletethecreationprocessoftheservice.

TheModifyServiceInterfaceappears.

3.3SecuringtheServiceSelecttheServicestab.SelectOpenClinicaCRF(MainService).

ClickModifyService.TheModifyServiceContextwindowcomesup.

WithintheSecureCommunicationtab,underSecurityConfiguration,selecttheCustomradiobuttonthenchecktheTransportLayerSecuritybox(leavetheSecureConversationandSecureMessageboxesunchecked).LeavetheTLSCommunicationMethodsettoPrivacy.Next,selecttheAuthorizationtab.KeepAnonymousClientssettoNo,butsetAuthorizationMechanismtoGridGrouper.Atwo‐paneinterfacenowappears.

IntheGridGrouperBrowserpane,clickLoad.Thiswillloadtheavailablegroupsforthetargetgrid.Findthegroupyouwanttograntserviceaccesstoandselectit.IntheGridGrouperExpressionEditorpane,selecttheANDexpression,andclicktheAddGroupbutton.ThenclickDonetoreturntotheModifyServiceInterfacewindow.ClickSavetosaveyourchanges.3.4DeployingtheServiceFromaterminal,navigatetothedirectoryoftheOpenClinicaCRFserviceyoujustcreated.Setthe$CATALINA_HOMEenvironmentvariabletothelocationofyoursecureTomcatinstancethatwillhosttheservice.(YoucanfindinstructionsforinstallingasecureTomcatcontainerusingthecaGridInstallerat:http://wiki.cagrid.org/display/caGrid12/caGrid+Installer+User%27s+Guide#caGridInstallerUser%27sGuide‐ConfigureContainer).Forexample,inbash,export CATALINA_HOME=~/tomcat-secure/jakarta-tomcat-5.0.28

RuntheAnttasktodeploytheservicetotheTomcatinstancespecifiedby$CATALINA_HOME:ant deployTomcat Theserviceisnowdeployed.YoucanverifythisbynavigatingtotheserviceURLinaWebbrowser.Forexample,ifthesecureTomcatcontainerisrunningonlocalhostonport8443,theURLwouldbe:https://localhost:8443/wsrf/services/cagrid/OpenClinicaCRF.4OpenClinicaCRFClientAPITheservicecreatedinSection3isastandardcaGriddataservice.Itprovidesthestandardqueryinterface.TheinformationmanagedbytheservicecanbequeriedusingCQLandtheOpenClinicainformationmodel.Wehavedevelopedasetofclient‐sidehelperclassesfortheimplementationoftheOpenClinicadataservicethatisdistributedwiththeCVRGsoftwarestack.ThesehelperclassesenableadevelopertoperformcommonquerieswithoutdealingwiththespecificsofCQL(althoughthisfunctionalityisstillavailable).Notethatthesehelperclassesarenotautomaticallygenerated,whenthedataserviceiscreatedasdescribedinSection3.4.1HelperClassesforNavigatingtheOpenClinicaInformationModelThefollowinghelperclassesandmethodsareincludedintheCVRGimplementationoftheOpenClinicadataservice:

‐ SubjectQueryHelpero FacilitatesnavigationoftheOpenClinicainformationmodelfroma

particularsubjecttothestudiesitisassociatedwith.o Methods

Constructor• public SubjectQueryHelper(Subject subject,

OpenClinicaCRFClient client)

o CreatesanewSubjectQueryHelperusingthegivenSubjectasthenavigationsourceandthegivenOpenClinicaCRFClientastheclienttoinvoketheservice

o Parameters subject–theSubjectthatwillserveasthe

sourceofnavigation client–theOpenClinicaCRFClientthatis

invokingtheservice

public List<Study> getStudies()

• Retrievesthestudiesassociatedwiththespecifiedsubject• Parameters:None• Return:alistofStudyobjectsassociatedwiththespecified

Subject• Throws:java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice

‐ StudyQueryHelper

o FacilitatesnavigationoftheOpenClinicainformationmodelfromaparticularstudytothesubjects,studyeventdefinitions,andcasereportformsassociatedwithit.

o Methods Constructor

• public StudyQueryHelper(Study study, OpenClinicaCRFClient client)

o CreatesanewStudyQueryHelperusingthegivenStudyasthenavigationsourceandthegivenOpenClinicaCRFClientastheclienttoinvoketheservice

o Parameters study–theStudythatwillserveasthesource

ofnavigation client–theOpenClinicaCRFClientthatis

invokingtheservice

public List<Subject> getSubjects()

• Retrievesthesubjectsbelongingtothespecifiedstudy• Parameters:None• Return:alistofSubjectobjectsassociatedwiththegiven

Study• Throws:java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice

public List<CaseReportForm> getCaseReportForms()

• Retrievesthecasereportformsrelatedtothegivenstudy• Parameters:None• Return:alistofCaseReportFormobjectsassociatedwiththe

givenStudy• Throws:java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice

public List<StudyEventDefinition> getStudyEventDefinitions()

• Retrievesthestudyeventdefinitionsthatincludethegivenstudy

• Parameters:None• Return:alistofStudyEventDefinitionobjectsassociated

withthegivenStudy• Throws:java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice

‐ StudyEventQueryHelper:FacilitatesnavigationoftheOpenClinicainformationmodelfromaparticularstudyeventtothestudyeventdefinition,casereportformversions,subjects,andstudyassociatedwithit.

o Methods Constructor

• public StudyEventQueryHelper(StudyEvent studyEvent, OpenClinicaCRFClient client)

o CreatesanewStudyEventQueryHelperusingthegivenStudyEventasthenavigationsourceandthegivenOpenClinicaCRFClientastheclienttoinvoketheservice

o Parameters studyEvent–theStudyEventthatwillserveas

thesourceofnavigation client–theOpenClinicaCRFClientthatis

invokingtheservice

public StudyEventDefinition getStudyEventDefinition()

• Retrievesthestudyeventdefinitionthatdefinesthespecifiedstudyevent

• Parameters:None• Return:theStudyEventDefinitionassociatedwiththegiven

StudyEvent• Throws:java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice

public List<CRFVersion> getCRFVersions()

• Retrievesthecasereportformversiondataassociatedwiththegivenstudyevent

• Parameters:None• Return:alistofCRFVersionobjectsassociatedwiththegiven

StudyEvent• Throws:java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice

public Subject getSubject()

• Retrievesthesubjectassociatedwiththegivenstudyevent• Parameters:None• Return:theSubjectassociatedwiththegivenStudyEvent• Throws:java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice

public Study getStudy()

• Retrievesthestudyassociatedwiththegivenstudyevent• Parameters:None• Return:theStudyassociatedwiththegivenStudyEvent• Throws:java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice

‐ StudyEventDefinitionQueryHelper:FacilitatesnavigationoftheOpenClinicainformationmodelfromaparticularstudyeventdefinitiontothestudyeventsandcasereportformsassociatedwithit.

o Methods Constructor

• public StudyEventDefinitionQueryHelper(StudyEventDefinition studyEventDefinition, OpenClinicaCRFClient client)

o CreatesanewStudyEventDefinitionQueryHelperusingthegivenstudyeventdefinitionasthenavigation

sourceandthegivenOpenClinicaCRFClientastheclienttoinvoketheservice

o Parameters studyEventDefinition–the

StudyEventDefinitionthatwillserveasthesourceofnavigation

client–theOpenClinicaCRFClientthatisinvokingtheservice

public List<StudyEvent>getStudyEvents()

• Retrievesthestudyeventsbelongingtothegivenstudyeventdefinition

• Parameters:None• Return:AlistofStudyEventobjectsassociatedwiththegiven

StudyEventDefinition• Throws:java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice

public List<CaseReportForm> getCaseReportForms()

• Retrievesthecasereportformsassociatedwithagivenstudyevent

• Parameters:None• Return:AlistofCaseReportFormobjectsassociatedwiththe

givenStudyEventDefinition• Throws:java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice

‐ CaseReportFormQueryHelper:FacilitatesnavigationoftheOpenClinicainformationmodelfromaparticularcasereportformtothestudyeventdefinitionsandcasereportformversionsassociatedwithit.

o Methods Constructor

• public CaseReportFormQueryHelper(CaseReportForm crf, OpenClinicaCRFClient client)

o CreatesanewCaseReportFormQueryHelperusingthegivenCaseReportFormasthenavigationsourceandthegivenOpenClinicaCRFClientastheclienttoinvoketheservice

o Parameters crf–theCaseReportFormthatwillserveasthe

sourceofnavigation client–theOpenClinicaCRFClientthatis

invokingtheservice

public List<StudyEventDefinition> getStudyEventDefinitions()

• Retrievesthestudyeventdefinitionsthatagivencasereportformbelongsto

• Parameters:None• Return:AlistofStudyEventDefinitionobjectsassociated

withthegivenCaseReportForm

• Throws:java.rmi.RemoteExceptionifthereisaproblemcontactingtheservice

public List<CRFVersion> getCRFVersions()

• Retrievestheversioninformationforagivencasereportform• Parameters:None• Return:AlistofCRVersionobjectsassociatedwiththegiven

CaseReportForm• Throws: java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice

‐ CRFVersionQueryHelper:FacilitatesnavigationoftheOpenClinicainformationmodelfromaparticularcasereportformversiontothecasereportform,casereportformsections,andstudyeventsassociatedwithit.

o Methods Constructor

• public CRFVersionQueryHelper(CRFVersion version, OpenClinicaCRFClient client)

o CreatesanewCRFVersionQueryHelplerusingthegivenCRFVersionasthenavigationsourceandthegivenOpenClinicaCRFClientastheclienttoinvoketheservice

o Parameters version–theCRFVersionthatwillserveasthe

sourceofnavigation client–theOpenClinicaCRFClientthatis

invokingtheservice

public List<CRFSection> getCRFSections()

• Retrievesthesectioninformationassociatedwithagivencasereportformversion

• Parameters:None• Return:alistofCRFSectionobjectsassociatedwiththegiven

CRFVersion• Throws:java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice

public CaseReportForm getCaseReportForm()

• Retrievesthecasereportformthatagivenversionbelongsto• Parameters:None• Return:theCaseReportFormassociatedwiththegiven

CRFVersion• Throws:java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice

public List<StudyEvent> getStudyEvents()

• Retrievesthestudyeventsassociatedwithagivencasereportformversion

• Parameters:None• Return:alistofStudyEventobjectsassociatedwiththegiven

CRFVersion

• Throws:java.rmi.RemoteExceptionifthereisaproblemcontactingtheservice

‐ CRFSectionQueryHelper:FacilitatesnavigationoftheOpenClinicainformationmodelfromaparticularcasereportformsectiontothecasereportformitemsandcasereportfromversionassociatedwithit.

o Methods Constructor

• public CRFSectionQueryHelper(CRFSection section, OpenClinicaCRFClient client)

o CreatesanewCRFSectionQueryHelperusingthegivenCRFSectionasthesourceofnavigationandthegivenOpenClinicaCRFClientastheclienttoinvoketheservice

o Parameters section–theCRFSectionthatwillserveasthe

sourceofnavigation client–theOpenClinicaCRFClientthatis

invokingtheservice

public List<CRFItem> getCRFItems()

• Retrievestheitemsassociatedwithagivencasereportformsection

• Parameters:None• Return:alistofCRFItemobjectsassociatedwiththegiven

CRFSection• Throws:java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice

public CRFVersion getCRFVersion()

• Retrievestheversioninformationassociatedwithagivencasereportformsection

• Parameters:None• Return:theCRFVersionassociatedwiththegivenCRFSection• Throws:java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice

‐ CRFItemQueryHelper:FacilitatesnavigationoftheOpenClinicainformationmodelfromaparticularcasereportformitemtotheitemdata,itemdatatypeandcasereportformsectionassociatedwithit.

o Methods Constructor

• public CRFItemQueryHelper(CRFItem item, OpenClinicaCRFClient client)

o CreatesanewCRFItemQueryHelperusingthegivenCRFItemasthenavigationsourceandthegivenOpenClinicaCRFClientastheclienttoinvoketheservice

o Parameters item–theCRFItemthatwillserveasthesource

ofnavigation

client–theOpenClinicaCRFClientthatisinvokingtheservice

public CRFItemDataType getCRFItemDataType()

• Retrievesthedatatypeofagivencasereportformitem• Parameters:None• Return:theCRFItemDataTypeassociatedwiththegiven

CRFItem• Throws:java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice

public List<CRFItemData> getCRFItemDatas

• Retrievesthedatavaluesforagivencasereportformitem• Parameters:None• Return:alistofCRFItemDataobjectsassociatedwiththis

CRFItem• Throws:java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice

public List<CRFSection> getCRFSections()

• Retrievesthecasereportformsectionswhereagivenitemappears

• Parameters:None• Return:alistofCRFSectionobjectsassociatedwiththegiven

CRFItem• Throws:java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice

‐ CRFItemDataQueryHelper:FacilitatesnavigationoftheOpenClinicainformationmodelfromaparticularcasereportformitemdatarecordtotheitemassociatedwithit.

o Methods Constructor

• public CRFItemDataQueryHelper(CRFItemData itemData, OpenClinicaCRFClient client)

o CreatesanewCRFItemDataQueryHelperusingthegivenCRFItemDataasthenavigationsourceandthegivenOpenClinicaCRFClientastheclientinvokingtheservice

o Parameters itemData–theCRFItemDatathatwillserveas

thesourceofnavigation client–theOpenClinicaCRFClientthatis

invokingtheservice

public CRFItem getCRFItem()

• RetrievestheCRFitemthatagivendatavaluebelongsto• Parameters:None• Return:theCRFItemassociatedwiththegivenCRFItemData• Throws:java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice

‐ CRFItemDataTypeQueryHelper:FacilitatesnavigationoftheOpenClinicadatamodelfromaparticularcasereportformitemdatatypetotheitemsassociatedwithit.

o Methods Contstructor

• public CRFItemDataTypeQueryHelper(CRFItemDataType itemDataType, OpenClinicaCRFClient client)

o CreatesanewCRFItemDataTypeQueryHelperusingthegivenCRFItemDataTypeasthenavigationsourceandthegivenOpenClinicaCRFClientastheclienttoinvoketheservice

o Parameters itemDataType–theCRFItemDataTypethatwill

serveasthesourceofnavigation client–theOpenClinicaCRFClientthatis

invokingtheservice

public List<CRFItem> getCRFItems()

• Retrievesthecasereportformitemsthatareofagivendatatype

• Parameters:None• Return:alistofCRFItemobjectsthatareofthegiven

CRFItemDataType• Throws:java.rmi.RemoteExceptionifthereisaproblem

contactingtheservice4.2ExampleQueryInthisexample,theuserwishestoretrieveallsubjectsinthedatabasewhosecasereportformscontainanitemwithacertainname(“LVEDV”).NotethataCQLquerymustbebuiltandsubmittedtoobtaintheinitiallistofCRFItemsthatwillbeiteratedthrough,butthatallnavigationbetweenobjectsinthedatamodelishandledthroughthehelperclasses.CQLQuery query = new CQLQuery(); gov.nih.nci.cagrid.cqlquery.Object target = new gov.nih.nci.cagrid.cqlquery.Object(); target.setName(org.cvrg.domain.CRFItem.class.getName()); Attribute itemNameAttr = new Attribute("name", Predicate.EQUAL_TO, "LVEDV"); target.setAttribute(itemNameAttr); query.setTarget(target); CQLQueryResults results = client.query(query); InputStream istream = OpenClinicaCRFClient.class.getResourceAsStream("client-config.wsdd"); // subjects with the requested CRFItem List<Subject> subjects = new ArrayList<Subject>(); Iterator<CRFItem> itemIter = new CQLQueryResultsIterator(results, istream); while (itemIter.hasNext()) { CRFItem item = itemIter.next(); System.out.println("Item name: " + item.getName()); CRFItemQueryHelper crfiqh = new CRFItemQueryHelper(item, client); List<CRFSection> sections = crfiqh.getCRFSections();

for (CRFSection section : sections) { System.out.println("Section ID: " + section.getId());

CRFSectionQueryHelper crfsqh = new CRFSectionQueryHelper(section, client);

CRFVersion version = crfsqh.getCRFVersion(); System.out.println("Version ID: " + version.getId());

CRFVersionQueryHelper crfvqh = new CRFVersionQueryHelper(version, client);

List<StudyEvent> studyEvents = crfvqh.getStudyEvents(); System.out.println("# Study events: " + studyEvents.size()); for (StudyEvent studyEvent : studyEvents) { System.out.println("StudyEvent ID: " + studyEvent.getId());

StudyEventQueryHelper seqh = new StudyEventQueryHelper(studyEvent, client); System.out.println("\tStudy ID: " + seqh.getStudy().getId()); System.out.println("\tSubject ID: " + seqh.getSubject().getId());

} } }