HARPgroup / r-dh-ecohydro

A set of R scripts for generating Ecological Limit Functions (ELF), storing the modeled output with REST in drupal VAHydro (dH), and a set of scripts for querying and analyzing processed ELF data
0 stars 1 forks source link

Duplicate variable in om vocabulary #21

Open rburghol opened 6 years ago

rburghol commented 6 years ago

There is already a variable "om_element_connection" that I think is now duplicated by "om_element_id" -- I can't remember if I made both or not, but before deleting one I wanted to post up here in case someone else created it and are using it. Now, the "om_element_id" is probably a better name, but the old one was named in order to refer it as a connection to some external database, which is also what om_element_iddoes. Now, in the future we might want to specify an element_id that is separate from the hydroid, but for now I think these are duplicative. The duplicate is on beta only.

Original: d.bet/admin/content/dh_variabledefinition/manage/1119?destination=dh-list-variabledefinition/all/om Duplicate: d.bet/admin/content/dh_variabledefinition/manage/1331?destination=dh-list-variabledefinition/all/om

d.bet/dh-list-variabledefinition/all/om

rburghol commented 6 years ago

The om_element_id property is used to trigger an R script so shjould be renamed to reflect the script and then the elementid should be obtained from the entity's om_element_connection property using: dh_get_properties(&$values, $multiplicity, $load = FALSE)

Sample use (see: modules/dh_wsp/plugins/dh_variables/dHWaterDemandProjections.class.php):

      $replicant_varid =  dh_varkey2varid($varkey, TRUE);
      $replicant_info = array(
        'featureid' => $entity->featureid,
        'entity_type' => $entity->entity_type,
        'bundle' => 'dh_properties',
        'varid' => $replicant_varid,
      );
      // *************************************************
      // Current MGY
      // *************************************************
      $replicant_prec = dh_get_properties($replicant_info, 'singular');
      if ($replicant_prec) {
        $rec = array_shift($replicant_prec['dh_properties']);
        $replicant_prop = entity_load_single('dh_properties', $rec->pid);
      } else {
        $replicant_prop = entity_create('dh_properties', $replicant_info);
      }