https://github.com/lresende/rest-aggregator
Rest Aggregator
https://github.com/lresende/rest-aggregator
Last synced: 4 months ago
JSON representation
Rest Aggregator
- Host: GitHub
- URL: https://github.com/lresende/rest-aggregator
- Owner: lresende
- License: apache-2.0
- Created: 2017-06-26T18:40:12.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-26T18:41:33.000Z (over 8 years ago)
- Last Synced: 2025-01-17T09:36:53.393Z (9 months ago)
- Language: Java
- Homepage:
- Size: 53.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# File Aggregation Service
This service provides a fast/easy CSV aggregation of csv data. The current service REST API accepts a csv, a column to group on, and a column to aggregate and returns the result as plain text.
The service implementation is done using Apache Tuscany, which in the scope of this REST Service, provides a thin wrapper to a JAX-RS framework and enable service composition.
## Sample Input Data
```
first_name,last_name,count
piers,smith,10
kristen,smith,17
john,lee,3
sam,eagle,15
john,eagle,19```
## Sample aggregated output
```
smith,27
lee,3
eagle,34
```## Building the service
```
mvn clean install
```## Starting the service
```
mvn exec:java
```## Service invocation example
* Process input.csv and group on column 'last_name' and aggregate column 'count'
```
curl -X POST -H "Content-Type: multipart/form-data" -F "body=@input.csv" "http://localhost:8080/services/aggregator/csv?keyColumn=last_name&valueColumn=count"
```* Process generated_input.csv and group on column 'last_name' and aggregate column 'count'
```
curl -X POST -H "Content-Type: multipart/form-data" -F "body=@generated_input.csv" "http://localhost:8080/services/aggregator/csv?keyColumn=last_name&valueColumn=count"
```* Process generated_input.csv and group on column 'last_name' and aggregate column 'count'
```
curl -X POST -H "Content-Type: multipart/form-data" -F "body=@generated_input.csv" "http://localhost:8080/services/aggregator/csv?keyColumn=first_name&valueColumn=count"
```Note: Make sure you are in the same folder as the available csv files (e.g. src/test/resources)