17.6 Bulk create and update study events

The bulk study event endpoint is used to create or update multiple study events for a list of participant IDs.

The functionality, stipulations and access control for this endpoint is the same as per the single create and update study event endpoint. 

The user must be authenticated prior to calling this service. The operation is allowed based on the user's privileges.

URL:

POST {serverName}/pages/auth/api/clinicaldata/studies/{studyOID}/sites/{siteOID}/events/bulk

where {serverName} is your study URL. For example: https: //studyxyz.eu.openclinica.io/OpenClinica

Sample cURL Request: 

curl -X POST \
  {{serverName}}/pages/auth/api/clinicaldata/studies/S_JUNO%28PROD%29/sites/S_BOSTON_3152%28PROD/events/bulk \
  -H 'Authorization: bearer {{authentication token}} 
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -F 'file=@C:\directory\file.csv'

Request Parameters:

This endpoint requires a CSV file with list of Participant IDs, and the Study Event related information. The CSV file must adhere to the following:

  • File must have ONE column with header as 'ParticipantID'. This column must contain the Participant ID.
  • File must have a column for StudyEventOID
  • The following additional columns are required based on the action to be performed on the given StudyEventOID:
    • To Create a new Study Event
      • StudyEventRepeatKey must be EMPTY
      • StartDate must be present
      • EndDate is optional
      • StudyEventStatus is not used
    • To Update the Study Event
      • StudyEventRepeatKey must be present and a valid integer
      • StartDate is optional
      • EndDate is optional
      • StudyEventStatus is optional
  • File columns can be in any order.
  • Below are the restrictions on the values in these columns:
    • ParticipantID and StudyEventOID must be valid identifiers under the given study site
    • StudyEventRepeatKey must be an integer value
    • StartDate and EndDate must be in 'yyyy-MM-dd' format
    • StudyEventStatus may include the values: 'data entry started', 'stopped', 'skipped', 'locked' and 'completed'.

Here's a sample CSV file for creating study event and modifying the study events for the given participants.

Response body on Success:

Endpoint will submit the job in the background and will return the unique job uuid.

job uuid: ddbadff4-f015-4a2d-81e0-e3daf507bbfc

Response body on Failure to submit the job:

{
  "message": "errorCode.siteNotExist",
  "params": {
    "siteOid": "S_OHIO(PRD)",
    "studyOid": "S_JUNO(PROD)"
  }
}

Below is the list of error codes with their descriptions:

  • errorCode.studyNotExist: The Study OID specified in the request is not found.
  • errorCode.siteNotExist: The Site OID specified in the request is not found.
  • errorCode.notSupportedFileFormat: The file format is not supported. Only CSV files are accepted.
  • errorCode.noRoleSetUp: The user has no role assigned for the given Study/Site.
  • errorCode.noSufficientPrivileges: The user does not have sufficient privileges to perform this operation.

Once the job has completed you can access the job's log file in the OpenClinica UI via Tasks > Bulk Actions Log

In case of in processing any particular record in the file, an appropriate errorCode will be returned for that record within the logfile. Here is the list of possible errorCodes with definitions:

  • errorCode.participantNotFound: No participant record was found for the given Participant ID value.
  • errorCode.missingParticipantID: Participant ID value is missing in the record.
  • errorCode.missingStudyEventOID: Study event OID value is missing in the record.
  • errorCode.invalidStudyEventOID: Study event OID value in the record is not a valid study event OID.
  • errorCode.CommonEventCannotBeScheduled: Study event OID in the record is a common event and hence cannot be scheduled.
  • errorCode.missingStartDate: Start date is missing and therefore study event cannot be scheduled.
  • errorCode.invalidStartDate: Start date in the record is invalid.
  • errorCode.endDateBeforeStartDate: End date is before the start date.
  • errorCode.invalidEndDate: End date in the record is invalid.
  • errorCode.studyEventRepeatNotFound: Study event repeat key in the record is not found for the given participant.
  • errorCode.invalidEventStatus: Status in the record is not a valid status.
  • errorCode.invalidEventTransitionStatus: When the study event transition status from the current status of the given study event repeat to the status provided in the record is not allowed.

 

 


Functional approval by rbhatnagar. Signed on 2019-08-01 11:08PM

Approved for publication by Benjamin Baumann (bbaumann), Principal. Signed on 2019-08-02 3:44PM

Not valid unless obtained from the OpenClinica document management system on the day of use.