<commit_before># Salt Torque Example

> Shows a single day of New York taxi cab pickups animated over the course of the day

This example illustrates how to use Salt to generate TileJSON output compatible with [CartoDB's Torque](https://github.com/CartoDB/Torque) library. Salt features used:

 - Loading and using CSV data in Spark
 - Custom, non-trivial bin aggregator
 - Compound tiling jobs (generates pickup and dropoff layers concurrently)
 - Custom output format serialization
 - Saving results to local filesystem on Spark Master

## Building the Example
To build the example you must first generate the TileJSON data (written to the `output/` directory) and then run the web app to view the results.

### Tile Generation

Tile generation is done using the code in the `generation/` directory. If you plan on using the included Docker container to run the example, ensure that it's built before continuing (see [root README](../README.md)).

Until Salt exists in the central Maven repo, instructions are a little more involved:

#### While container cannot build examples or to run locally

Build the example JAR
```
salt-examples/torque-example/generation $ ./gradlew assemble
```

Submit the built JAR to Spark
```
salt-examples/torque-example/ $ docker run -it -v `pwd`/output:/opt/output -v `pwd`/generation:/opt/salt docker.uncharted.software/salt-examples bash

container $ spark-submit --class software.uncharted.salt.examples.torque.Main /opt/salt/build/libs/salt-torque-example-0.1.0.jar /opt/data/taxi_one_day.csv /opt/output
```

Results are written to /opt/output in the container.


#### When container is able to build example JAR

Build the JAR and generate tiles in one command
```
salt-examples/torque-example/ $ docker run --rm -v `pwd`/output:/opt/output -v `pwd`/generation:/opt/salt docker.uncharted.software/salt-examples
```

To run the container interactively, run:
```
salt-examples/torque-example/ $ docker run -it -v `pwd`/output:/opt/output -v `pwd`/generation:/opt/salt docker.uncharted.software/salt-examples bash
```

### Viewing Results

Results are viewed through a simple web app contained in `webapp/`. After generating tiles, run from `webapp\`:

```
npm install
npm run start
```

The application will be available at http://localhost:3000/<commit_msg>Changed docker.uncharted.software to uncharted in Dockerfile.<commit_after># Salt Torque Example

> Shows a single day of New York taxi cab pickups animated over the course of the day

This example illustrates how to use Salt to generate TileJSON output compatible with [CartoDB's Torque](https://github.com/CartoDB/Torque) library. Salt features used:

 - Loading and using CSV data in Spark
 - Custom, non-trivial bin aggregator
 - Compound tiling jobs (generates pickup and dropoff layers concurrently)
 - Custom output format serialization
 - Saving results to local filesystem on Spark Master

## Building the Example
To build the example you must first generate the TileJSON data (written to the `output/` directory) and then run the web app to view the results.

### Tile Generation

Tile generation is done using the code in the `generation/` directory. If you plan on using the included Docker container to run the example, ensure that it's built before continuing (see [root README](../README.md)).

Until Salt exists in the central Maven repo, instructions are a little more involved:

#### While container cannot build examples or to run locally

Build the example JAR
```
salt-examples/torque-example/generation $ ./gradlew assemble
```

Submit the built JAR to Spark
```
salt-examples/torque-example/ $ docker run -it -v `pwd`/output:/opt/output -v `pwd`/generation:/opt/salt uncharted/salt-examples bash

container $ spark-submit --class software.uncharted.salt.examples.torque.Main /opt/salt/build/libs/salt-torque-example-0.1.0.jar /opt/data/taxi_one_day.csv /opt/output
```

Results are written to /opt/output in the container.


#### When container is able to build example JAR

Build the JAR and generate tiles in one command
```
salt-examples/torque-example/ $ docker run --rm -v `pwd`/output:/opt/output -v `pwd`/generation:/opt/salt uncharted/salt-examples
```

To run the container interactively, run:
```
salt-examples/torque-example/ $ docker run -it -v `pwd`/output:/opt/output -v `pwd`/generation:/opt/salt uncharted/salt-examples bash
```

### Viewing Results

Results are viewed through a simple web app contained in `webapp/`. After generating tiles, run from `webapp\`:

```
npm install
npm run start
```

The application will be available at http://localhost:3000/
{'fraction_non_alphanumeric': 0.09643012625163257, 'fraction_numerical': 0.0030474531998258597, 'mean_word_length': 4.287686996547756, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4478870', 'n_tokens_mistral': 1424, 'n_tokens_neox': 1268, 'n_words': 546}