REDCap External Module Development Guide v1.3.1
These instructions describe how to set up a development environment that works on both Mac OSX, Windows, and Linux computers. While this version presents some issues for Windows computers, future versions should address that shortcoming through the use of git-bash
.
This is a short list to get started, links to the required software are presented in the next section
These tools are recommended for those with no experience in software development, if you already know what you're doing, feel free to substitute your preferred tool where applicable (e.g. a different editor).
.zip
file - Ask your local REDCap Admin for a recent REDCap Zip file downloaded from the REDCap Community. The REDCap Zip files have names like redcap10.3.3.zip
where '10.3.3' is the REDCap version number. If you are that REDCap Admin and have access to the community, the download link is https://community.projectredcap.org/page/download.html. Please be generous with access to the resources your employees and customers need to learn and develop for REDCap while reminding them of the need to not redistribute REDCap software outside the entity that has licensed it.redcap-docker-compose
directory in your editor
.env
in the rdc
directory (note that in Windows you can not simply double click the .env
file to open it)TZ=America/Chicago
DOCKER_PREFIX=redcap
WEB_PORT=11033
MYSQL_PORT=21033
PHPMYADMIN_PORT=31033
MAILHOG_PORT=41033
You'll need a terminal that's in the redcap-docker-compose
directory to start the Docker containers
If you used VSCode or another IDE with an integrated terminal for the previous steps, you already have a terminal attached and in the desired directory
If you did not use VSCode, open a terminal or git-bash session and cd to the redcap-docker-compose
directory
redcap-docker-compose
folder with the shortcut <ctrl>`Change directories into the rdc
folder with the command cd rdc
In the terminal start the containers with this command docker-compose up -d
Your Docker containers are now downloading required software and initializing. This step will take some time, especially on the first run.
Sometimes things are weird, and you'll have to rebuild from scratch. To do that, you'll need to open a terminal to the redcap-docker-compose
folder and issue these commands:
# Preserve your modules folder because it might have stuff worth preserving
cp -r www/modules .
# The installer will get confused if any part of your old installation exists
rm -rf www
rm -rf logs
# You have to be in the right folder for docker-compose to find its config files
cd rdc
# Destroy the containers and their volumes
docker-compose down -v
# Rebuild the containers and volumes from scratch
docker-compose up -d
If it fails again, you'll need to dig deeper to find out why. It's probably just a small thing, but knowing which small thing is hard to anticipate. Sorry about that.
Now that you have a working local instance of REDCap, you'll want to get familiar with the tools available to a REDCap administrator in EMD-102: A Tour Through REDCap as an Admin before moving on to the training exercises in REDCap External Module Development for Developers.
VSCode can show you syntax errors as you type them if you add an extension. Add the PHP Intellisense extension to VS Code to get this functionality. On Mac access Code > Preferences > Extensions and type "PHP". You'll see PHP Intellisense in the list. Install it.
Open some PHP code, delete a semicolon or a comma and watch for the wiggly red lines under the text. Hover on one next to the text you just changed and consider what the editor is telling you.
These instructions were adapted from a REDCap Development Class presented at the University of Arkansas Medical School in February 2020. The original document is located here.