Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structured query v2 #3

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

# Structured Queries

CODEX front-end allows users to create feasibility queries based on inclusion and exclusion criteria. The different inclusion and exclusion criteria are conjuncted with the "AND" and "OR" operators respectively. Resulting in a conjunctive normal form (CNF) for inclusion and disjunctive normal form (DNF) for the exclusion criteria.
CODEX front-end allows users to create feasibility queries based on inclusion and exclusion criteria. The different inclusion and exclusion criteria are conjuncted with the "AND" and "OR" operators respectively. Resulting in a conjunctive normal form without negation (CNF) for inclusion and disjunctive normal form without negation (DNF) for the exclusion criteria.

The front-end created queries need to be transmitted to different back-end services which translates the Structured Query format into other query formats such as FHIR Search or CQL. As common data exchange format the so called *Structured Queries* are defined.

Expand All @@ -15,24 +16,24 @@ The metadata provides some basic information about the query:
| Name | Description |
| :-------- | -------------------------------------- |
| Version | API Version |
| Timestamp | Timestamp when the query was send |
| Timestamp | Timestamp when the query was sent |
| queryId | unique Id to identify a specific query |

## Query

As previously introduced the query is based on inclusion and exclusion criteria represented in CNF and DNF.
As previously introduced, the query is based on inclusion and exclusion criteria represented in CNF and DNF.

With in the query both CNF and DNF are conjuncted with an "AND NOT" operator.
With in the query, both CNF and DNF are conjunct with an "AND NOT" operator.

For the normal Form different building blocks are provided to represent the conjunctions of criteria.
For the normal form, different building blocks are provided to represent the conjunctions of criteria.

## inclusionCriteria\[][]

Given a CNF: A and (B or C)

The inclusionCriteria is an array of arrays of criteria. Within the outer array all elements are conjuncted with "AND". Based on the example {A} {B or C}.
The inclusionCriteria is an array of arrays of criteria. Within the outer array, all elements are conjunct with "AND". Based on the example {A} {B or C}.

Within the inner array all elements are disjuncted with "OR". Based on the example {B}{C}. A special case is given if only one element is given e.g. {A}. In this case no logic operation is applied to this element in this hierarchic element.
Within the inner array all elements are disjunct with "OR". Based on the example {B}{C}. A special case is given if only one element is given, e.g. {A}. In this case, no logic operation is applied to this element in this hierarchic element.

-> inclusionCriteria= {{A}, {B, C}}

Expand All @@ -42,29 +43,25 @@ Analog for the exclusion criteria:

Given a DNF: A or (B and C)

The exclusionCriteria is an array of arrays of criteria. Within the outer array all elements are disjuncted with "OR". Based on the example {A} {B and C} .
The exclusionCriteria is an array of arrays of criteria. Within the outer array, all elements are disjunct with "OR". Based on the example {A} {B and C}.

Within the inner array all elements are conjuncted with "And". Based on the example {B}{C} . A special case is given if only one element is given e.g. {A}. In this case no logic operation is applied to this element in this hierarchic element.
Within the inner array all elements are conjunct with "And". Based on the example {B}{C} . A special case is given if only one element is given, e.g. {A}. In this case, no logic operation is applied to this element in this hierarchic element.

-> exclusionCriteria = {{A}, {B, C}}

## criterion

The previous introduced elements {A}, {B} and {C} are representative for different criteria.

Each criterion represents a unique concept or statement which is identified by its termCode. Which can be further specified by applying a value filter.
Each criterion represents a unique concept or statement, which is identified by its termCode. Which can be further specified by applying a value filter.

## termCode

The termCode defines a concept based on a coding system (i.e. LOINC). The triplet of code, system and version identify the concept. An additional display element allows for a human readable form (This value SHALL be the same as the value define by the coding system)
The termCode defines a concept based on a coding system (i.e. LOINC). The triplet of code, system and version identify the concept. An additional display element allows for a human-readable form (This value SHALL be the same as the value define by the coding system)

## valueFilter

ValueFilter specify the value of a defined concept. Depending on the valueFilter Type different value statements can be made.




ValueFilter specify the value of a defined concept. Depending on the valueFilter Type, different value statements can be made. The valueFilter restricts the value of the highest interest of the resource.

### quantity-comperator

Expand All @@ -85,26 +82,45 @@ A valueFilter of type quantity-comperator can be applied to all numeric criterio

A valueFilter of type quantity-range can be applied to all numeric criterion concepts to validate if a value is within the boundaries of the defined min and max values. Again a unit can be given.

## ConceptValueFilter
### DateTime-comperator

A valueFilter of type datetype can be applied to all datetime criterion concepts. It allows to use the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IHMO the type should be called date-time-comparator and not datetype to be on par with the quantity-comparator type name.


| Enumeration | Comparator |
| ----------- | ------------- |
| le | less equal |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we use ≥ and ≤ signs instead of less equal and greater equal like above?

| ge | greater equal |

ISO Datum

### DateTime-range

A valueFilter of type datetime-range can be applied to all datetime criterion concepts to validate if a value is an overlap exists between the criterions datetime and the interval explicitly or implicitly defined by the before and/or afterDate. ISO dateformat.

beforeDate

afterDate

### Concept-ValueFilter

A valueFilter of type concept can be applied to all concepts which have a value which itself is defined by a concept. The Value can be restricted by selectedConcepts which are termCodes. If multiple selectedConceptsare given the criterion is fulfilled if one of the values matches.

Example:

The patient gender is a concept and can be represented with a Termcode. The values female, male, diverse, etc. are also concepts representable by termCodes.

"All male or female patients" (PseudoCriterion):
"All male or female patients " (PseudoCriterion):

```json
{
"inclusionCriteria": [
[
{
"termCode": {
"termCode": [ {
"code": "LL2191-6",
"display": "Geschlecht",
"system": "http://loinc.org"
},
} ],
"valueFilter": {
"type": "concept",
"selectedConcepts": [
Expand All @@ -130,3 +146,6 @@ The patient gender is a concept and can be represented with a Termcode. The valu



## AttributeFilter[]

Attribute Filter are valueFilter for specific attributes of the Resource. The AttributeCode defined as termCode specifies which attribute is restricted.

This file was deleted.

Loading