Skip to content

Commit

Permalink
Merge pull request #89 from CLIMB-TRE/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
tombch authored Sep 17, 2024
2 parents ac5250c + af3a7f1 commit 685ead5
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 2 deletions.
44 changes: 43 additions & 1 deletion docs/fields/lookups.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Different [types][types] have different lookups available to them.
[`[date]`][date]
[`[datetime]`][datetime]
[`[bool]`][bool]
[`[array]`][array]
[`[structure]`][structure]

Return values equal to the search value.

Expand Down Expand Up @@ -54,6 +56,8 @@ Return values that are not within the set of search values.
## `contains`

[`[text]`][text]
[`[array]`][array]
[`[structure]`][structure]

Return values that contain the search value.

Expand Down Expand Up @@ -96,18 +100,21 @@ Return values that case-insensitively end with the search value.
## `length`

[`[text]`][text]
[`[array]`][array]

Return values with a length equal to the search value.

## `length__in`

[`[text]`][text]
[`[array]`][array]

Return values with a length that is within the set of search values.

## `length__range`

[`[text]`][text]
[`[array]`][array]

Return values with a length that is within an inclusive range of search values.

Expand Down Expand Up @@ -208,9 +215,44 @@ Return values with an ISO 8601 week number that is within an inclusive range of
[`[datetime]`][datetime]
[`[bool]`][bool]
[`[relation]`][relation]
[`[array]`][array]
[`[structure]`][structure]

Return values that are empty (`isnull = True`) or non-empty (`isnull = False`).

* For [`text`][text] and [`choice`][choice] types, 'empty' is defined as the empty string `""`.
* For the [`relation`][relation] type, 'empty' is defined as there being zero items linked to the record being evaluated.
* For all other types, 'empty' is the SQL `null` value.
* For the [`array`][array] type, 'empty' is defined as the empty array `[]`.
* For the [`structure`][structure] type, 'empty' is defined as the empty structure `{}`.
* For all other types, 'empty' is the SQL `null` value.

## `contained_by`

[`[array]`][array]
[`[structure]`][structure]

Return values that are equal to, or a subset of, the search value.

## `overlap`

[`[array]`][array]

Return values that overlap with the search value.

## `has_key`

[`[structure]`][structure]

Return values that have a top-level key which contains the search value.

## `has_keys`

[`[structure]`][structure]

Return values that have top-level keys which contains all of the search values.

## `has_any_keys`

[`[structure]`][structure]

Return values that have top-level keys which contains any of the search values.
47 changes: 46 additions & 1 deletion docs/fields/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Each field belongs to a certain type. This dictates what kind of data the field
[`[length__range]`][length__range]
[`[isnull]`][isnull]

A string of characters.

**Examples:** `"C-1234567890"`, `"Details about something"`

## `choice`
Expand All @@ -32,6 +34,8 @@ Each field belongs to a certain type. This dictates what kind of data the field
[`[notin]`][notin]
[`[isnull]`][isnull]

A restricted set of options.

**Examples:** `"ENG"`, `"WALES"`, `"SCOT"`, `"NI"`

## `integer`
Expand All @@ -47,6 +51,8 @@ Each field belongs to a certain type. This dictates what kind of data the field
[`[range]`][range]
[`[isnull]`][isnull]

A whole number.

**Examples:** `1`, `-1`, `123`

## `decimal`
Expand All @@ -62,6 +68,8 @@ Each field belongs to a certain type. This dictates what kind of data the field
[`[range]`][range]
[`[isnull]`][isnull]

A decimal number.

**Examples:** `1.234`, `1.0`, `23.456`

## `date`
Expand All @@ -83,6 +91,8 @@ Each field belongs to a certain type. This dictates what kind of data the field
[`[week__range]`][week__range]
[`[isnull]`][isnull]

A date.

**Examples:** `"2023-03"`, `"2023-04-05"`, `"2024-01-01"`

## `datetime`
Expand All @@ -104,6 +114,8 @@ Each field belongs to a certain type. This dictates what kind of data the field
[`[week__range]`][week__range]
[`[isnull]`][isnull]

A date and time.

**Examples:** `"2023-01-01 15:30:03"`, `"2024-01-01 09:30:17"`

## `bool`
Expand All @@ -114,8 +126,41 @@ Each field belongs to a certain type. This dictates what kind of data the field
[`[notin]`][notin]
[`[isnull]`][isnull]

A true or false value.

**Examples:** `True`, `False`

## `relation`

[`[isnull]`][isnull]
[`[isnull]`][isnull]

A link to a row, or multiple rows, in another table.

## `array`

[`[exact]`][exact]
[`[contains]`][contains]
[`[contained_by]`][contained_by]
[`[overlap]`][overlap]
[`[length]`][length]
[`[length__in]`][length__in]
[`[length__range]`][length__range]
[`[isnull]`][isnull]

A list of values.

**Examples:** `[1, 2, 3]`, `["hello", "world", "!"]`

## `structure`

[`[exact]`][exact]
[`[contains]`][contains]
[`[contained_by]`][contained_by]
[`[has_key]`][has_key]
[`[has_keys]`][has_keys]
[`[has_any_keys]`][has_any_keys]
[`[isnull]`][isnull]

An arbitrary JSON structure.

**Examples:** `{"hello" : "world", "goodbye" : "!"}`, `{"numbers" : [1, 2, {"more_numbers" : [3, 4, 5]}]}`

0 comments on commit 685ead5

Please sign in to comment.