import os
import json
from pickler import decompress_pickle

class CharacteristicsReference():
    def __init__(self):
        self.data = decompress_pickle(f'{os.path.dirname(__file__)}/data/Characteristics.pbz2')

    def get_characteristic_by_id(self, idv):
        idv = int(idv)
        for item in self.data:
            if idv == item['id']:
                return item
        return None

characteristics_reference = CharacteristicsReference()