Table of Contents

Notes on writing text for the Book of OHDSI

Most of the information on this page can be found in The Book of OHDSI Cheat Sheet.

General layout of a chapter

Please try to adhere to the following general layout for each chapter:

Keep in mind

Editing the Book

It is highly recommended to use R-Studio to edit the Book of OHDSI. If you haven't done so already, make sure to install:

  1. R

Once installed, run install.packages(“bookdown”) in R to install the bookdown package.

To start editing the book, first fork the TheBookOfOhdsi repo. Then clone the fork using RStudio.

You can build the entire book in RStudio in the Build tab (top right panel). Alternatively, you can build a preview just of your chapter using the preview_chapter() command in R.

After making your edits, commit and push them to your forked repository. From there, you can create a pull-request to the main repository.

Markdown syntax

An overview of basic Markdown syntax can be found here.

Some useful extended syntax:

Tables:

| Concept ID | Name |
| ---------- | ---- |
| 8532 | FEMALE|
| 8507 | MALE|

Important! The number of hyphens in the second row determines how wide the table is. The relationship between number of hyphens and table width is not documented, but 10 hyphens translates into approximately 10-20% width.

You can add a table caption like this:

Table: (\#tab:conceptTable) A table with two concepts.

| Concept ID | Name |
| ---------- | ---- |
| 8532 | FEMALE|
| 8507 | MALE|
  

Footnotes:

Here's a sentence with a footnote. [^1]

[^1]: This is the footnote.

Heading ID:

### P-value mantras{#custom-id}
For more detail, see section \@ref(custom-id)

Definition list:

term
: definition

Adding figures

Please add figure files to a subfolder of the images folder. The subfolder should have the same name as the chapter Rmd file. Keep filename extensions in lower case, so 'figure.png', not 'figure.PNG'.

In the chapter, you can include a figure using the following piece of text:

```{r figure1, fig.cap='The prediction problem',echo=FALSE, out.width='100%', fig.align='center'}
knitr::include_graphics("images/PatientLevelPrediction/Figure1.png")
```

Here, figure1 is the label that can be used to reference the figure. Only use alphanumeric characters in labels. So not ```{r figure_1} but ```{r figure1}. You furthermore must specify a caption and the path to the figure file.

You can reference the figure in your text for example using Figure \@ref(fig:figure1) shows ….

Adding ATLAS screenshots

It is hard to take screenshots of ATLAS where the resulting font size in the image in the book is big enough to read. Try to keep screenshots to a minimum. If you need to make a screenshot, here are instructions for making ok screenshots:

Adding literature references

To add literature references to your chapter, two steps are needed:

  1. Add citation information to the book.bib file
  2. Reference the citation in your text.

Adding citation information

Citations should be provided in BibTeX format. There are two ways to get BibTeX formatted citations:

Note that there is only one boob.bib file for the entire book.

Referencing in text

The first field in the BibTeX is its label, and this label can be used to reference the citation. This can be done with and without square brackets. For example, As proposed by @reps2018 will render to `As proposed by Reps et al. (2018)`, while As proposed elsewhere [@reps2018] will render to `As proposed elsewhere (Reps et al. 2018)`

A convenient way of inserting citatiosn is to use the citation add-in that comes with the bookdown package:

Referencing OHDSI tools

We will explain where to find the OHDSI tools and how to install them once in the book. All other references to OHDSI tools should just mention the tool name, and the name should be a hyperlink to the tool page. For R packages, use the Github Pages page, for example:

 This done through the [FeatureExtraction](https://ohdsi.github.io/FeatureExtraction/) package.

Adding index terms

This section describes how to add index terms that will appear in the back-of-the-book index.

Note: This is only relevant for those folks that have been appointed as indexers. Please do not try to add index terms if you are not an indexer.

To identify a point in the book where a certain term is discussed, just add

\index{your term here}

to the Rmd file at the appropriate position. This markup will not be rendered in the HTML or PDF at that location, and will only be used to create the index entry in the back of the book.

Most index terms should simply start with a lower case, unless it's a proper noun. Only mark the term if the page is really about the term, not if the page just mentions the word. Ask yourself: if I were to look this term up in the back-of-the-book index, is this the page I would want to read?

Below are examples of index entries: