Re: grouping by time interval

From: Michael Lush <mjlush(at)ebi(dot)ac(dot)uk>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: grouping by time interval
Date: 2009-04-03 09:39:17
Message-ID: Pine.LNX.4.64.0904031037170.24342@pigeon.ebi.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


On Wed, 1 Apr 2009, Larry Rosenman wrote:
> On Wed, 1 Apr 2009, Michael Lush wrote:
>> I'm writing a photo database for my family photos. I've got a massive back
>> log so I'd like to some large scale annotation and break things up into
>> manageable chunks.
>>
>> I think one useful assumption would be tha any set of photos taken within
>> of a few seconds of each other (say 5 or less) are /probably/ about the
>> same subject...
>>
>> How would I go about detecting and marking events where the time interval
>> between two photos is less than 5 seconds
>>
> [snip]
>
> Have a look at the OVERLAPS operator.

Thanks! That gets me to pairs of dates/IDs, where should I look to find
out how to extract and number the clusters of IDs?

photo_id | photo_time | photo_group
1 | 2005-08-20 19:05:15 |
2 | 2005-08-20 19:12:59 | 1
3 | 2005-08-20 19:13:03 | 1
4 | 2005-08-21 19:13:07 | 1
6 | 2005-08-21 13:02:48 |
8 | 2005-08-21 13:06:06 | 2
9 | 2005-08-21 13:06:10 | 2
10 | 2005-08-21 13:06:19 |

ie if 2 and 3 are about the same thing and 3 and 4 are about the same
thing, 2 and 4 are likely to be about the same thing, even though they
were taken more than 5 seconds apart.

--
Michael
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Michael John Lush PhD Tel:44-1223 492626
Bioinformatician
HUGO Gene Nomenclature Committee Email: hgnc(at)genenames(dot)org
European Bioinformatics Institute
Hinxton, Cambridge
URL: http://www.genenames.org
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Just E. Mail 2009-04-03 10:43:42 RPM for CentOS
Previous Message Mary Anderson 2009-04-03 00:58:10 Re: constraint is not dropped when table is dropped