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
[X] Bug fix (non-breaking change which fixes an issue)
[X] New feature (non-breaking change which adds functionality)
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: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
json
field