From da2e50362a52dfe1373867ee87d93015625c73aa Mon Sep 17 00:00:00 2001 From: David Evans Date: Fri, 13 Sep 2024 14:45:03 +0100 Subject: [PATCH 1/5] Fix incorrect docs link to method I spotted the MkDocs warning about this, but I don't remember seeing that before so possibly this is a consequence of upgrading MkDocs. --- docs/explanation/selecting-populations-for-study.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/explanation/selecting-populations-for-study.md b/docs/explanation/selecting-populations-for-study.md index fa6b5d51b..ddd6ada23 100644 --- a/docs/explanation/selecting-populations-for-study.md +++ b/docs/explanation/selecting-populations-for-study.md @@ -26,4 +26,4 @@ for further details of this transfer process. a patient did not change practice during a time period of interest. For TPP, - there is a [method to select patients with a continuous registration](../reference/schemas/tpp.md#practice_registrations.has_a_continuous_practice_registration_spanning). + there is a [method to select patients with a continuous registration](../reference/schemas/tpp.md#practice_registrations.spanning). From 4d64c1360017ab05d4f068949ae3547eb5cffd92 Mon Sep 17 00:00:00 2001 From: David Evans Date: Fri, 13 Sep 2024 15:01:33 +0100 Subject: [PATCH 2/5] Fix MkDocs link warnings These weren't actually broken links, they were just specified in a way where MkDocs was unable to verify them. But it's good to remove the warning noise so we don't miss genuine problems. --- ehrql/query_language.py | 2 +- ehrql/tables/tpp.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ehrql/query_language.py b/ehrql/query_language.py index 6044e6052..41c6bba00 100644 --- a/ehrql/query_language.py +++ b/ehrql/query_language.py @@ -68,7 +68,7 @@ def define_population(self, population_condition): ``` For more detail see the how-to guide on [defining - populations](../../how-to/define-population/). + populations](../how-to/define-population.md). """ if "population" in self.variables: raise AttributeError( diff --git a/ehrql/tables/tpp.py b/ehrql/tables/tpp.py index 8831d6dcd..b64ce9e47 100644 --- a/ehrql/tables/tpp.py +++ b/ehrql/tables/tpp.py @@ -1577,7 +1577,7 @@ class wl_clockstops(EventFrame): Note that a small number of rows contain values which are not in the list below. These are converted to NULL in this representation of the data. If you need to access the original values, please see the corresponding [raw - table](../raw.tpp/#wl_clockstops). + table](raw.tpp.md#wl_clockstops). """, constraints=[Constraint.Categorical(["routine", "urgent", "two week wait"])], ) @@ -1608,7 +1608,7 @@ class wl_clockstops(EventFrame): Note that a small number of rows contain values which are not in the list below. These are converted to NULL in this representation of the data. If you need to access the original values, please see the corresponding [raw - table](../raw.tpp/#wl_clockstops). + table](raw.tpp.md#wl_clockstops). """, constraints=[ Constraint.Categorical( @@ -1664,7 +1664,7 @@ class wl_openpathways(EventFrame): Note that a small number of rows contain values which are not in the list below. These are converted to NULL in this representation of the data. If you need to access the original values, please see the corresponding [raw - table](../raw.tpp/#wl_openpathways). + table](raw.tpp.md#wl_openpathways). """, constraints=[Constraint.Categorical(["routine", "urgent", "two week wait"])], ) @@ -1705,7 +1705,7 @@ class wl_openpathways(EventFrame): Note that a small number of rows contain values which are not in the list below. These are converted to NULL in this representation of the data. If you need to access the original values, please see the corresponding [raw - table](../raw.tpp/#wl_openpathways). + table](raw.tpp.md#wl_openpathways). """, constraints=[ Constraint.Categorical( From 970f27a84479bd38e4fed4e3599381c847e54f77 Mon Sep 17 00:00:00 2001 From: David Evans Date: Fri, 13 Sep 2024 14:47:38 +0100 Subject: [PATCH 3/5] fix: Remove old `examples.tutorial` schema This isn't used and wasn't referenced anywhere in the tutorial, but it got included in the auto-generated docs and showed up in search results where it caused confusion. --- ehrql/tables/examples/__init__.py | 0 ehrql/tables/examples/tutorial.py | 78 ------------------------------- 2 files changed, 78 deletions(-) delete mode 100644 ehrql/tables/examples/__init__.py delete mode 100644 ehrql/tables/examples/tutorial.py diff --git a/ehrql/tables/examples/__init__.py b/ehrql/tables/examples/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/ehrql/tables/examples/tutorial.py b/ehrql/tables/examples/tutorial.py deleted file mode 100644 index 57d790fe4..000000000 --- a/ehrql/tables/examples/tutorial.py +++ /dev/null @@ -1,78 +0,0 @@ -""" -This example schema is for use in the ehrQL tutorial. -""" - -import datetime - -from ehrql.tables import Constraint, EventFrame, PatientFrame, Series, table - - -__all__ = [ - "clinical_events", - "hospitalisations", - "patient_address", - "patients", - "prescriptions", -] - - -@table -class clinical_events(EventFrame): - """TODO.""" - - code = Series(str) - system = Series(str) - date = Series(datetime.date) - numeric_value = Series(float) - - -@table -class hospitalisations(EventFrame): - """TODO.""" - - date = Series(datetime.date) - code = Series(str) - system = Series(str) - - -@table -class patient_address(EventFrame): - """TODO.""" - - patientaddress_id = Series(int) - date_start = Series(datetime.date) - date_end = Series(datetime.date) - index_of_multiple_deprivation_rounded = Series(int) - has_postcode = Series(bool) - - -@table -class patients(PatientFrame): - date_of_birth = Series( - datetime.date, - description="Patient's date of birth, rounded to first of month", - constraints=[Constraint.FirstOfMonth(), Constraint.NotNull()], - ) - sex = Series( - str, - description="Patient's sex", - implementation_notes_to_add_to_description=( - 'Specify how this has been determined, e.g. "sex at birth", or "current sex".' - ), - constraints=[ - Constraint.NotNull(), - Constraint.Categorical(["female", "male", "intersex", "unknown"]), - ], - ) - date_of_death = Series( - datetime.date, - description="Patient's date of death", - ) - - -@table -class prescriptions(EventFrame): - """TODO.""" - - prescribed_dmd_code = Series(str) - processing_date = Series(datetime.date) From 6f5b55877660b82257dd676d379c030d3b958644 Mon Sep 17 00:00:00 2001 From: David Evans Date: Fri, 13 Sep 2024 15:07:07 +0100 Subject: [PATCH 4/5] Remove special case handling for tutorial schema --- ehrql/docs/render_includes/schemas.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ehrql/docs/render_includes/schemas.py b/ehrql/docs/render_includes/schemas.py index 984845ca3..d4fbbf0b1 100644 --- a/ehrql/docs/render_includes/schemas.py +++ b/ehrql/docs/render_includes/schemas.py @@ -21,11 +21,7 @@ def render_schema_index(schemas): def implemented_by_list(backends, depth=1): - if not backends: - return ( - "_This schema is for development or testing purposes and is not" - " available on any backend._" - ) + assert len(backends) > 0 if depth > 1: url_prefix = "/".join([".."] * (depth - 1)) + "/" else: From c3151f1fda657b21c64e9c11adbf74c8e452bef3 Mon Sep 17 00:00:00 2001 From: David Evans Date: Fri, 13 Sep 2024 15:04:44 +0100 Subject: [PATCH 5/5] Run `just docs-build` --- .../generated_docs/language__dataset.md | 2 +- docs/includes/generated_docs/schemas.md | 9 - .../schemas/examples.tutorial.md | 277 ------------------ docs/includes/generated_docs/schemas/tpp.md | 8 +- 4 files changed, 5 insertions(+), 291 deletions(-) delete mode 100644 docs/includes/generated_docs/schemas/examples.tutorial.md diff --git a/docs/includes/generated_docs/language__dataset.md b/docs/includes/generated_docs/language__dataset.md index 0a8c68275..a993a944f 100644 --- a/docs/includes/generated_docs/language__dataset.md +++ b/docs/includes/generated_docs/language__dataset.md @@ -38,7 +38,7 @@ dataset.define_population(patients.date_of_birth < "1990-01-01") ``` For more detail see the how-to guide on [defining -populations](../../how-to/define-population/). +populations](../how-to/define-population.md).
diff --git a/docs/includes/generated_docs/schemas.md b/docs/includes/generated_docs/schemas.md index 0bec3d566..1bee8df14 100644 --- a/docs/includes/generated_docs/schemas.md +++ b/docs/includes/generated_docs/schemas.md @@ -31,15 +31,6 @@ This schema defines the data (both primary care and externally linked) available OpenSAFELY-EMIS backend. For more information about this backend, see "[EMIS Primary Care](https://docs.opensafely.org/data-sources/emis/)". -## [examples.tutorial](schemas/examples.tutorial.md) - - view details → - - -_This schema is for development or testing purposes and is not available on any backend._ - -This example schema is for use in the ehrQL tutorial. - ## [raw.core](schemas/raw.core.md) view details → diff --git a/docs/includes/generated_docs/schemas/examples.tutorial.md b/docs/includes/generated_docs/schemas/examples.tutorial.md deleted file mode 100644 index 416307963..000000000 --- a/docs/includes/generated_docs/schemas/examples.tutorial.md +++ /dev/null @@ -1,277 +0,0 @@ -# examples.tutorial schema - -_This schema is for development or testing purposes and is not available on any backend._ - -This example schema is for use in the ehrQL tutorial. - -``` {.python .copy title='To use this schema in an ehrQL file:'} -from ehrql.tables.examples.tutorial import ( - clinical_events, - hospitalisations, - patient_address, - patients, - prescriptions, -) -``` - -

