def delivered(self, start_date=None, end_date=None): if start_date: start_date = parser.parse(start_date) if end_date: end_date = parser.parse(end_date) else: end_date = datetime.now() view = self.application.projects_db.view("date/m_bp_delivered", group_level=3) delivered = OrderedDict() start = [start_date.year, (start_date.month - 1) // 3 + 1, start_date.month, start_date.day] end = [end_date.year, (end_date.month - 1) // 3 + 1, end_date.month, end_date.day] for row in view[start:end]: y = row.key[0] m = row.key[2] delivered[dthandler(datetime(y, m, 1))] = int(row.value * 1e6) return delivered
def delivered(self, start_date=None, end_date=None): if start_date: start_date = parser.parse(start_date) if end_date: end_date = parser.parse(end_date) else: end_date = datetime.now() view = self.application.projects_db.view("date/m_bp_delivered", group_level=3) delivered = OrderedDict() start = [start_date.year, (start_date.month - 1) // 3 + 1, start_date.month, start_date.day] end = [end_date.year, (end_date.month - 1) // 3 + 1, end_date.month, end_date.day] for row in view[start:end]: y = row.key[0] m = row.key[2] delivered[dthandler(datetime(y, m, 1))] = int(row.value * 1e6) return delivered
def produced(self, start_date=None, end_date=None): if start_date: start_date = parser.parse(start_date) if end_date: end_date = parser.parse(end_date) else: end_date = datetime.now() view = self.application.samples_db.view("barcodes/date_read_counts", group_level=2) produced = OrderedDict() start = [start_date.year - 2000, (start_date.month - 1) // 3 + 1, start_date.month, start_date.day] end = [end_date.year - 2000, (end_date.month - 1) // 3 + 1, end_date.month, end_date.day] for row in view[start:end]: y = int("20" + str(row.key[0])) q = row.key[1] produced[dthandler(datetime(y, (q - 1) * 3 + 1, 1))] = int(row.value) return produced
def produced(self, start_date=None, end_date=None): if start_date: start_date = parser.parse(start_date) if end_date: end_date = parser.parse(end_date) else: end_date = datetime.now() view = self.application.samples_db.view("barcodes/date_read_counts", group_level=2) produced = OrderedDict() start = [start_date.year - 2000, (start_date.month - 1) // 3 + 1, start_date.month, start_date.day] end = [end_date.year - 2000, (end_date.month - 1) // 3 + 1, end_date.month, end_date.day] for row in view[start:end]: y = int("20" + str(row.key[0])) q = row.key[1] produced[dthandler(datetime(y, (q - 1) * 3 + 1, 1))] = int(row.value) return produced