To begin this tutorial
, we install a target set of data to work with and create the skeleton of our file-based module, the three empty directories:
- queries: Holds SQL queries and grid views.
- reports: Holds R reports.
- views: Holds files to back user interface elements.
Set Up a Dev Machine
Complete the topic below. This will set up your local machine to be able to build LabKey Server from source. While not strictly required for editing file based module resources, this is a typical way a developer might work on custom elements.
Install Example Study
On your server, install the example research study in a new folder following the instructions in this topic. The examples in this tutorial use the datasets and columns it contains, though you can make adjustments as required to suit other structures, including those unrelated to study tools.
- Within your local dev machine enlistment, i.e. under LABKEY_HOME, go to the build/deploy/externalModules/ directory (create it if it doesn't exist), and create the following directory structure and files with these names and extensions:
- Add the following contents to module.properties:
Module Class: org.labkey.api.module.SimpleModule
Note: This module is being created within the built deployment for simplicity. You can start and stop the built server without losing the module you are working on. However, make sure to copy your module folder tree to a location outside the build directory before you run "gradlew cleanBuild" or "gradlew cleanDeploy". If you clean and rebuild ("gradlew deployApp") without first copying your module folder to a more permanent location you will lose your work in progress.
Enable Your Module in a Folder
To use a module, enable it in a folder.
- Go to the LabKey Server folder where you want add the module functionality. For this tutorial, go to the study folder where you installed the example study, typically "HIV Study" in the "Tutorials" project.
- Select (Admin) > Folder > Management.
- Click the Folder Type tab.
- Under the list of Modules click on the check box next to fileBasedDemo to activate it in the current folder.
- Click Update Folder.
Now when you add resources to the module, they will be available in this folder.