many rows per patient

-## clinical_events - -TODO. -
-
Columns
-
-
-
- code - 🔗 - string -
-
- - -
-
- -
-
- system - 🔗 - string -
-
- - -
-
- -
-
- date - 🔗 - date -
-
- - -
-
- -
-
- numeric_value - 🔗 - float -
-
- - -
-
- -
-
- - -

many rows per patient

-## hospitalisations - -TODO. -
-
Columns
-
-
-
- date - 🔗 - date -
-
- - -
-
- -
-
- code - 🔗 - string -
-
- - -
-
- -
-
- system - 🔗 - string -
-
- - -
-
- -
-
- - -

many rows per patient

-## patient_address - -TODO. -
-
Columns
-
-
-
- patientaddress_id - 🔗 - integer -
-
- - -
-
- -
-
- date_start - 🔗 - date -
-
- - -
-
- -
-
- date_end - 🔗 - date -
-
- - -
-
- -
-
- index_of_multiple_deprivation_rounded - 🔗 - integer -
-
- - -
-
- -
-
- has_postcode - 🔗 - boolean -
-
- - -
-
- -
-
- - -

one row per patient

-## patients - - -
-
Columns
-
-
-
- date_of_birth - 🔗 - date -
-
-Patient's date of birth, rounded to first of month - - * Always the first day of a month - * Never `NULL` -
-
- -
-
- sex - 🔗 - string -
-
-Patient's sex - - * Never `NULL` - * Possible values: `female`, `male`, `intersex`, `unknown` -
-
- -
-
- date_of_death - 🔗 - date -
-
-Patient's date of death - -
-
- -
-
- - -

