npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@datafire/opentrials_local

v3.0.0

Published

DataFire integration for OpenTrials API

Readme

@datafire/opentrials_local

Client library for OpenTrials API

Installation and Usage

npm install --save @datafire/opentrials_local
let opentrials_local = require('@datafire/opentrials_local').create();

.then(data => {
  console.log(data);
});

Description

Actions

getCondition

Returns condition details

opentrials_local.getCondition({
  "id": ""
}, context)

Input

  • input object
    • id required string: ID of the condition

Output

listDocumentCategories

Returns document categories

opentrials_local.listDocumentCategories(null, context)

Input

This action has no parameters

Output

listDocuments

Returns documents

opentrials_local.listDocuments({}, context)

Input

  • input object
    • page integer: The page number
    • per_page integer: Number of items per page

Output

getDocument

Returns details of a document

opentrials_local.getDocument({
  "id": ""
}, context)

Input

  • input object
    • id required string: ID of the document

Output

listFDAApplications

Returns FDA applications

opentrials_local.listFDAApplications({}, context)

Input

  • input object
    • page integer: The page number
    • per_page integer: Number of items per page

Output

getFDAApplication

Returns an FDA application details

opentrials_local.getFDAApplication({
  "id": ""
}, context)

Input

  • input object
    • id required string: ID of the FDA application

Output

getIntervention

Returns intervention details

opentrials_local.getIntervention({
  "id": ""
}, context)

Input

  • input object
    • id required string: ID of the intervention

Output

getOrganisation

Returns organisation details

opentrials_local.getOrganisation({
  "id": ""
}, context)

Input

  • input object
    • id required string: ID of the organisation

Output

getPerson

Returns person details

opentrials_local.getPerson({
  "id": ""
}, context)

Input

  • input object
    • id required string: ID of the person

Output

getPublication

Returns publication details

opentrials_local.getPublication({
  "id": ""
}, context)

Input

  • input object
    • id required string: ID of the publication

Output

searchTrials

Returns trials based on a search query. By default, it'll search in all of a trial's attributes.

  • q is a ElasticSearch query string (e.g. public_title:(depressive OR depression))
  • page can take a value between 1 and 100
  • per_page can take a value between 10 and 100
opentrials_local.searchTrials({}, context)

Input

  • input object
    • q string: The search query (follows the ElasticSearch Query String syntax)
    • page integer: The page number
    • per_page integer: Number of items per page

Output

autocomplete

Autocomplete search feature for supported database entities (location). It has the same options as a regular search operation, with an extra required in parameter indicating the entity type to search.

opentrials_local.autocomplete({
  "in": ""
}, context)

Input

  • input object
    • in required string (values: location): The entity to search for
    • q string: The search query
    • page integer: The page number
    • per_page integer: Number of items per page

Output

searchFDADocuments

Search the FDA documents

opentrials_local.searchFDADocuments({}, context)

Input

Output

list

Returns list of sources

opentrials_local.list(null, context)

Input

This action has no parameters

Output

getTrial

Returns a trial's details and related entities (e.g. conditions).

opentrials_local.getTrial({
  "id": ""
}, context)

Input

  • input object
    • id required string: ID of the trial

Output

getRecords

Returns a trial's raw records from its sources

opentrials_local.getRecords({
  "id": ""
}, context)

Input

  • input object
    • id required string: ID of the trial

Output

getRecord

Returns a trial's raw record from its sources

opentrials_local.getRecord({
  "trialId": "",
  "id": ""
}, context)

Input

  • input object
    • trialId required string: ID of the trial
    • id required string: ID of the trial's record

Output

Definitions

AutocompleteResult

  • AutocompleteResult object
    • id required string
    • name required string

AutocompleteResults

  • AutocompleteResults object

Condition

  • Condition object
    • id required string: ID of the condition
    • name required string: Name of the condition
    • url required string: OpenTrials API URL of the condition

Discrepancies

DiscrepancyFieldBase

  • DiscrepancyFieldBase object
    • record_id required string
    • source_name required string

