tofhir-redcap is the toFHIR REDCap integration module. It provides an endpoint which can be set in Data Entry Trigger of a REDCap application. When the endpoint receives the notification for a record, it exports its details via REDCap API and publishes it to Kafka which can be utilized to index REDCap record to an onFhir server.
The project requires the followings to run:
- Java 11
- Scala 2.13
- Maven
In the root directory, run the following command to generate an executable jar which includes all dependencies:
mvn clean install
Run the jar
java -jar target/tofhir-redcap-1.0-SNAPSHOT.jar
Alternatively, you can run Boot.scala in your chosen IDE, e.g. IntelliJ
Third option is to run it in Docker. After you build the project, go to docker directory and run docker-compose.yml:
docker-compose up
The project starts a server providing an endpoint to handle REDCap notifications. Then, Data Entry Trigger of a REDCap can be configured to send notification to http://localhost:8095/tofhir-redcap/notification endpoint (if you use default configurations).
Whenever this endpoint receives a notification about a record, it exports its data via REDCap API and publishes record data to a Kafka topic which is the concatenation of project id and instrument name such as '27-patient'.
Please see application.conf for the configurations. It allows you to configure Web server settings, Kafka and REDCap projects.
Here is the list of available configurations:
Config | Description | Default Value |
webserver.host | Hostname that toFHIR-REDCap server will work. Using 0.0.0.0 will bind the server to both localhost and the IP of the server that you deploy it. | 0.0.0.0 |
webserver.port | Port to listen | 8095 |
webserver.base-uri | Base Uri for server e.g. With this default configuration, the root path of toFHIR REDCap server will be http://localhost:8095/tofhir-redcap | tofhir-redcap |
webserver.ssl.keystore | Path to the java keystore for enabling ssl for toFHIR server, use null to disable ssl | null |
webserver.ssl.password | Password of the keystore for enabling ssl for toFHIR server | null |
kafka.bootstrap-servers | Kafka servers separated by comma | localhost:9092 |
redcap.url | REDCap API url | http://localhost:3000 |
redcap.publishRecordsAtStartup | Flag to export REDCap records and publish them to Kafka at the startup of server. Only records from the configured projects will be exported. Existing data in the Kafka topics will be deleted before publishing new records to avoid duplication. | false |
redcap.projects.filePath | Path to the file where the configuration of REDCap projects are read. Each project configuration should include the project id and API token. For example:
[
{
id = "<PROJECT_ID>"
token = "<PROJECT_TOKEN>"
}
] |
redcap-projects.json |