Add first value and last value aggregations
- Dominant language
- Jupyter Notebook
- Stars
- 201
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
_From @shaycrk on August 31, 2017 22:8_
In some cases, we may want to build features that reflect the earliest known or most recent information about a characteristic such as charges at first arrest, current employment status, outcome of last inspection, etc.
The built-in postgres aggregate function (e.g., min, max, avg, etc) don't make this possible but `first` and `last` aggregates are available through a [postgres extension](https://wiki.postgresql.org/wiki/First/last_(aggregate)), which can be invoked with an `ORDER BY` clause in the aggregate call (e.g., `LAST(employment_status ORDER BY knowledge_date ASC)`.
I don't think it would be difficult to implement this here and would be useful, but how do we feel about providing options that rely on postgres extensions rather than built-in functionality?
_Copied from original issue: dssg/collate#97_
Contributor guide
Research direction
No implementation files, tests, or entry points are named. Start by locating the existing aggregation implementation and reviewing the linked PostgreSQL first/last aggregate extension, then clarify the supported API, extension dependency, ordering behavior, and test expectations. Done means the project has an agreed implementation scope for first-value and last-value aggregations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100