Skip to content

Commit ef9da8d

Browse files
Merge pull request #111 from OxfordIHTM/dev
update README
2 parents 58056d5 + e247b31 commit ef9da8d

File tree

3 files changed

+120
-54
lines changed

3 files changed

+120
-54
lines changed

README.Rmd

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ knitr::opts_chunk$set(
1616
# codigo: Interface to the International Classification of Diseases (ICD) API <img src="man/figures/logo.png" width="200" align="right" />
1717

1818
<!-- badges: start -->
19-
[![Project Status: WIPInitial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
19+
[![Project Status: ActiveThe project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
2020
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
2121
[![R-CMD-check](https://github.com/OxfordIHTM/icd/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/OxfordIHTM/icd/actions/workflows/R-CMD-check.yaml)
2222
[![test-coverage](https://github.com/OxfordIHTM/icd/actions/workflows/test-coverage.yaml/badge.svg)](https://github.com/OxfordIHTM/icd/actions/workflows/test-coverage.yaml)
@@ -28,16 +28,16 @@ The [International Classification of Diseases (ICD)](https://www.who.int/standar
2828

2929
## What does `codigo` do?
3030

31-
Please note that `codigo` is still highly experimental and is undergoing a lot of development. Hence, any functionalities described below and in the rest of the package documentation have a high likelihood of changing interface or approach as we aim for a stable working version.
31+
Please note that `codigo` is still experimental but is nearing a stable release. It is possible that some functionalities described below and in the rest of the package documentation may change interface or approach but these changes will likely be minor.
3232

3333
Currently, the package provides functions for:
3434

35-
* Authenticating with the ICD API;
36-
* Performing a search of ICD-11 foundation component;
37-
* Performing autocoding of causes of death using the ICD-11 foundation; and,
38-
* Getting information on various ICD-11 foundation entities.
39-
40-
From here, the plan is to continue developing functions that wrap the various available [API endpoints](https://id.who.int/swagger/index.html).
35+
* Authenticating with the ICD API (*stable*);
36+
* Performing a search of ICD-11 foundation and linearization components (*stable*);
37+
* Performing autocoding of causes of death using the ICD-11 foundation and linearization components (*stable*);
38+
* Getting information on various ICD-11 foundation and linearization entities (*experimental*);
39+
* Converting ICD-10 codes to ICD-11 codes and vice versa (*stable*); and,
40+
* Determining the underlying cause of death based on reported information on a death certificate (*experimental*).
4141

4242
## Installation
4343

@@ -50,7 +50,7 @@ install.packages(
5050
)
5151
```
5252

53-
then load `codigo`
53+
and then can be loaded into an R session
5454

5555
```{r load-package, eval = TRUE}
5656
# load package
@@ -81,24 +81,24 @@ my_oauth_client <- icd_oauth_client(
8181
id = "YOUR_CLIENT_ID",
8282
token_url = "https://icdaccessmanagement.who.int/connect/token",
8383
secret = "YOUR_CLIENT_SECRET",
84-
name = "NAME_OF_YOUR_APP
84+
name = "NAME_OF_YOUR_APP"
8585
)
8686
```
8787

8888
This OAuth2 client can now be used to the various functions in the package that require an OAuth2 client for authentication for making requests to the ICD API.
8989

9090
### Performing a basic search
9191

92-
The main feature of the ICD API is the ability to search ICD 11 Foundation and ICD 11 Linearization for information regarding an illness/disease. This feature is captured by the `icd_search_foundation()` function. For example, if *colorectal cancer* is the disease of interest and information available from ICD 11 is needed, the following call can be made:
92+
The main feature of the ICD API is the ability to search ICD 11 Foundation and ICD 11 Linearization for information regarding an illness/disease. This feature is captured by the `icd_search` functions. For example, if *colorectal cancer* is the disease of interest and information available from ICD 11 is needed, the following call can be made:
9393

9494
```{r search, eval = FALSE}
95-
icd_search_foundation("colorectal cancer", client = my_oauth_client)
95+
icd_search("colorectal cancer", client = my_oauth_client)
9696
```
9797

9898
which gives the following output:
9999

100100
```{r result, echo = FALSE}
101-
icd_search_foundation("colorectal cancer")
101+
icd_search("colorectal cancer")
102102
```
103103

104104
The output is a tibble created from parsed JSON body text of the HTTP response from the ICD API.

README.md

Lines changed: 47 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
<!-- badges: start -->
77

8-
[![Project Status: WIPInitial development is in progress, but there
9-
has not yet been a stable, usable release suitable for the
10-
public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
8+
[![Project Status: ActiveThe project has reached a stable, usable
9+
state and is being actively
10+
developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
1111
[![Lifecycle:
1212
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
1313
[![R-CMD-check](https://github.com/OxfordIHTM/icd/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/OxfordIHTM/icd/actions/workflows/R-CMD-check.yaml)
@@ -28,22 +28,24 @@ interface with the ICD API.
2828

2929
## What does `codigo` do?
3030

31-
Please note that `codigo` is still highly experimental and is undergoing
32-
a lot of development. Hence, any functionalities described below and in
33-
the rest of the package documentation have a high likelihood of changing
34-
interface or approach as we aim for a stable working version.
31+
Please note that `codigo` is still experimental but is nearing a stable
32+
release. It is possible that some functionalities described below and in
33+
the rest of the package documentation may change interface or approach
34+
but these changes will likely be minor.
3535

3636
Currently, the package provides functions for:
3737

38-
- Authenticating with the ICD API;
39-
- Performing a search of ICD-11 foundation component;
40-
- Performing autocoding of causes of death using the ICD-11 foundation;
38+
- Authenticating with the ICD API (*stable*);
39+
- Performing a search of ICD-11 foundation and linearization components
40+
(*stable*);
41+
- Performing autocoding of causes of death using the ICD-11 foundation
42+
and linearization components (*stable*);
43+
- Getting information on various ICD-11 foundation and linearization
44+
entities (*experimental*);
45+
- Converting ICD-10 codes to ICD-11 codes and vice versa (*stable*);
4146
and,
42-
- Getting information on various ICD-11 foundation entities.
43-
44-
From here, the plan is to continue developing functions that wrap the
45-
various available [API
46-
endpoints](https://id.who.int/swagger/index.html).
47+
- Determining the underlying cause of death based on reported
48+
information on a death certificate (*experimental*).
4749

4850
## Installation
4951

@@ -57,7 +59,7 @@ install.packages(
5759
)
5860
```
5961

60-
then load `codigo`
62+
and then can be loaded into an R session
6163

6264
``` r
6365
# load package
@@ -98,7 +100,7 @@ my_oauth_client <- icd_oauth_client(
98100
id = "YOUR_CLIENT_ID",
99101
token_url = "https://icdaccessmanagement.who.int/connect/token",
100102
secret = "YOUR_CLIENT_SECRET",
101-
name = "NAME_OF_YOUR_APP
103+
name = "NAME_OF_YOUR_APP"
102104
)
103105
```
104106

@@ -110,35 +112,45 @@ requests to the ICD API.
110112

111113
The main feature of the ICD API is the ability to search ICD 11
112114
Foundation and ICD 11 Linearization for information regarding an
113-
illness/disease. This feature is captured by the
114-
`icd_search_foundation()` function. For example, if *colorectal cancer*
115-
is the disease of interest and information available from ICD 11 is
116-
needed, the following call can be made:
115+
illness/disease. This feature is captured by the `icd_search` functions.
116+
For example, if *colorectal cancer* is the disease of interest and
117+
information available from ICD 11 is needed, the following call can be
118+
made:
117119

118120
``` r
119-
icd_search_foundation("colorectal cancer", client = my_oauth_client)
121+
icd_search("colorectal cancer", client = my_oauth_client)
120122
```
121123

122124
which gives the following output:
123125

124126
#> Release `2024-01` matches a known release for ICD-11.
125127
#> Language `en` is available for the release specified.
126-
#> # A tibble: 8 × 18
127-
#> id title stemId isLeaf postcoordinationAvai…¹ hasCodingNote
128-
#> * <chr> <chr> <chr> <lgl> <int> <lgl>
129-
#> 1 http://id.who.int/ic… Mali… http:… FALSE 0 FALSE
130-
#> 2 http://id.who.int/ic… Mali… http:… FALSE 0 FALSE
131-
#> 3 http://id.who.int/ic… Mali… http:… FALSE 0 FALSE
132-
#> 4 http://id.who.int/ic… Mali… http:… FALSE 0 FALSE
133-
#> 5 http://id.who.int/ic… Mali… http:… FALSE 0 FALSE
134-
#> 6 http://id.who.int/ic… Mali… http:… FALSE 0 FALSE
135-
#> 7 http://id.who.int/ic… Fami… http:… FALSE 0 FALSE
136-
#> 8 http://id.who.int/ic… Here… http:… FALSE 0 FALSE
128+
#> # A tibble: 18 × 19
129+
#> id title stemId isLeaf postcoordinationAvai…¹ hasCodingNote
130+
#> * <chr> <chr> <chr> <lgl> <int> <lgl>
131+
#> 1 http://id.who.int/i… Mali… http:… TRUE 1 FALSE
132+
#> 2 http://id.who.int/i… Mali… http:… TRUE 1 FALSE
133+
#> 3 http://id.who.int/i… Mali… http:… TRUE 1 FALSE
134+
#> 4 http://id.who.int/i… Mali… http:… TRUE 1 FALSE
135+
#> 5 http://id.who.int/i… Mali… http:… TRUE 1 FALSE
136+
#> 6 http://id.who.int/i… Mali… http:… TRUE 1 FALSE
137+
#> 7 http://id.who.int/i… Othe… http:… TRUE 1 FALSE
138+
#> 8 http://id.who.int/i… Othe… http:… TRUE 1 FALSE
139+
#> 9 http://id.who.int/i… Othe… http:… TRUE 1 FALSE
140+
#> 10 http://id.who.int/i… Othe… http:… TRUE 1 FALSE
141+
#> 11 http://id.who.int/i… Othe… http:… TRUE 1 FALSE
142+
#> 12 http://id.who.int/i… Othe… http:… TRUE 1 FALSE
143+
#> 13 http://id.who.int/i… Othe… http:… TRUE 1 FALSE
144+
#> 14 http://id.who.int/i… Othe… http:… TRUE 1 FALSE
145+
#> 15 http://id.who.int/i… Othe… http:… TRUE 1 FALSE
146+
#> 16 http://id.who.int/i… Othe… http:… TRUE 1 FALSE
147+
#> 17 http://id.who.int/i… Othe… http:… TRUE 1 FALSE
148+
#> 18 http://id.who.int/i… Othe… http:… TRUE 1 FALSE
137149
#> # ℹ abbreviated name: ¹​postcoordinationAvailability
138-
#> # ℹ 12 more variables: hasMaternalChapterLink <lgl>,
150+
#> # ℹ 13 more variables: hasMaternalChapterLink <lgl>,
139151
#> # hasPerinatalChapterLink <lgl>, matchingPVs <named list>,
140152
#> # propertiesTruncated <lgl>, isResidualOther <lgl>,
141-
#> # isResidualUnspecified <lgl>, chapter <chr>, score <dbl>,
153+
#> # isResidualUnspecified <lgl>, chapter <chr>, theCode <chr>, score <dbl>,
142154
#> # titleIsASearchResult <lgl>, titleIsTopScore <lgl>, entityType <int>,
143155
#> # important <lgl>
144156

vignettes/codigo.Rmd

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,81 @@ knitr::opts_chunk$set(
1919
library(codigo)
2020
```
2121

22-
This article takes a quick tour of the main features of `codigo`.
22+
This article takes a quick tour of the main features of `codigo`.
23+
24+
## Authenticating with the ICD API
25+
26+
The ICD API uses [OAuth2](https://httr2.r-lib.org/articles/oauth.html) for authentication. The package has a set of utility functions that support the ICD API authentication specifications leading to the generation of an OAuth2 token. The `icd_oauth_client()` function is the downstream and user-facing function that creates an ICD OAuth2 client that can be used for token retrieval by future functions that wrap ICD API for entity and linearization information retrieval.
27+
28+
An ICD OAuth2 client can be generated as follows:
29+
30+
```R
31+
icd_oauth_client()
32+
```
33+
34+
This function uses a built in OAuth2 client created for light use and for purposes of package development and testing.
35+
36+
It is recommended that those intending to use this package for programmatically performing high volume of calls to the ICD API to create their own **access keys** (`client id` and `client secret`) using [these instructions](https://icd.who.int/docs/icd-api/API-Authentication/).
37+
38+
Then, with your access keys, perform the following commands:
39+
40+
```R
41+
## Create your own OAuth client ----
42+
my_oauth_client <- icd_oauth_client(
43+
id = "YOUR_CLIENT_ID",
44+
token_url = "https://icdaccessmanagement.who.int/connect/token",
45+
secret = "YOUR_CLIENT_SECRET",
46+
name = "NAME_OF_YOUR_APP"
47+
)
48+
```
49+
50+
This OAuth2 client can now be used to the various functions in the package that require an OAuth2 client for authentication for making requests to the ICD API.
2351

2452
## Performing a basic search
2553

26-
A feature of the ICD API is the ability to search ICD 11 Foundation and ICD 11 Linearization for information regarding an illness/disease. This feature is captured by the `icd_search_foundation()` function. For example, if *colorectal cancer* is the disease of interest and information available from ICD 11 is needed, the following call can be made:
54+
A feature of the ICD API is the ability to search ICD 11 Foundation and ICD 11 Linearization for information regarding an illness/disease. This feature is captured by the `icd_search` functions. For example, if *colorectal cancer* is the disease of interest and information available from ICD 11 is needed, the following call can be made:
2755

2856
```{r search, eval = FALSE}
29-
icd_search_foundation("colorectal cancer", client = my_oauth_client)
57+
icd_search("colorectal cancer", client = my_oauth_client)
3058
```
3159

3260
which gives the following output:
3361

3462
```{r result, echo = FALSE}
35-
icd_search_foundation("colorectal cancer")
63+
icd_search("colorectal cancer")
3664
```
3765

38-
The output is a tibble created from parsed JSON body text of the HTTP response from the ICD API.
66+
The output is a tibble created from parsed JSON body text of the HTTP response from the ICD API. If you prefer the output to remain as the parsed JSON body text of the HTTP response from the ICD API, set the argument `tabular = FALSE`
67+
68+
```{r search-list, eval = FALSE}
69+
icd_search("colorectal cancer", tabular = FALSE, client = my_oauth_client)
70+
```
71+
72+
which gives the following output:
73+
74+
```{r result-list, echo = FALSE}
75+
icd_search("colorectal cancer", tabular = FALSE)
76+
```
3977

4078
## Autocoding
4179

42-
Autocoding is a focused search that returns a single result based on the closest match from ICD-11. Autocoding using the ICD Foundation API endpoint produces
80+
Autocoding is a focused search that returns results based on the closest match from ICD-11. Autocoding using the ICD Linearization component API endpoint can be done as follows:
81+
82+
```{r autocode-show, eval = FALSE}
83+
icd_autocode("colorectal cancer", client = my_oauth_client)
84+
```
85+
86+
which gives the following results
87+
88+
```{r autocode-results, echo = FALSE}
89+
icd_autocode("colorectal cancer")
90+
```
91+
92+
## Converting ICD-10 codes to ICD-11 and vice versa
4393

94+
If you are working with data that used ICD-10 codes and need these codes to be converted to ICD-11 codes, the `icd_map()` function assists in performing this. The following code will provide information on what the *A00* ICD0-10 code including its ICD-11 counterpart.
4495

96+
```{r icd-map-show}
97+
icd_map(code = "A00")
98+
```
4599

0 commit comments

Comments
 (0)