Remix on RegisterMeasurement made issues on client side when fetching data

#1

Hi there,
I’m remixing RegisterMeasurement adding two fields, the two reflect a field and are not time-series.
Although canonicals that transfer to RegisterMeasurement do or don’t fill these fields. But imperatively fill quantity field.

I presume this is the issue. but still not sure.

This is the message error I get when fetching:

Error: Unable to create custom instance of metadata.FetchResult

Here is the definition of RegisterMeasurement

@db(datastore='cassandra',
   partitionKeyField='parent',
   persistDuplicates=false,
   shortIdReservationRange=1000000)

remix type RegisterMeasurement {
  @ts(treatment='rate')
  quantity: ExactDimension

  energyValue: ExactDimension
  flagToZero: double
}

Transforms are the following:

@canonicalTransform(condition="calendarId != '' && calendarId != 'INCONNU' && registerId != 'INCONNU' && registerId != ''")
type TransformCanonicalMeasuremenGaztDaily mixes RegisterMeasurement transforms CanonicalMeasurementGazDaily {
    start: ~ expression "end == null ? null : dateTime(end)+period(1, 'DAY')"
    quantity: ~ expression "{value: endIndex != null ? endIndex : null, unit: {id: 'cubic_meter'}}"
    energyValue: ~ expression "{value: (volumeValue != null && conversionCoef != null)? conversionCoef * volumeValue: null, unit: {id: 'cubic_meter'}}"
    parent:  	~ expression {id: "concat('RMSD_', servicePointId,'_5G')"}
    isEstimated: ~ expression "false"
    flagToZero: ~ expression "flagToZero"
}

.

@canonicalTransform(condition="calendarId != '' && calendarId != 'INCONNU' && registerId != 'INCONNU' && registerId != ''")
type TransformCanonicalMeasurementDaily mixes RegisterMeasurement transforms CanonicalMeasurementDaily {
    start: ~ expression "end == null ? null : dateTime(end)+period(1, 'DAY')"
    /*end: ~ expression "end == null ? null : dateTime(end)+period(1, 'DAY')"*/
    quantity: ~ expression "{value: value != null ? value/1000 : null, unit: {id: 'kilowatt_hour'}}"
    parent:  	~ expression {id: "concat('RMSD_', servicePointId,'_5E','_',calendarId ,'_',registerId)"}
    isEstimated: ~ expression "false"
}

.

@canonicalTransform(condition='exists(endIndex) && rateType=="CO"')
type  TransformCanonicalMeasurementMonthlyToRegisterMeasurement mixes RegisterMeasurement transforms CanonicalMeasurementMonthly {
  start: 			~ expression "end == null ? null : dateTime(end)+period(1, 'DAY')"
  quantity: 		~ expression "{value: endIndex != null ? endIndex : null, unit: {id: resource == '5E' ? 'kilowatt_hour' : resource == '5G' ? 'cubic_meter' : ''}}"
  isEstimated: 		~ expression "false"
  parent:           ~ expression "resource == '5G' && registerId == '0' ? concat('RMSM_', servicePointId, '_5G', remoteMeasurement == 'L' ? '_R' : ''): resource == '5E' && registerId == '0'  ? concat('RMSM_', servicePointId, '_5E_',  registerId,'_', registerLabel, remoteMeasurement == 'L' ? '_R' : ''): registerId == null ? concat('RMSM_', servicePointId, '_', resource, '_', remoteMeasurement == 'L' ? '_R' : '') : concat('RMSM_', servicePointId, '_', resource, '_', registerId, remoteMeasurement == 'L' ? '_R' : '')"
  }

Thanks in advance

0 Likes

#2

All looks good: type definition, canonical and transform.
It seems the problem is related to bad characters in the imported file.

0 Likes