Package 'harmonydata'

Title: R Library for 'Harmony'
Description: 'Harmony' is a tool using AI which allows you to compare items from questionnaires and identify similar content. You can try 'Harmony' at <https://harmonydata.ac.uk/app/> and you can read our blog at <https://harmonydata.ac.uk/blog/> or at <https://fastdatascience.com/how-does-harmony-work/>. Documentation at <https://harmonydata.ac.uk/harmony-r-released/>.
Authors: Omar Hassoun [aut, cre], Thomas Wood [ctb], Ulster University [cph]
Maintainer: Omar Hassoun <[email protected]>
License: MIT + file LICENSE
Version: 0.1.1
Built: 2025-02-10 02:57:47 UTC
Source: https://github.com/cran/harmonydata

Help Index


Retrieve Example Instruments from 'Harmony Data API'

Description

This function retrieves example instruments from the 'Harmony Data API' using an HTTP POST request.

Usage

get_example_instruments()

Value

A list representing example instruments retrieved from the 'Harmony Data API'.

Author(s)

Ulster University [cph]

Examples

# Load required libraries (httr) and call the function
require(httr)
instruments <- get_example_instruments()

# Print the retrieved JSON content
print(instruments)

Load Instruments from File

Description

This function loads instruments from a file specified by the path parameter and sends the file content to an API for further processing. It also accepts a URL leading to a file.

Usage

load_instruments_from_file(path)

Arguments

path

The path to the file to load instruments from.

Value

A list of instruments returned from the API.

Author(s)

Ulster University [cph]

Examples

# Load instruments from a PDF file
pdf_file <- "https://www.apa.org/depression-guideline/patient-health-questionnaire.pdf"
response <- load_instruments_from_file(pdf_file)

Match Instruments Function

Description

This function takes a list of instruments, converts it to a format acceptable by the database, and matches the instruments using the 'Harmony Data API'. It returns the matched instruments.

Usage

match_instruments(instruments)

Arguments

instruments

A list of instruments to be matched.

Value

A list of matched instruments returned from the 'Harmony Data API'.

Author(s)

Ulster University [cph]

References

For more information about the 'Harmony Data API', visit: https://api.harmonydata.org/docs

Examples

instruments_list <- list(
  list(
    instrument_id = "id1",
    instrument_name = "Instrument A",
    questions = list(
      list(
        question_text = "How old are you?",
        topics = c("Age", "Demographics"),
        source_page = "https://example.com/instrumentA"
      ),
      list(
        question_text = "What is your gender?",
        topics = c("Gender", "Demographics"),
        source_page = "https://example.com/instrumentA"
      )
    )
  ),
  list(
    instrument_id = "id2",
    instrument_name = "Instrument B",
    questions = list(
      list(
        question_text = "Do you smoke?",
        topics = c("Smoking", "Health"),
        source_page = "https://example.com/instrumentB"
      )
    )
  )
)
matched_instruments <- match_instruments(instruments_list)