Courses - How to add sample data to the Courses app in Reference Environments

It is really helpful to be able to add sample data to the Courses app to show in the reference environment, especially as terms "age" out and you want to ensure that new terms and courses are added.

The good news is that creating sample data is not that difficult. It does require a little work in Github, but you do not need to write code. This page assumes that you are using Github via the web interface since that is generally the most user-friendly approach, but you can also use other pathways to manage repositories and commit files

Step 1: Open a Jira

This will allow whatever dev team is maintaining mod-courses to manage the work they need to do. Open a ticket in the MODCR project in Jira and title it something like "Adding new sample data on reference environments."

Step 2: Log into Github and create a fork of the mod-courses repository.

Create a fork of https://github.com/folio-org/mod-courses in your Github account. You will create the new sample data in your fork, and then create a pull request to merge the sample data into production.

Step 3: Create new sample data in your fork of mod-courses

Sample data lives in mod-courses in src/main/resources/sample-data

Here, you want to add your sample data to your forked repository. The easiest way to generate the sample data is to go to a current reference environment and create the sample data there, and then use developer tools (Intro to Developer Tools in Google Chrome) to get the json that you need.

For example, suppose you wanted to add a new term for Fall 2024. This is how you could do it:

  1. Go to https://folio-snapshot.dev.folio.org and go to Settings > Courses > Terms.
  2. Open Developer Tools (see Intro to Developer Tools in Google Chrome for more help with developer tools.)
  3. Select the New button and create the term for Fall 2024. 
  4. When you save the term, in Developer Tools on the Network panel, you should see the API call that FOLIO sends to create the term
  5. In the Response tab, you'll see the JSON that was created when you added the term. This is the thing that you want to copy out and use in Github.
  6. Copy the term and in your forked copy of github, create a new file in the Terms folder called 'Term009.json' (or whatever the next number is in that folder.) Paste in the JSON from the term you just created, and save the file.

Step 4: Create a pull request with your new files

Once you've added all of the new sample data you want to add, you'll create a pull request back to the parent copy of mod-courses.

There are various ways to create a pull request, but the important thing is to make sure the title includes the Jira number from step 1. E.g., if you created a Jira in step 1 and the number was MODCR-1001, then the PR title would be something like 'MODCR-1001 Add new sample data to the Courses app'

Adding the title at the start of the PR lets it be linked to the Jira in the Development accordion, so that when the Jira is opened you can jump straight to the associated github  work.

Step 5: Coordinate with the development team to merge the PR and release the change

After your PR is open, reach out to the product owner for the development team via Jira or Slack and ask them to bring the Jira into their workflows so that it can be worked on. Once the development team creates a release that includes your new files, you will begin to see them appear on Snapshot with the next reference environment build.