ppazos / cabolabs-ehrserver

Open platform to manage and share standardized clinical data, designed by @ppazos at CaboLabs Health Informatics.
https://cabolabs.com
Apache License 2.0
179 stars 110 forks source link

Accept querying by constrained null flavour #956

Closed ppazos closed 4 years ago

ppazos commented 6 years ago
  1. ELEMENT.null_flavour is a DV_CODED_TEXT,
  2. the openEHR terminology defines the possible codes
  3. on templates, some codes can be excluded, generating a constraint with the allowed codes in the OPT, like:
<attributes xsi:type="C_SINGLE_ATTRIBUTE">
                      <rm_attribute_name>null_flavour</rm_attribute_name>
                      <existence>
                        <lower_included>true</lower_included>
                        <upper_included>true</upper_included>
                        <lower_unbounded>false</lower_unbounded>
                        <upper_unbounded>false</upper_unbounded>
                        <lower>0</lower>
                        <upper>1</upper>
                      </existence>
                      <children xsi:type="C_COMPLEX_OBJECT">
                        <rm_type_name>DV_CODED_TEXT</rm_type_name>
                        <occurrences>
                          <lower_included>true</lower_included>
                          <upper_included>true</upper_included>
                          <lower_unbounded>false</lower_unbounded>
                          <upper_unbounded>false</upper_unbounded>
                          <lower>1</lower>
                          <upper>1</upper>
                        </occurrences>
                        <node_id />
                        <attributes xsi:type="C_SINGLE_ATTRIBUTE">
                          <rm_attribute_name>defining_code</rm_attribute_name>
                          <existence>
                            <lower_included>true</lower_included>
                            <upper_included>true</upper_included>
                            <lower_unbounded>false</lower_unbounded>
                            <upper_unbounded>false</upper_unbounded>
                            <lower>1</lower>
                            <upper>1</upper>
                          </existence>
                          <children xsi:type="C_CODE_PHRASE">
                            <rm_type_name>CODE_PHRASE</rm_type_name>
                            <occurrences>
                              <lower_included>true</lower_included>
                              <upper_included>true</upper_included>
                              <lower_unbounded>false</lower_unbounded>
                              <upper_unbounded>false</upper_unbounded>
                              <lower>1</lower>
                              <upper>1</upper>
                            </occurrences>
                            <node_id />
                            <terminology_id>
                              <value>openehr</value>
                            </terminology_id>
                            <code_list>271</code_list>
                            <code_list>253</code_list>
                          </children>
                        </attributes>
                      </children>
                    </attributes>

a. Process OPTs and index null_flavour nodes, considering those possible nodes b. Check if indexing, that is now generating null_flavour codes, asks the OPT if it has that constraint before generating the index, the index should be generated considering the declared constraint if it exists c. Query builder should use the codes defined in the OPT for query criteria, if the OPT has a null flavour constraint declared