def __init__(self, flow): self.options = flow["options"] self.independentDays = self.options.get("independentDays", []) self.country = MediationConfig.getCountryByName(flow["country"]) self.HOLIDAYS = [] for holiday in self.country["holidays"]: day, month = holiday.split(".") self.HOLIDAYS.append((int(day), int(month))) pass
def __init__(self, date, flows, granularity=0): self.flows = flows self.flow = flows[0] self.date = date self.granularity = granularity self.dates = SimilarPastDaysFinder(self.flow).findSimilarPastDays(date) country = MediationConfig.getCountryByName(self.flow["country"]) self.options = self.flow["options"] self.adjustment = None lazyDayDifference = self.flow["options"].get("lazyDayDifference", None) if lazyDayDifference != None: for lazyDayStr in country["lazyDays"]: lazyDay = util.stringToDate(lazyDayStr) if lazyDay.date() == date.date(): self.adjustment = lazyDayDifference break
def getEnabledCountry(country): return jsonify( {"enabled": MediationConfig.getCountryByName(country)["enabled"]})
0.796042342418818, 0.9346540748162848, 0.7939754809772508, 0.962470501562014, 0.9929573860362824, 1]}, {"lobName": 'EWG', "data": [0.9761478362504887, 0.9583614156352167, 1.2336652720530112, 1.1580357149388305, 1.090568389327002, 0.9600084918076629, 0.9568424857376663, 0.8256895883325289, 0.5914861789815206, 1.0121511182076122, 0.8653533492971078, 0.5704172842604073, 0.538653445993039, 0.5164638232491638, 0.4858079169661382, 0.41779533433377064, 0.7993573176963311, 0.9092267083181577, 1.007730199059085, 1.0702191864202208, 0.9082408024540793, 1]}, {"lobName": 'TPP', "data": [0.9994509893629189, 0.9329863891112891, 0.8681779342746304, 0.8697074230973179, 0.8752423267949921, 0.8735428814090898, 0.872957061838658, 0.8761341580186848, 0.8998970751542529, 0.8653601909437505, 0.8668891761965745, 0.7537979083127982, 0.9302389942504077, 0.9967766261759137, 0.9968273519280757, 0.9897328514978554, 0.8680083180866294, 0.9732343917814772, 0.9873704480552615, 0.9832499869540516, 0.9831210955086642, 1]}] CZ_LOBS = MediationConfig.getCountryByName("CZ") # CZ_LOBS = ["SMS", "GSM", "MMS"] def getnormalizedFlowLevel(lobName, granularity=0): fromDate = util.jsStringToDate("2016-12-15T00:00:00.000Z").replace(hour=0, minute=0, second=0) toDate = util.jsStringToDate("2017-01-05T00:00:00.000Z").replace(hour=0, minute=0, second=0) response = {} mongoQuery = data_query.DateRangeGroupQuery(fromDate, toDate, [lobName], granularity) data = mongoQuery.execute() metrics = {} metricsList = mongoQuery.metrics metadata = mongoQuery.metadata data = data_query.medianDateRange(fromDate, toDate, lobName, granularity, data) return util.dateDataListToList(data, "normalizedFlowLevel")