Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added pagination #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 14 additions & 35 deletions docs.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
## Classes

<dl>
<dt><a href="#ClinicalTrial">ClinicalTrial</a></dt>
<dd><p>Clinical trials</p>
</dd>
</dl>

## Typedefs

<dl>
<dt><a href="#SearchProps">SearchProps</a> : <code>object</code></dt>
<dd></dd>
</dl>

<a name="ClinicalTrial"></a>

## ClinicalTrial
Expand All @@ -21,20 +6,29 @@ Clinical trials
**Kind**: global class

* [ClinicalTrial](#ClinicalTrial)
* [.search(props)](#ClinicalTrial.search) ⇒ <code>object</code>
* [.search(props)](#ClinicalTrial.search) ⇒ <code>Object</code>
* [.searchConditions(search_query)](#ClinicalTrial.searchConditions) ⇒ <code>array</code>
* [.getDetails(id)](#ClinicalTrial.getDetails) ⇒ <code>object</code>

<a name="ClinicalTrial.search"></a>

### ClinicalTrial.search(props) ⇒ <code>object</code>
### ClinicalTrial.search(props) ⇒ <code>Object</code>
Search for clinical trials using search criteria

**Kind**: static method of [<code>ClinicalTrial</code>](#ClinicalTrial)

| Param | Type |
| --- | --- |
| props | [<code>SearchProps</code>](#SearchProps) |
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| props | <code>Object</code> | | |
| [props.status] | <code>string</code> | <code>&quot;open&quot;</code> | Specify whether you want to search for studies that are recruiting participants or in other stages. |
| [props.condition] | <code>string</code> | | Specify the disease, disorder, syndrome, illness, or injury that is being studied. On ClinicalTrials.gov, conditions may also include other health-related issues such as lifespan, quality of life, and health risks. |
| [props.terms] | <code>string</code> | | Specify words or phrases related to the studies you want to find. This performs a general search of the study information, including the title, brief description, conditions, interventions, and locations. Also use this field to find studies by NCT number. |
| [props.country] | <code>string</code> | <code>&quot;US&quot;</code> | Studies are often conducted in many locations around the world. Use this field to select up to three locations to search for studies. For the United States, you can narrow your search by selecting a state. |
| [props.state] | <code>string</code> | | The state withing the United States you would like to search. |
| [props.gender] | <code>string</code> | | Search by the sex of persons who may participate in a study. |
| [props.healthy] | <code>bool</code> | <code>true</code> | Limit your search to studies which accept healthy participants (people who do not have the condition or related conditions or symptoms being studies). |
| [props.count] | <code>number</code> | <code>25</code> | Number of results to return. Default is 25. |
| [props.offset] | <code>number</code> | | The offset index used for pagination. |

<a name="ClinicalTrial.searchConditions"></a>

Expand All @@ -58,18 +52,3 @@ Get details for a specific trial from a ClinicalTrials.gov Identifier
| --- | --- | --- |
| id | <code>string</code> | ClinicalTrials.gov Identifier |

<a name="SearchProps"></a>

## SearchProps : <code>object</code>
**Kind**: global typedef

| Param | Type | Description |
| --- | --- | --- |
| status | <code>string</code> | Specify whether you want to search for studies that are recruiting participants or in other stages. |
| condition | <code>string</code> | Specify the disease, disorder, syndrome, illness, or injury that is being studied. On ClinicalTrials.gov, conditions may also include other health-related issues such as lifespan, quality of life, and health risks. |
| terms | <code>string</code> | Specify words or phrases related to the studies you want to find. This performs a general search of the study information, including the title, brief description, conditions, interventions, and locations. Also use this field to find studies by NCT number. |
| country | <code>string</code> | Studies are often conducted in many locations around the world. Use this field to select up to three locations to search for studies. For the United States, you can narrow your search by selecting a state. |
| gender | <code>string</code> | Search by the sex of persons who may participate in a study. |
| healthy | <code>bool</code> | Limit your search to studies which accept healthy participants (people who do not have the condition or related conditions or symptoms being studies). |
| count | <code>number</code> | Number of results to return. Default is 25. |

12 changes: 6 additions & 6 deletions example.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const ClinicalTrial = require('./src/');
const ClinicalTrial = require("./src/");

ClinicalTrial.search({condition: "Asthma"}).then(studies => {
studies.forEach((study, index) => {
console.log(index, study.title);
});
});
ClinicalTrial.search({ condition: "Asthma" }).then(studies => {
console.table(studies, ["order", "nct_id", "title"]);
});

ClinicalTrial.searchConditions("asthma").then(console.log);
Loading