def from_dict()

in collection_manager/collection_manager/entities/Collection.py [0:0]


    def from_dict(properties: dict):
        """
        Accepting either `variable` or `variables` from the configmap
        """
        logger.debug(f'incoming properties dict: {properties}')
        try:
            date_to = datetime.fromisoformat(properties['to']) if 'to' in properties else None
            date_from = datetime.fromisoformat(properties['from']) if 'from' in properties else None

            preprocess = json.dumps(properties['preprocess']) if 'preprocess' in properties else None

            collection = Collection(dataset_id=properties['id'],
                                    projection=properties['projection'],
                                    dimension_names=frozenset(Collection.__decode_dimension_names(properties['dimensionNames'])),
                                    slices=frozenset(properties['slices'].items()),
                                    path=properties['path'],
                                    historical_priority=properties['priority'],
                                    forward_processing_priority=properties.get('forward-processing-priority', None),
                                    date_to=date_to,
                                    date_from=date_from,
                                    preprocess=preprocess)
            return collection
        except KeyError as e:
            raise MissingValueCollectionError(missing_value=e.args[0])