Skip to content

Commit

Permalink
Run just generate-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
evansd committed Oct 21, 2024
1 parent 3ecf9da commit 2e47c90
Show file tree
Hide file tree
Showing 2 changed files with 220 additions and 0 deletions.
108 changes: 108 additions & 0 deletions docs/includes/generated_docs/schemas/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ from ehrql.tables.core import (
medications,
ons_deaths,
patients,
practice_registrations,
)
```

Expand Down Expand Up @@ -486,3 +487,110 @@ return (date - patients.date_of_birth).years

</dl>
</div>


<p class="dimension-indicator"><code>many rows per patient</code></p>
## practice_registrations

Each record corresponds to a patient's registration with a practice.
<div markdown="block" class="definition-list-wrapper">
<div class="title">Columns</div>
<dl markdown="block">
<div markdown="block">
<dt id="practice_registrations.start_date">
<strong>start_date</strong>
<a class="headerlink" href="#practice_registrations.start_date" title="Permanent link">🔗</a>
<code>date</code>
</dt>
<dd markdown="block">
Date patient joined practice.

* Never `NULL`
</dd>
</div>

<div markdown="block">
<dt id="practice_registrations.end_date">
<strong>end_date</strong>
<a class="headerlink" href="#practice_registrations.end_date" title="Permanent link">🔗</a>
<code>date</code>
</dt>
<dd markdown="block">
Date patient left practice.

</dd>
</div>

<div markdown="block">
<dt id="practice_registrations.practice_pseudo_id">
<strong>practice_pseudo_id</strong>
<a class="headerlink" href="#practice_registrations.practice_pseudo_id" title="Permanent link">🔗</a>
<code>integer</code>
</dt>
<dd markdown="block">
Pseudonymised practice identifier.

* Never `NULL`
</dd>
</div>

</dl>
</div>
<div markdown="block" class="definition-list-wrapper">
<div class="title">Methods</div>
<dl markdown="block">
<div markdown="block">
<dt id="practice_registrations.for_patient_on">
<strong>for_patient_on(</strong>date<strong>)</strong>
<a class="headerlink" href="#practice_registrations.for_patient_on" title="Permanent link">🔗</a>
<code></code>
</dt>
<dd markdown="block">
Return each patient's practice registration as it was on the supplied date.

Where a patient is registered with multiple practices we prefer the most recent
registration and then, if there are multiple of these, the one with the longest
duration. If there's stil an exact tie we choose arbitrarily based on the
practice ID.
<details markdown="block">
<summary>View method definition</summary>
```py
spanning_regs = practice_registrations.where(practice_registrations.start_date <= date).except_where(
practice_registrations.end_date < date
)
ordered_regs = spanning_regs.sort_by(
practice_registrations.start_date,
practice_registrations.end_date,
practice_registrations.practice_pseudo_id,
)
return ordered_regs.last_for_patient()

```
</details>
</dd>
</div>

<div markdown="block">
<dt id="practice_registrations.spanning">
<strong>spanning(</strong>start_date, end_date<strong>)</strong>
<a class="headerlink" href="#practice_registrations.spanning" title="Permanent link">🔗</a>
<code></code>
</dt>
<dd markdown="block">
Filter registrations to just those spanning the entire period between
`start_date` and `end_date`.
<details markdown="block">
<summary>View method definition</summary>
```py
return practice_registrations.where(
practice_registrations.start_date.is_on_or_before(start_date)
& (practice_registrations.end_date.is_after(end_date) | practice_registrations.end_date.is_null())
)

```
</details>
</dd>
</div>

</dl>
</div>
112 changes: 112 additions & 0 deletions docs/includes/generated_docs/schemas/emis.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ from ehrql.tables.emis import (
medications,
ons_deaths,
patients,
practice_registrations,
vaccinations,
)
```
Expand Down Expand Up @@ -568,6 +569,117 @@ return patients.registration_start_date.is_on_or_before(start_date) & (
</div>


<p class="dimension-indicator"><code>many rows per patient</code></p>
## practice_registrations

Each record corresponds to a patient's registration with a practice.

!!! warning
At present, the EMIS database contains only the patient's current practice
registration and does not include their full registration history.
<div markdown="block" class="definition-list-wrapper">
<div class="title">Columns</div>
<dl markdown="block">
<div markdown="block">
<dt id="practice_registrations.start_date">
<strong>start_date</strong>
<a class="headerlink" href="#practice_registrations.start_date" title="Permanent link">🔗</a>
<code>date</code>
</dt>
<dd markdown="block">
Date patient joined practice.

* Never `NULL`
</dd>
</div>

<div markdown="block">
<dt id="practice_registrations.end_date">
<strong>end_date</strong>
<a class="headerlink" href="#practice_registrations.end_date" title="Permanent link">🔗</a>
<code>date</code>
</dt>
<dd markdown="block">
Date patient left practice.

</dd>
</div>

<div markdown="block">
<dt id="practice_registrations.practice_pseudo_id">
<strong>practice_pseudo_id</strong>
<a class="headerlink" href="#practice_registrations.practice_pseudo_id" title="Permanent link">🔗</a>
<code>integer</code>
</dt>
<dd markdown="block">
Pseudonymised practice identifier.

* Never `NULL`
</dd>
</div>

</dl>
</div>
<div markdown="block" class="definition-list-wrapper">
<div class="title">Methods</div>
<dl markdown="block">
<div markdown="block">
<dt id="practice_registrations.for_patient_on">
<strong>for_patient_on(</strong>date<strong>)</strong>
<a class="headerlink" href="#practice_registrations.for_patient_on" title="Permanent link">🔗</a>
<code></code>
</dt>
<dd markdown="block">
Return each patient's practice registration as it was on the supplied date.

Where a patient is registered with multiple practices we prefer the most recent
registration and then, if there are multiple of these, the one with the longest
duration. If there's stil an exact tie we choose arbitrarily based on the
practice ID.
<details markdown="block">
<summary>View method definition</summary>
```py
spanning_regs = practice_registrations.where(practice_registrations.start_date <= date).except_where(
practice_registrations.end_date < date
)
ordered_regs = spanning_regs.sort_by(
practice_registrations.start_date,
practice_registrations.end_date,
practice_registrations.practice_pseudo_id,
)
return ordered_regs.last_for_patient()

```
</details>
</dd>
</div>

<div markdown="block">
<dt id="practice_registrations.spanning">
<strong>spanning(</strong>start_date, end_date<strong>)</strong>
<a class="headerlink" href="#practice_registrations.spanning" title="Permanent link">🔗</a>
<code></code>
</dt>
<dd markdown="block">
Filter registrations to just those spanning the entire period between
`start_date` and `end_date`.
<details markdown="block">
<summary>View method definition</summary>
```py
return practice_registrations.where(
practice_registrations.start_date.is_on_or_before(start_date)
& (practice_registrations.end_date.is_after(end_date) | practice_registrations.end_date.is_null())
)

```
</details>
</dd>
</div>

</dl>
</div>


<p class="dimension-indicator"><code>many rows per patient</code></p>
## vaccinations

Expand Down

0 comments on commit 2e47c90

Please sign in to comment.