REDCap External Module Development Guide v1.3.1
These instructions were written for a REDCap Development Class presented at the University of Arkansas Medical School in February 2020. They describe how to set up a development environment that works on both Mac OSX and Windows computers. While this version presents some issues for Windows computers, future versions should address that shortcoming through the use of git-bash
.
These notes are the first step towards a revision to the external module development guide that will provide separate instructional modules for software setup, software concepts, and development exercises all centered around developing modules for REDCap.
redcap9.3.5.zip
downloaded from the REDCap Community. 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.123andy/redcap-docker-compose
(i.e., https://github.com/123andy/redcap-docker-compose)redcap-docker-compose
in VS Code.env
TZ=America/Chicago
DOCKER_PREFIX=redcap
WEB_PORT=1935
MYSQL_PORT=2935
PHPMYADMIN_PORT=3935
MAILHOG_PORT=4935
redcap-docker-compose
folder with the keystroke <ctrl>```rdc
folder with the command cd rdc
docker-compose up -d
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 REDCap system of your own, play with it. Know that you can only hurt yourself at this point. In the worst-case scenario, you can rebuild from scratch. Yet know that no one is protecting your work on this personal REDCap except you. Don't do any work you aren't willing to lose.
Here are some things you might try:
ctsit/redcap_external_module_development_guide
(Go to File > Clone Repository, then paste ctsit/redcap_external_module_development_guide
in the "github.com" tab).exercises/
folder to folder redcap-docker-compose/www/modules/
. Don't copy the exercises
folder; copy its contents. These files should be inside the redcap-docker-compose/www/modules/
folderaccessing_variables
hello_world_v0.0.0
intro_to_hooks
intro_to_js
intro_to_plugins
intro_to_queries
README.md
record_wrangling
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.