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.

Create Directories

  • Within your local dev machine enlistment, go to the <LK_ENLISTMENT>/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 Class: org.labkey.api.module.SimpleModule
Name: FileBasedDemo

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.

Tutorial Steps

Start Over | Next Step (2 of 5)

Was this content helpful?

Log in or register an account to provide feedback

expand allcollapse all