many rows per patient

-## prescriptions - -TODO. -
-
Columns
-
-
-
- prescribed_dmd_code - 🔗 - string -
-
- - -
-
- -
-
- processing_date - 🔗 - date -
-
- - -
-
- -
-
diff --git a/docs/includes/generated_docs/schemas/tpp.md b/docs/includes/generated_docs/schemas/tpp.md index 5c341515a..1a75eee61 100644 --- a/docs/includes/generated_docs/schemas/tpp.md +++ b/docs/includes/generated_docs/schemas/tpp.md @@ -3035,7 +3035,7 @@ The priority type. Note that a small number of rows contain values which are not in the list below. These are converted to NULL in this representation of the data. If you need to access the original values, please see the corresponding [raw -table](../raw.tpp/#wl_clockstops). +table](raw.tpp.md#wl_clockstops). * Possible values: `routine`, `urgent`, `two week wait` @@ -3137,7 +3137,7 @@ The waiting list type on completion of the pathway. Note that a small number of rows contain values which are not in the list below. These are converted to NULL in this representation of the data. If you need to access the original values, please see the corresponding [raw -table](../raw.tpp/#wl_clockstops). +table](raw.tpp.md#wl_clockstops). * Possible values: `ORTT`, `IRTT`, `PTLO`, `PTLI`, `RTTO`, `RTTI` @@ -3222,7 +3222,7 @@ The priority type. Note that a small number of rows contain values which are not in the list below. These are converted to NULL in this representation of the data. If you need to access the original values, please see the corresponding [raw -table](../raw.tpp/#wl_openpathways). +table](raw.tpp.md#wl_openpathways). * Possible values: `routine`, `urgent`, `two week wait` @@ -3325,7 +3325,7 @@ The waiting list type. Note that a small number of rows contain values which are not in the list below. These are converted to NULL in this representation of the data. If you need to access the original values, please see the corresponding [raw -table](../raw.tpp/#wl_openpathways). +table](raw.tpp.md#wl_openpathways). * Possible values: `ORTT`, `IRTT`, `ONON`, `INON`, `PTLO`, `PTLI`, `RTTO`, `RTTI`