DiscrepantFieldBoolean

  • DiscrepantFieldBoolean object
    • record_id required string
    • source_name required string
    • value boolean

DiscrepantFieldInteger

  • DiscrepantFieldInteger object
    • record_id required string
    • source_name required string
    • value integer

DiscrepantFieldString

  • DiscrepantFieldString object
    • record_id required string
    • source_name required string
    • value string

Document

  • Document object
    • document_category required DocumentCategory
    • fda_application FDAApplication
    • file File
    • id required string: ID of the document
    • name required string
    • source Source
    • source_url string: URL of origin for this document
    • trials array
    • url required string: OpenTrials API URL of the document

DocumentCategory

  • DocumentCategory object
    • group string: Name of document category
    • id required integer
    • name required string: Name of document sub-category

DocumentCategoryList

  • DocumentCategoryList object

DocumentList

  • DocumentList object

DocumentSummary

  • DocumentSummary object
    • document_category required DocumentCategory
    • fda_application FDAApplication
    • file FileSummary
    • id required string
    • name required string
    • source_id string: ID of the document's source
    • source_url string: URL of origin for this document
    • trials array
    • url required string: OpenTrials API URL of the document

ErrorResponse

  • ErrorResponse object
    • message required string

FDAApplication

  • FDAApplication object
    • active_ingredients string: Active ingredients contained in the drug
    • drug_name string: Name of the drug
    • fda_approvals array: Associated FDA approvals
    • id required string: FDA application ID
    • organisation Organisation
    • type string: The FDA application type (e.g. "NDA", "ANDA", etc.)
    • url required string: OpenTrials API URL for this FDA application

FDAApplicationList

  • FDAApplicationList object

FDAApproval

  • FDAApproval object
    • action_date required string
    • fda_application FDAApplication
    • id required string: FDA approval ID
    • notes string: Additional information about the FDA approval
    • supplement_number required integer
    • type required string: Type of FDA approval

FDADocumentSearchResult

  • FDADocumentSearchResult
    • document_category required DocumentCategory
    • fda_application FDAApplication
    • file FileSummary
    • id required string
    • name required string
    • source_id string: ID of the document's source
    • source_url string: URL of origin for this document
    • trials array
    • url required string: OpenTrials API URL of the document
    • file File

FDADocumentSearchResults

File

  • File object
    • documentcloud_id string
    • id string: ID of the file
    • sha1 string
    • source_url string: URL of origin for this file
    • pages array: Array with text of each of the file's pages
      • items object
        • num required integer: Page number
        • text required string

FileSummary

  • FileSummary object
    • documentcloud_id string
    • id string: ID of the file
    • sha1 string
    • source_url string: URL of origin for this file

Intervention

  • Intervention object
    • id required string: ID of the intervention
    • name required string: Name of the intervention
    • type string (values: drug, procedure, other): Type of the intervention (drug / other)
    • url required string: OpenTrials API URL of the intervention

Location

  • Location object
    • id required string: ID of the location
    • name required string: Name of the location
    • type string (values: country, city, other): Type of the location (country / city / other)

Organisation

  • Organisation object
    • id required string: ID of the organisation
    • name required string: Name of the organisation
    • url required string: OpenTrials API URL of the organisation

Person

  • Person object
    • id required string: ID of the person
    • name required string: Name of the person
    • url required string: OpenTrials API URL of the person

Publication

  • Publication object
    • abstract required string
    • authors array
      • items string
    • created_at string
    • date string
    • id required string: ID of the publication
    • journal string
    • slug string
    • source required Source
    • source_url required string
    • title required string
    • updated_at string
    • url required string

PublicationSummary

  • PublicationSummary object
    • id required string
    • source_id required string
    • source_url required string
    • title required string
    • url required string

