Skip to content

Commit

Permalink
changed generating token to article
Browse files Browse the repository at this point in the history
  • Loading branch information
RodrigoZepeda committed Jul 17, 2024
1 parent 31900ae commit 5dc292a
Show file tree
Hide file tree
Showing 59 changed files with 847 additions and 361 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
^docs$
^codecov\.yml$
^\.github$
^vignettes/articles$
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: WHOicd
Title: Retrieve data from the World Health Organization (WHO) International Classification of Diseases (ICD) API version 2
Version: 0.2.0
Version: 0.3.0
Authors@R:
person("Rodrigo", "Zepeda-Tello", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-4471-5270"))
Expand All @@ -16,6 +16,7 @@ Config/testthat/edition: 3
Config/testthat/parallel: false
Imports:
curl,
httr2
httr2 (>= 1.0.0)
Depends:
R (>= 4.2.0)
Config/Needs/website: rmarkdown
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# WHOicd 0.3.0

* Added access to the DORIS system with the `doris` function.
* Now requires `httr2 >= 1.0.0`.

# WHOicd 0.2.0

* Reduced the amount of functions for ICD-10 and improve speed for vectorized search.
63 changes: 23 additions & 40 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ CLIENT_SECRET <- Sys.getenv("CLIENT_SECRET")
```

For the examples we'll assume you already have a `CLIENT_ID` and `CLIENT_SECRET`
for the WHO API as obtained in the [**Obtaining your token**](#obtaining-your-token) section.
for the WHO API as obtained in the [**Generaring your token**](/articles/Generating-your-token.html) article.

To interact with the API you'll need to continuously create a token using the `get_token` function:

Expand All @@ -54,6 +54,28 @@ token <- get_token(CLIENT_ID, CLIENT_SECRET)

> **Note** These tokens last for 1 hour and once the hour passes you'll need to generate a new token. The package will try to auto-generate one for you.
There are three main objectives for this package:

1. Use of the DORIS system to obtain underlying cause of death.
2. Use of ICD-11 to codify causes of death.
3. Use of ICD-10 to codify causes of death.

## DORIS (WHO Digital Open Rule Integrated Cause of Death Selection)

The [Digital Open Rule Integrated Cause of Death Selection](https://icd.who.int/doris/en), DORIS,
provides a framework for obtaining the underlying cause of death from a death certificate. DORIS
functionality has been implemented in the `doris` function.

The following example considers a 60 year old female whose primary cause of death was `2D42`:
`Malignant neoplasms of ill-defined sites` due to `2E03`: `Malignant neoplasm metastasis in bone or bone marrow` due to `CB41.0Z`: `Acute respiratory failure, unspecified`.

```{r}
doris(token, sex = "Female", age = iso_8601(years = 60), cause_of_death_code_a = "2D42",
cause_of_death_code_b = "2E03", cause_of_death_code_c = "CB41.0Z")
```

All of the options are available in the function's help page [`doris()`](https://rodrigozepeda.github.io/WHOicd/reference/doris.html).

## ICD-11 examples

## ICD-10 examples
Expand Down Expand Up @@ -130,47 +152,8 @@ icd10_release_info(token, release = 2016)
```


## DORIS (WHO Digital Open Rule Integrated Cause of Death Selection)

The [Digital Open Rule Integrated Cause of Death Selection](https://icd.who.int/doris/en), DORIS,
provides a framework for obtaining the underlying cause of death from a death certificate. DORIS
functionality has been implemented in the `doris` function.

The following example considers a 60 year old female whose primary cause of death was `2D42`:
`Malignant neoplasms of ill-defined sites` due to `2E03`: `Malignant neoplasm metastasis in bone or bone marrow` due to `CB41.0Z`: `Acute respiratory failure, unspecified`.

```{r}
doris(token, sex = "Female", age = iso_8601(years = 60), cause_of_death_code_a = "2D42",
cause_of_death_code_b = "2E03", cause_of_death_code_c = "CB41.0Z")
```

All of the options are available in the function's help page [`doris()`](https://rodrigozepeda.github.io/WHOicd/reference/get_token.html).

## Obtaining your token

Go to the WHO ICD API website at [https://icd.who.int/icdapi](https://icd.who.int/icdapi)
and click on `Register` inside the `API Access` section:

![Image of the ICD API website indicating where the Register button for the API lies](man/figures/api1.png)

Fill out your information and verify your email.

![Image of the API website with the register form](man/figures/api2.png)

Once your email is verified go to the `Login` page. Enter your email and password:

![API login page requesting the user for email and password](man/figures/api2_5.png)

Read and accept the terms and conditions for the API

![Image of API website indicating where is the button to accept terms and conditions](man/figures/api3.png)

Under **API Access** click on `View API access key(s)`

![Image of API website indicating where is the button to View the API access keys](man/figures/api4.png)
Your client id and secret will be required by the `WHOicd` library. Copy them, they are the equivalent to a user and password for this API. You'll need them to interact with the WHO ICD. **Don't share them!!**

![Image of API website indicating where is the button to View the API access keys](man/figures/api5.png)

## Support

Expand Down
151 changes: 51 additions & 100 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ remotes::install_github("RodrigoZepeda/WHOicd")
## Setup

For the examples we’ll assume you already have a `CLIENT_ID` and
`CLIENT_SECRET` for the WHO API as obtained in the [**Obtaining your
token**](#obtaining-your-token) section.
`CLIENT_SECRET` for the WHO API as obtained in the [**Generaring your
token**](/articles/Generating-your-token.html) article.

To interact with the API you’ll need to continuously create a token
using the `get_token` function:
Expand All @@ -50,6 +50,55 @@ token <- get_token(CLIENT_ID, CLIENT_SECRET)
> need to generate a new token. The package will try to auto-generate
> one for you.
There are three main objectives for this package:

1. Use of the DORIS system to obtain underlying cause of death.
2. Use of ICD-11 to codify causes of death.
3. Use of ICD-10 to codify causes of death.

## DORIS (WHO Digital Open Rule Integrated Cause of Death Selection)

The [Digital Open Rule Integrated Cause of Death
Selection](https://icd.who.int/doris/en), DORIS, provides a framework
for obtaining the underlying cause of death from a death certificate.
DORIS functionality has been implemented in the `doris` function.

The following example considers a 60 year old female whose primary cause
of death was `2D42`: `Malignant neoplasms of ill-defined sites` due to
`2E03`: `Malignant neoplasm metastasis in bone or bone marrow` due to
`CB41.0Z`: `Acute respiratory failure, unspecified`.

``` r
doris(token, sex = "Female", age = iso_8601(years = 60), cause_of_death_code_a = "2D42",
cause_of_death_code_b = "2E03", cause_of_death_code_c = "CB41.0Z")
#> $`Underlying cause of death (UCOD)`
#> [1] "2D42"
#>
#> $`UCOD URI`
#> [1] "http://id.who.int/icd/entity/2023965817"
#>
#> $`UCOD with postcoordinated information (if available)`
#> [1] "2D42"
#>
#> $`UCOD postcoordinated URI`
#> [1] "http://id.who.int/icd/release/11/mms/2023965817"
#>
#> $`Detailed explanation (report)`
#> [1] "SP4: 2E03 is the starting point of the first-mentioned sequence (2D42 due to 2E03), which is selected as the tentative starting point (TSP).\nM1: There is a special instruction on 2E03 reported with mention of 2D42.\nM1: 2D42 is selected as the TUC.\nM3: The tentative underlying cause is not the same as the starting point selected in Steps SP1 to SP8. Repeat steps SP6, M1 and M2.\n\n\nFull report:\nSP1: is not applicable.\nSP2: is not applicable.\nSP3: is not applicable.\nSP4: 2E03 is the starting point of the first-mentioned sequence (2D42 due to 2E03), which is selected as the tentative starting point (TSP).\nSP6: is not applicable.\nSP7: is not applicable.\nSP8: is not applicable.\nM1: There is a special instruction on 2E03 reported with mention of 2D42.\nM1: 2D42 is selected as the TUC.\nM1: There is no special instruction applicable with TUC 2D42.\nM2: is not applicable.\nM3: The tentative underlying cause is not the same as the starting point selected in Steps SP1 to SP8. Repeat steps SP6, M1 and M2.\nSP6: is not applicable.\nSP7: is not applicable.\nSP8: is not applicable.\nM1: There is no special instruction applicable with TUC 2D42.\nM2: is not applicable.\n"
#>
#> $reject
#> [1] FALSE
#>
#> $error
#> NULL
#>
#> $warning
#> NULL
```

All of the options are available in the function’s help page
[`doris()`](https://rodrigozepeda.github.io/WHOicd/reference/doris.html).

## ICD-11 examples

## ICD-10 examples
Expand Down Expand Up @@ -199,104 +248,6 @@ icd10_release_info(token, release = 2016)
#> "http://apps.who.int/classifications/icd10/browse/2016/en"
```

## DORIS (WHO Digital Open Rule Integrated Cause of Death Selection)

The [Digital Open Rule Integrated Cause of Death
Selection](https://icd.who.int/doris/en), DORIS, provides a framework
for obtaining the underlying cause of death from a death certificate.
DORIS functionality has been implemented in the `doris` function.

The following example considers a 60 year old female whose primary cause
of death was `2D42`: `Malignant neoplasms of ill-defined sites` due to
`2E03`: `Malignant neoplasm metastasis in bone or bone marrow` due to
`CB41.0Z`: `Acute respiratory failure, unspecified`.

``` r
doris(token, sex = "Female", age = iso_8601(years = 60), cause_of_death_code_a = "2D42",
cause_of_death_code_b = "2E03", cause_of_death_code_c = "CB41.0Z")
#> $`Underlying cause of death (UCOD)`
#> [1] "2D42"
#>
#> $`UCOD URI`
#> [1] "http://id.who.int/icd/entity/2023965817"
#>
#> $`UCOD with postcoordinated information (if available)`
#> [1] "2D42"
#>
#> $`UCOD postcoordinated URI`
#> [1] "http://id.who.int/icd/release/11/mms/2023965817"
#>
#> $`Detailed explanation (report)`
#> [1] "SP4: 2E03 is the starting point of the first-mentioned sequence (2D42 due to 2E03), which is selected as the tentative starting point (TSP).\nM1: There is a special instruction on 2E03 reported with mention of 2D42.\nM1: 2D42 is selected as the TUC.\nM3: The tentative underlying cause is not the same as the starting point selected in Steps SP1 to SP8. Repeat steps SP6, M1 and M2.\n\n\nFull report:\nSP1: is not applicable.\nSP2: is not applicable.\nSP3: is not applicable.\nSP4: 2E03 is the starting point of the first-mentioned sequence (2D42 due to 2E03), which is selected as the tentative starting point (TSP).\nSP6: is not applicable.\nSP7: is not applicable.\nSP8: is not applicable.\nM1: There is a special instruction on 2E03 reported with mention of 2D42.\nM1: 2D42 is selected as the TUC.\nM1: There is no special instruction applicable with TUC 2D42.\nM2: is not applicable.\nM3: The tentative underlying cause is not the same as the starting point selected in Steps SP1 to SP8. Repeat steps SP6, M1 and M2.\nSP6: is not applicable.\nSP7: is not applicable.\nSP8: is not applicable.\nM1: There is no special instruction applicable with TUC 2D42.\nM2: is not applicable.\n"
#>
#> $reject
#> [1] FALSE
#>
#> $error
#> NULL
#>
#> $warning
#> NULL
```

All of the options are available in the function’s help page
[`doris()`](https://rodrigozepeda.github.io/WHOicd/reference/get_token.html).

## Obtaining your token

Go to the WHO ICD API website at <https://icd.who.int/icdapi> and click
on `Register` inside the `API Access` section:

<figure>
<img src="man/figures/api1.png"
alt="Image of the ICD API website indicating where the Register button for the API lies" />
<figcaption aria-hidden="true">Image of the ICD API website indicating
where the Register button for the API lies</figcaption>
</figure>

Fill out your information and verify your email.

<figure>
<img src="man/figures/api2.png"
alt="Image of the API website with the register form" />
<figcaption aria-hidden="true">Image of the API website with the
register form</figcaption>
</figure>

Once your email is verified go to the `Login` page. Enter your email and
password:

<figure>
<img src="man/figures/api2_5.png"
alt="API login page requesting the user for email and password" />
<figcaption aria-hidden="true">API login page requesting the user for
email and password</figcaption>
</figure>

Read and accept the terms and conditions for the API

<figure>
<img src="man/figures/api3.png"
alt="Image of API website indicating where is the button to accept terms and conditions" />
<figcaption aria-hidden="true">Image of API website indicating where is
the button to accept terms and conditions</figcaption>
</figure>

Under **API Access** click on `View API access key(s)`

![Image of API website indicating where is the button to View the API
access keys](man/figures/api4.png) Your client id and secret will be
required by the `WHOicd` library. Copy them, they are the equivalent to
a user and password for this API. You’ll need them to interact with the
WHO ICD. **Don’t share them!!**

<figure>
<img src="man/figures/api5.png"
alt="Image of API website indicating where is the button to View the API access keys" />
<figcaption aria-hidden="true">Image of API website indicating where is
the button to View the API access keys</figcaption>
</figure>

## Support

This is not an official product of the WHO. However we are happy to
Expand Down
14 changes: 13 additions & 1 deletion docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion docs/LICENSE.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5dc292a

Please sign in to comment.