We have developed the R package for Harmony and open sourced it. To get started, you need R installed on your system.
Click here to try an example in Google Colab.
Here’s a Jupyter Notebook with an example using Harmony in R
We are currently submitting the R library to CRAN.
In the meantime, you can install the development version of harmonydata from GitHub (documentation in the README file):
You also need devtools
which will already be there if you are using R Studio. If not, you can install devtools
with the following command in the R console:
install.packages("devtools") # If you don't have devtools installed already.
Next, to install Harmony, run:
library(devtools)
devtools::install_github("harmonydata/harmony_r")
Let’s import Harmony and harmonise an instrument.
If you want to read in a raw (unstructured) PDF or Excel file, you can do this via a POST request to the REST API. This will convert the file into an Instrument object in JSON.It returns the instrument as a list.
library(harmonydata)
instrument = load_instruments_from_file(path = "examples/GAD-7.pdf")
names(instrument[[1]])
#> [1] "file_id" "instrument_id" "instrument_name" "file_name"
#> [5] "file_type" "file_section" "study" "sweep"
#> [9] "metadata" "language" "questions"
You can also input a url containing the questionnaire.
instrument_2 = load_instruments_from_file("https://medfam.umontreal.ca/wp-content/uploads/sites/16/GAD-7-fran%C3%A7ais.pdf")
names(instrument_2[[1]])
#> [1] "file_id" "instrument_id" "instrument_name" "file_name"
#> [5] "file_type" "file_section" "study" "sweep"
#> [9] "metadata" "language" "questions"
You can get a list containing the results of the match.Here we can see a list of similarity score for each question comapred to all the other questions in th other questionaire.
instruments = append(instrument, instrument_2)
match = match_instruments(instruments)
names(match)
#> [1] "questions" "matches" "query_similarity"
[Beta mode: we are currently testing this extension] We have developed a browser extension for Harmony called “Send to Harmony” which lets you send selected text to Harmony with a right-click. For PDFs, use the popup to paste your selected text. Send to Harmony enables users to send selected text to the Harmony Data Harmonization (https://harmonydata.ac.uk/) platform for analysis. This plugin provides a right-click or context menu item which allows users to easily bring text from into their harmonisations, making it easier to compare and analyze different measurement scales across research studies.
We have a number of exciting updates to Harmony including: some improvements to the R library which have been asked for by researchers around the world who have been using Harmony on studies in lots of different topics as well as making our own fine tuned large language model available in the web UI, which is José’s winning model from the DOXA challenge which ended on 10 January 2025. Harmony has its own Large Language Model!