Record

  • Record object
    • created_at required string: Date when the record was created
    • id required string: ID of the record
    • identifiers object: Object that maps the trial's sources ids with its identifiers.
    • is_primary boolean: Is this record the primary source of data for its trial
    • last_verification_date string: Date when the record's data was last verified by provider
    • public_title required string: Title of the record
    • recruitment_status string (values: recruiting, not_recruiting, unknown, other): Trial's recruitment status (e.g. recruiting, unknown etc.)
    • source required Source
    • source_id string: ID of the record's source
    • source_url required string: URL of the record's source (where it was collected from)
    • status string (values: ongoing, withdrawn, suspended, terminated, complete, unknown, other): Trial's status (e.g. ongoing, withdrawn, complete etc.)
    • trial_id required string: ID of the trial referenced in the record
    • trial_url required string: OpenTrials API URL of the trial referenced in the record
    • updated_at required string: Date when the record was updated
    • url required string: OpenTrials API URL of the record

RecordList

RecordSummary

  • RecordSummary object
    • id required string
    • is_primary boolean
    • last_verification_date string
    • source_id required string
    • url required string

RiskOfBias

  • RiskOfBias object
    • id required string
    • risk_of_bias_criteria array
    • source_id required string
    • source_url required string
    • study_id required string

RiskOfBiasCriteria

  • RiskOfBiasCriteria object
    • id required string
    • name required string
    • value required string (values: yes, no, unknown)

Source

  • Source object
    • id required string
    • name required string
    • source_url string: URL to source's website
    • terms_and_conditions_url string
    • type string (values: register, journal, other)

SourceList

Trial

  • Trial object
    • age_range object
      • max_age string: Maximum participant age (e.g. "12 Years", "1 Month", "15 Days"). If unknown, it's undefined. If no limit, it's "any". If not applicable, it's "N/A".
      • min_age string: Minimum participant age (e.g. "12 Years", "1 Month", "15 Days"). If unknown, it's undefined. If no limit, it's "any". If not applicable, it's "N/A".
    • brief_summary string: Summary of the trial
    • completion_date string: Date the trial was completed
    • conditions array: Conditions the trial refers to
    • discrepancies object: Discrepancies in trial's details between different sources
    • documents array: Documents related to the trial
    • gender string (values: both, male, female): Gender of the subjects of the trial
    • has_published_results boolean: Trial has its results published (true/false)
    • id required string: ID of the trial
    • identifiers object: Object that maps the trial's sources ids with its identifiers.
    • interventions required array: Interventions related to the trial
    • locations required array: Locations related to the trial
    • organisations required array: Organisations related to the trial
    • persons required array: People related to the trial
    • public_title required string: Title of the trial
    • publications required array: Publications referring the trial
    • records required array: (published) records of the trial
    • recruitment_status string (values: recruiting, not_recruiting, unknown, other): Recruitment status of the trial
    • registration_date string: Date the trial was registered
    • results_exemption_date string: Date when a certification of exemption has been filed for the trial
    • risks_of_bias required array
    • source_id string: ID of the trial's source
    • sources required object
    • status string (values: ongoing, withdrawn, suspended, terminated, complete, unknown, other): Completion status of the trial
    • study_phase array: Phases of the study (e.g. ["Phase 2"] or ["Phase 1", "Phase 2"])
      • items string
    • target_sample_size integer: Target sample size for the trial
    • url required string: Source URL (where the trial was collected from)

TrialLocation

  • TrialLocation object: Location of a trial
    • id required string: ID of the location
    • name required string: Name of the location
    • type string (values: country, city, other): Type of the location (country / city / other)
    • role string (values: recruitment_countries, other)

TrialOrganisation

  • TrialOrganisation object
    • id required string: ID of the organisation
    • name required string: Name of the organisation
    • url required string: OpenTrials API URL of the organisation
    • role string (values: primary_sponsor, sponsor, funder, other)

TrialPerson

  • TrialPerson object: People related to a trial
    • id required string: ID of the person
    • name required string: Name of the person
    • url required string: OpenTrials API URL of the person
    • role string (values: principal_investigator, public_queries, scientific_queries, other)

TrialSearchResults

  • TrialSearchResults object
    • items required array
    • total_count required integer

TrialSummary

  • TrialSummary object
    • id required string: ID of the trial
    • public_title required string: Title of the record
    • url required string: OpenTrials API URL for this trial