def get_creation_count(self, doctype, minutes):
		from frappe.utils import now_datetime
		from dateutil.relativedelta import relativedelta

		return frappe.db.sql("""select count(name) from `tab{doctype}`
			where creation >= %s""".format(doctype=doctype),
			now_datetime() - relativedelta(minutes=minutes))[0][0]
Get count of records created in the last x minutes
dataset/ETHPy150Open frappe/frappe/frappe/database.py/Database.get_creation_count