Skip to content

Checklist for adding support to new datavalues

Pablo Pazos edited this page Jun 13, 2017 · 5 revisions

This is a list of changes needed to support new datavalues.

  1. src/groovy/com/cabolabs/ehrserver/data/DataValues.groovy

Add datavalue to the enum.

  1. grails-app/domain/com/cabolabs/ehrserver/ehr/clinical_documents/data/DvXXXXIndex.groovy

Create class for the specific datavalue, that will be instantiated by the data indexer.

  1. grails-app/services/com/cabolabs/ehrserver/data/DataIndexerService.groovy

Create correspondent indexing method:

private DvXXXXXIndex create_DV_XXXXX_index(
  GPathResult node,
  String templateId, String path,
  String archetypeId, String archetypePath,
  CompositionIndex owner)
  1. grails-app/controllers/com/cabolabs/ehrserver/query/QueryController.groovy

Add criteria:

def getCriteriaSpec(String archetypeId, String path, String datatype)
{
  // TODO: simplificar a metodo dinamico + try catch por si pide cualquier cosa.
  def res = []
  switch (datatype) {
    case 'DV_QUANTITY':
     res = DataCriteriaDV_QUANTITY.criteriaSpec(archetypeId, path)
    break
    ...
  1. grails-app/domain/com/cabolabs/ehrserver/query/Query.groovy

Add criteria processing for updateInstance:

   json.where.each { criteria ->
        
        switch (criteria['class']) {
           case 'DataCriteriaDV_QUANTITY':
           ...

Add datavalue to queryDataGroupComposition:

   switch (dataGet.rmTypeName)
    {
        case 'DV_QUANTITY':
        ...

Add datavalue to queryDataGroupByComposition:

switch (colData['type'])
{
   case 'DV_QUANTITY':
   ...

Add datavalue to queryDataGroupByPath:

switch (dataGet.rmTypeName)
{
   case 'DV_QUANTITY': // FIXME: this is a bug on adl parser it uses Java types instead of RM ones
     ...

Add datavalue to executeComposition:

switch (idxtype)
{
   // ADL Parser bug: uses Java class names instead of RM Type Names...
  // FIXME: we are not working with ADL any more, the java types can be removed...
  case 'DV_DATE_TIME':
    ...
  1. grails-app/views/query/create.gsp

For datavalues that can have possible values from archetype/template:

var possible_values;
switch (datatype)
{
   case 'DV_CODED_TEXT':
      possible_values = conditions['codes'];
      delete conditions['codes']; // Deletes the codes attribute
   break;
   case 'DV_QUANTITY':
      possible_values = conditions['units'];
      delete conditions['units']; // Deletes the codes attribute
   break;
}

For datavalues that have specific HTML5 input types for the criteria:

var input_type = 'text';
var class_type = '';
switch ( datatype )
{
  case 'DV_QUANTITY':
    if (attr == 'magnitude') input_type = 'number';
  break;
  ...
  1. grails-app/assets/javascripts/query_test_and_execution.js

For processing numeric datavalues:

Add builder to var point_builders.

Add datavalue to array:

if ( $.inArray(dviseries.type, ['DV_QUANTITY', 'DV_COUNT', 'DV_PROPORTION', 'DV_ORDINAL', 'DV_DURATION']) == -1)
  1. grails-app/domain/com/cabolabs/ehrserver/query/datatypes/DataCriteriaDV_XXXXX.groovy

Create correspondent criteria class for compo queries, like:

grails-app/domain/com/cabolabs/ehrserver/query/datatypes/DataCriteriaDV_COUNT.groovy