Project documentation folder

It is recommended to organize R projects using a common infrastructure (see for example ProjectTemplate). Project documenation might then be stored in a subfolder called “doc”.

INCA documentation

The function documents helps to create a project documentation folder (if it doesn’t already exist) and to populate it with relevant register documentation.

If working on a Mac, the same function is used to open the documents for immediate display (this works both if the document is already downloaded, or if it has to be downloaded first).

Examples

Assume we work on a lung cancer related project and therefore wants to download all register documentation for the Swedish lung cancer quality register.

library(incadata)
documents("lung")
## 13 file(s) downloaded to ./doc

Let’s say we are currently working with data from the the so called “registreringsblankett” and we suddenly feel the need to check the logical order of questions appearing on the form. Now, if we are working on a Mac, we can easily open the document to have a look:

documents("lung", "registrering")

We do not need to first download all the documents. It is possible to specify both the register and the document immidiately. Assume we are working with Acute lymphoblastic leukemia (ALL) and that we want to have a look at the “behandlingsblankett”:

documents("all", "behandling")
## 1 file(s) downloaded to ./doc

No need for exact names

It is not necessary to specify the names excactly. If we are working with a register called something with “akut”, we can just try to find its variable list:

documents("akut", "variabel")
## Error in find_register(reg): Muliple diagnoses found. Choose one one:
## * akut-lymfatiskt-leukemi-all
## * akut-myeloisk-leukemi-aml-inkl-akut-oklassificerad-leukemi-aul

When we see the alternatives we might realize that we are actually looking for is “akut-myeloisk-leukemi-aml-inkl-akut-oklassificerad-leukemi-aul”. This name is however quite cumbersome to both remember and type, so let’s try with “AML” for short:

documents("AML", "variabel")
## 1 file(s) downloaded to ./doc

That worked just fine!

Let’s now assume that we are working with ovarial cancer and that we would like to see information regarding recidive:

documents("ovarial", "recidiv")
## Error in bmatch(names(links), reg): No match. Choose one of:
##  * akut-lymfatiskt-leukemi-all
##  * akut-myeloisk-leukemi-aml-inkl-akut-oklassificerad-leukemi-aul
##  * kronisk-lymfatisk-leukemi-kll
##  * kronisk-myeloisk-leukemi-kml
##  * myelodysplastiskt-syndrom-mds
##  * myeloproliferativa-sjukdomar-mpn
##  * lymfom-lymfkortelcancer
##  * myelom
##  * brost
##  * bukspottkortel
##  * gynekologi
##  * hjarna-och-ryggmarg
##  * hud-och-ogon
##  * huvud-och-hals
##  * lever-och-galla
##  * lunga-och-lungsack
##  * matstrupe-och-magsack
##  * neuroendokrina-buktumorer
##  * njure
##  * penis
##  * prostata
##  * sarkom
##  * skoldkortel
##  * testikel
##  * anal
##  * tjock--och-andtarm
##  * urinblasa-urinvagar

It turns out that “ovarial” is not presented on its own but we might guess from the output that relevant documents could be found under “gynekologi”, so let’s try with that instead … or actually, let’s try the slightly altered “gyncancer” instead (just to show that the exact spelling is not important):

documents("gyncancer", "recidiv")
## 4 file(s) downloaded to ./doc

Let’s stay at gynecological caner but assume that we would like all documents related to “corpus”:

documents("gyncancer", "corpus")
## Error in bmatch(names(links), doc): No match. Choose one of:
##  * Styrdokumnet Svenska Kvalitetsregistret för Gynekologisk Cancer (pdf)
##  * Användarhandbok för inrapportör i kvalitetsregister (pdf)
##  * Årshjul Svenska Kvalitetsregistret för Gynekologisk Cancer nov 2019 - okt 2020 (pdf, nytt fönster)
##  * Instruktioner för registrering - Svenska kvalitetsregistret för gynekologisk cancer (pdf, nytt fönster)
##  * Inklusionskriterier livmoderkroppscancer (pdf)
##  * Uppföljning (pdf, nytt fönster)
##  * Registermanual livmoderkroppscancer (pdf)
##  * Variabelförteckning livmoderkroppscancer (pdf)
##  * Anmälan (pdf)
##  * Kirurgisk behandling (pdf)
##  * Avslutad primärbehandling (pdf)
##  * Icke-kirurgisk recidivbehandling (pdf)
##  * Uppföljning (pdf)
##  * Registermanual livmoderhals- och vaginalcancer (pdf)
##  * Variabelförteckning livmoderhals- och vaginalcancer (pdf)
##  * Inklusionskriterier livmoderhals- och vaginalcancer (pdf)
##  * Anmälan (pdf)
##  * Kirurgisk behandling (pdf)
##  * Avslutad primärbehandling (pdf)
##  * Icke-kirurgisk recidivbehandling (pdf)
##  * Uppföljning (pdf)
##  * Registermanual vulvacancer (pdf)
##  * Variabelförteckning vulvacancer (pdf)
##  * Inklusionskriterier vulvancer (pdf)
##  * Anmälan (pdf)
##  * Kirurgisk behandling (pdf)
##  * Avslutad primärbehandling (pdf)
##  * Icke-kirurgisk recidivbehandling (pdf)
##  * Uppföljning (pdf)
##  * Registermanual äggstockscancer (pdf)
##  * Variabelförteckning äggstockscancer (pdf)
##  * Inklusionskriterier äggstockscancer (pdf)
##  * Anmälan (pdf)
##  * Kirurgisk behandling (pdf)
##  * Avslutad primärbehandling (pdf)
##  * Icke-kiurgisk recidivbehandling (pdf)
##  * Uppföljning (pdf)

Aha … the term used seems to be “livmoderkropp” (not “corpus”), so let’s try again:

documents("gyn", "livmoderkropp")
## 3 file(s) downloaded to ./doc

Under the hood

Documents are found with a two step proceedure.

  1. The list of quality registers is scraped from cancercentrum.se
  2. Specific documents are found under the subfolder “/kvalitetsregister/dokument/” from each register.

There are no hard coded URL:s within the package. The functtion should therefore work also for new registers or documents. If the over all structure of the web site is changed however, the package must be updated as well.