Example #1
0
    def mapping(self):
        offset = 0
        mapping = {}
        identity_parts = []
        for axis in self.cube.axes:
            mapping[axis.name] = self.row[offset]
            identity_parts.append(self.row[offset])
            offset += 1

        for time in self.cube.times:
            time_from, time_until = parse_date(self.row[offset])
            identity_parts.append(self.row[offset])
            mapping[time.name] = {
                'value': self.row[offset],
                'from': time_from,
                'until': time_until
                }
            offset += 1

        for measure in self.cube.measures:
            m = {}
            if measure.data_type == 'GANZ':
                m['value'] = int(self.row[offset])
            else:
                m['value'] = float(self.row[offset])
            m['quality'] = self.row[offset+1]
            m['locked'] = self.row[offset+2]
            m['error'] = self.row[offset+3]
            mapping[measure.name] = m
            offset += 4

        mapping['fact_id'] = make_key(*identity_parts)
        return mapping
Example #2
0
    def mapping(self):
        offset = 0
        mapping = {}
        identity_parts = []
        for axis in self.cube.axes:
            mapping[axis.name] = self.row[offset].lower()
            identity_parts.append(self.row[offset])
            offset += 1

        for time in self.cube.times:
            time_from, time_until = parse_date(self.row[offset])
            identity_parts.append(self.row[offset])
            mapping[time.name] = {
                'value': self.row[offset],
                'from': time_from,
                'until': time_until
                }
            offset += 1

        for measure in self.cube.measures:
            m = {}
            if measure.data_type == 'GANZ':
                m['value'] = int(self.row[offset])
            else:
                m['value'] = float(self.row[offset])
            m['quality'] = self.row[offset+1]
            m['locked'] = self.row[offset+2]
            m['error'] = self.row[offset+3]
            mapping[measure.name] = m
            offset += 4

        mapping['fact_id'] = make_key(*identity_parts)
        return mapping
Example #3
0
from regenesis.mappings import KEYS_TRANSLATE, KEYS_IGNORE, KEYS_LOCALIZED
from regenesis.formats import parse_date, parse_bool
from regenesis.util import make_key, flatten

FIELD_TYPES = {
  'eu_vbd': parse_bool,
  'genesis_vbd': parse_bool,
  'regiostat': parse_bool,
  'secret_values': parse_bool,
  'spr_tmp': parse_bool,
  'trans_flag_2': parse_bool,
  'meta_variable': parse_bool,
  'summable': parse_bool,
  'atemporal': parse_bool,
  'valid_from': lambda d: parse_date(d)[0],
  'valid_until': lambda d: parse_date(d)[1],
  'pos_nr': int,
  'axis_order': int,
  'label_order': int,
  'float_precision': int
  }


class Section(object):

    def __init__(self, data):
        self._header = data[0].split(';')
        self._data = data[1:]
        self._rows = None
Example #4
0
from regenesis.mappings import KEYS_TRANSLATE, KEYS_IGNORE, KEYS_LOCALIZED
from regenesis.formats import parse_date, parse_bool
from regenesis.util import make_key, flatten

FIELD_TYPES = {
  'eu_vbd': parse_bool,
  'genesis_vbd': parse_bool,
  'regiostat': parse_bool,
  'secret_values': parse_bool,
  'spr_tmp': parse_bool,
  'regiostat': parse_bool,
  'trans_flag_2': parse_bool,
  'meta_variable': parse_bool,
  'summable': parse_bool,
  'atemporal': parse_bool,
  'valid_from': lambda d: parse_date(d)[0],
  'valid_until': lambda d: parse_date(d)[1],
  'pos_nr': int,
  'axis_order': int,
  'label_order': int,
  'float_precision': int
  }

class Section(object):

    def __init__(self, data):
        self._header = data[0].split(';')
        self._data = data[1:]
        self._rows = None

    @property