codeforamerica / classifyr

A tool for aggregating and crowd-sourcing the classification emergency call data
MIT License
0 stars 1 forks source link

Fix missing examples for the "LAU - Larceny Under $250" call type #96

Closed T-Dnzt closed 2 years ago

T-Dnzt commented 2 years ago

Overview

Fix missing examples for some call types in production. It seems the issue was the $ sign in "LAU - Larceny Under $250" which needs to be escaped for the grep function to work properly:

To search for a $ (dollar sign) in the file named test2, enter:

grep \\$ test2

The \\ (double backslash) characters are necessary in order to force the shell to pass a \$ (single backslash, dollar sign) to the grep command. The \ (single backslash) character tells the grep command to treat the following character (in this example the $) as a literal character rather than an expression character. Use the fgrep command to avoid the necessity of using escape characters such as the backslash.

This does however seem to be working fine for me locally which made this a bit harder to debug. I tested escaping the $ sign in the production Rails console but we'll need to confirm that the issue is actually resolved once this is live.

I also added some logic to store the examples and avoid redownloading the file every time a call type needs to be classified.

Type of change

Related tickets

Fixes #85

Changes