Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
335 changes: 335 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "rust-etl-code-test"
version = "0.1.0"
edition = "2024"

[dependencies]
anyhow = "1.0.98"
clap = { version = "4.5.40", features = ["derive"] }
csv = "1.3.1"
serdapt = "0.1.1"
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.140"
36 changes: 28 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
# Rust ETL Code Test

Fork this repo for this test. When you are done submit a PR against this repo.
## Purpose

Given the sample data provided, convert to csv in the format specified:
This command-line tool transforms a JSONL billing report into a CSV file containing the average rate
for each record, excluding records with an average rate greater than 30.

`name, billing_code, avg_rate` where `avg_rate` is the average of all `negotiated_rate` values for each record. Exclude records with an `avg_rate` greater than 30.
## Requirements

- Feel free to use any tools or libraries of your choice.
- The program should be as fast as possible.
- The program should accept inputs of unbounded size.
- The program should accept input from a file or STDIN.
- Output should be written to a file or STDOUT.
- Rust 1.87.0 or newer
- Internet connection for cargo to fetch dependencies

## Run

```sh
cargo run --release < sample.jsonl
```

## Run tests

```sh
cargo test
```

## Help

```sh
cargo run -- --help
```

## Notes

- Every error in the input is considered fatal. This could easily be changed if that is undesirable.
Loading