Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C6A77F5E0 for ; Mon, 1 Apr 2013 09:48:28 +0000 (UTC) Received: (qmail 44657 invoked by uid 500); 1 Apr 2013 09:48:27 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 44606 invoked by uid 500); 1 Apr 2013 09:48:27 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 44590 invoked by uid 99); 1 Apr 2013 09:48:26 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Apr 2013 09:48:26 +0000 Received: from localhost (HELO mail-la0-f49.google.com) (127.0.0.1) (smtp-auth username rnewson, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Apr 2013 09:48:26 +0000 Received: by mail-la0-f49.google.com with SMTP id fs13so1969926lab.36 for ; Mon, 01 Apr 2013 02:48:24 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.112.24.165 with SMTP id v5mr5490726lbf.101.1364809704663; Mon, 01 Apr 2013 02:48:24 -0700 (PDT) Received: by 10.112.25.201 with HTTP; Mon, 1 Apr 2013 02:48:24 -0700 (PDT) In-Reply-To: References: Date: Mon, 1 Apr 2013 10:48:24 +0100 Message-ID: Subject: Re: getting list of items spanning a time period From: Robert Newson To: "user@couchdb.apache.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I'm not sure it's possible in a couchdb view, at least not a single call or view. The best I can think of a view keyed on admission_time and another on discharge_time. You'd have to do the set subtraction yourself, though. couchdb-lucene obviously does this for you. I assume you're doing boolean queries using admission_time and discharge_time fields? B. On 1 April 2013 10:38, =D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1= =80 =D0=9E=D0=BF=D0=B0=D0=BA wrote: > Use Cron(http://en.wikipedia.org/wiki/Cron) for this =3D) > > > 2013/4/1 Manokaran K > >> Hi, >> >> Am working on an hospital information system using couchdb and node.js. = For >> this I need to get the list and number of patients in a given time perio= d - >> usually a day. I can get the patients who were admitted or discharged in >> that time period. How to get the list of patients who were admitted earl= ier >> than the start of the period but who got discharged after the time perio= d >> or who are not discharged yet? >> >> Am currently using couchdb-lucene to get this list but would like to kno= w >> if there is a way where I can get it from a view - that way I can just >> reduce and get the number of patients in a given period. I was wondering= if >> I should use a scheduler that will create a new 'under_treatment' doc fo= r >> every day till the patient is discharged! Or is there a simpler way? >> >> Thanks in advance, >> mano >> >> -- >> Lord, give us the wisdom to utter words that are gentle and tender, for >> tomorrow we may have to eat them. >> -Sen. Morris Udall >>