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 21AA7F5FA for ; Mon, 1 Apr 2013 09:56:37 +0000 (UTC) Received: (qmail 62216 invoked by uid 500); 1 Apr 2013 09:56:35 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 62146 invoked by uid 500); 1 Apr 2013 09:56:35 -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 62106 invoked by uid 99); 1 Apr 2013 09:56:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Apr 2013 09:56:33 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of manokaran@gmail.com designates 74.125.82.44 as permitted sender) Received: from [74.125.82.44] (HELO mail-wg0-f44.google.com) (74.125.82.44) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Apr 2013 09:56:28 +0000 Received: by mail-wg0-f44.google.com with SMTP id z12so1884699wgg.11 for ; Mon, 01 Apr 2013 02:56:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=BmI+FPCJ72bp2T8CwEwl62HOii4/QfNyzyDjxz/vNtM=; b=Y4CivIkuj8zuvairD6RVD60NALM19FDV8P8gQxBQjVBThyF26yTysRHrQNFC0QhcqF Kxtn7Q9qN8gYhtf0ZreaYKVvMEBKaS0g+TIMaq7WrGhqamX6DNoVQblSPDtgnbDhmQ3S 43P9p/6FPCtE3Zlx7OK80IxIZjLXPI1BpVHinGMUKu2spEnULMpEt3dZnzo5DVp8BY0i nHM0jsx3CSFp/UPa11XhMFD+Ja+f4TALUvfcW1LokEMVlI5NRsyHi4BFPIz2zzD2S/5X oYnubV/j9d+QfQXmFsGyj5R5+CFsYDx6DL4cjCX2tMhY4S1zkIPbxlyLfuK74pgS5Oo9 jnMw== MIME-Version: 1.0 X-Received: by 10.180.38.105 with SMTP id f9mr8991264wik.15.1364810167433; Mon, 01 Apr 2013 02:56:07 -0700 (PDT) Sender: manokaran@gmail.com Received: by 10.194.89.169 with HTTP; Mon, 1 Apr 2013 02:56:07 -0700 (PDT) In-Reply-To: References: Date: Mon, 1 Apr 2013 15:26:07 +0530 X-Google-Sender-Auth: dYIs6my4l_YG0HJ93BYl66hHMmU Message-ID: Subject: Re: getting list of items spanning a time period From: Manokaran K To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=e89a8f6439b437412f04d949a1f9 X-Virus-Checked: Checked by ClamAV on apache.org --e89a8f6439b437412f04d949a1f9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 'admission_date:[' + fromDate + '%20TO%20' + tillDate + ']' + '%20OR%20' + 'discharge_date:[' + fromDate + '%20TO%20' + tillDate + ']' + '%20OR%20' + '\(' + admission_date:[' + beforeFromDate + '%20TO%20' + fromDate + ']' + '%20AND%20' + 'discharge_date:[' + tillDate + '%20TO%20' + afterTillDate + ']' + '\)' + '%20OR%20\(' + 'admission_date:[' + beforeFromDate + '%20TO%20' + fromDate + ']' + '%20AND%20' + 'status:under_treatment' + '\)' + On Mon, Apr 1, 2013 at 3:18 PM, Robert Newson wrote: > 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 > period - > >> 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 > earlier > >> than the start of the period but who got discharged after the time > period > >> or who are not discharged yet? > >> > >> Am currently using couchdb-lucene to get this list but would like to > know > >> 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 > for > >> 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, fo= r > >> tomorrow we may have to eat them. > >> -Sen. Morris Udall > >> > --=20 K Manokaran Chief Executive Officer MindPlough Analytics Pvt Ltd (SmartGrader is the flagship service of MindPlough) Mobile: +91 98400 88688 --e89a8f6439b437412f04d949a1f9--