> For the complete documentation index, see [llms.txt](https://docs.boston.gov/digital/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.boston.gov/digital/guides/legacy-website-cityofboston.gov/streetbook.md).

# Streetbook

A classic ASP app which allows resident to look up streets and get static information about the street.

<figure><img src="https://2423273671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LVe9jGOEzVjCQBf8nyS%2Fuploads%2FrOPkOfeUramp7JP80mtr%2Fimage.png?alt=media&amp;token=ecb1bb25-f0c4-4182-91b1-eb83336381ac" alt=""><figcaption></figcaption></figure>

## Basic Information

<table data-header-hidden><thead><tr><th width="199"></th><th></th></tr></thead><tbody><tr><td><strong>App Server</strong></td><td><code>ZPCOBWEB01</code></td></tr><tr><td><strong>Files location</strong></td><td><code>D:\wwwcob\publicworks\streetbook</code></td></tr><tr><td><strong>App files</strong></td><td><p><code>default.asp</code> - landing page, contains search textbox</p><p><code>qryResponse.asp</code> - runs the query to find streets matching search entered and returns table of results,</p><p><code>qryResponse2.asp</code> - runs a query to find the information for a selected street and returns results as a table.  <br><code>loader.asp</code> <strong>-</strong> imports data from a file <strong>(</strong><code>streetbook_import.txt</code><strong>)</strong> into the database table.</p></td></tr><tr><td><strong>Import data file</strong></td><td><p><code>streetbook_import.txt</code> - a csv exported from the excel file supplied by PWD.<br></p><p><em><mark style="color:orange;"><strong>IMPORTANT</strong></mark></em><br><em><mark style="color:orange;">1. The file format must be: comma separated records, each field surrounded by double quotes (even if numeric fields). The double-quoting of all fields is important.</mark></em><br><em><mark style="color:orange;">2. The field order must also be as per the example file <code>streetbook_example.txt</code> found on the server. The field order is important.</mark></em><br><em><mark style="color:orange;">3. The file must be called</mark><mark style="color:orange;"> </mark><mark style="color:orange;"><code>streetbook_import.txt</code></mark><mark style="color:orange;"> </mark><mark style="color:orange;">and be placed in the same folder as the</mark><mark style="color:orange;"> </mark><mark style="color:orange;"><code>loader.asp</code></mark><mark style="color:orange;"> </mark><mark style="color:orange;">file. The file name is important.</mark></em></p></td></tr><tr><td><strong>Database Server</strong></td><td><code>VSQL01</code></td></tr><tr><td><strong>Database</strong></td><td><code>pwd</code></td></tr><tr><td><strong>Tables</strong></td><td><p><code>StreetBook</code> - Production table containing streetbook records</p><p><code>StreetBook_2024</code> - Backup of prod data as at 10/10/2024 (not used by any prod functionality)</p><p><code>StreetBook_du</code> - testing table (not used by any prod functionality)</p></td></tr><tr><td><strong>Scheduled Task</strong></td><td><p><code>Streetbook Updater</code> - uses powershell to open <code>loader.asp</code> every morning at 1am.</p><p><strong>Tip:</strong> You can run the scheduled task manually at any time. This is equivalent to opening <code>loader.asp</code> in a browser.</p></td></tr><tr><td><strong>Nightly output file</strong></td><td>The output from <code>loader.asp</code> is captured in the file <code>loader_output.txt</code>. You can see the results of the last scheduled task run in this file (its timestamp shows the date it was created = the last run datetime of the scheduled task).</td></tr></tbody></table>

## How to update the Streetbook database

The loader.asp file has been set up to run as a scheduled task on `ZPCOBWEB01`. It runs each morning at 1AM.

Following the instructions in the orange IMPORTANT note in the table above, export the streetbook data to a new file, name it `streetbook_import.txt` and copy it to the `D:\wwwcob\publicworks\streetbook` folder on `ZPCOBWEB01`.

The file contents should copied over the existing data in the database overnight, so check in the morning to see.

### Immediate run:

If you can't wait for the overnight run, you can open this page in a browser `https://cityofboston.gov/publicworks/streetbook/loader.asp` at any time ,but, **see warning below:**

<mark style="color:red;">**WARNING: The loader.asp page is intended for automated use.**</mark>\
Opening the `loader.asp` page in a browser will cause an immediate execution of the update script, and may overwrite the current data with the data in the file `streetbook_import.txt`. <mark style="color:red;">**This may or may not be your intention, so take care opening the page !**</mark>

### Check for errors

If you think the file has not been imported, then check `loader_output.txt` for info and `streetbook.log` for errors.\
**Note:** If the log file is large, then you can safely delete it, the script will create a new file as needed.

### **Force a run**

If you think the script is not determining that the file has new records (e.g. the `loader_output.txt` reports nothing done, but you know the file has changed) - then you can delete the `checksum.txt` file. This will cause the import to occur the next time `loader.asp` is opened (manually or by the overnight process)

## Under the hood

When `loader.asp` runs,

1. It reads the `streetbook_import.txt` file and splits the records based on either UNIX (LF) or Windows (CRLF) line breaks
2. It deletes the existing data in the `streetbook` table
3. it imports the new data into the `streetbook` table - expecting it to be in the column order `[PRIVATEOPEN],[STREET],[SFX],[DISTRICT],[PUBLICPRIVATE],[FROM],[TO],[ADDRESSES],[WARD],[PRCNT],[DIST],[PWDDIST],[ZIP],[NOTES]`
4. It expects the first row of the file to be the column names, so the import starts on row2.
5. It expects the last row of the file to be a blank line so it skips the last row.
6. It checksums the file contents and only imports if the checksum of the contents of the current file is different to the checksum from the last import. The checksum from the last import is saved in the file `checksum.txt`.\
   **Tip:** Deleting the `checksum.txt` file will force the import next time the script is run.
7. Each time an import is attempted, it is logged to `streetbook.log`
8. Any import issues are logged to the file `streetbook.log`

### Updating as a content editor

1. A Google Script is attached to a [Streetbook spreadsheet](https://docs.google.com/spreadsheets/d/1PmxC9ybWThw-if07mjsXDJTJ-uTHxduNjThq5JJ_mwc/edit?gid=0#gid=0) in our Boston Digital Service Team Drive. When you get the new data from Public Works, overwrite the data in that existing spreadsheet.
2. Run the script attached to the spreadsheet. This will create a new `streetbook_import.txt` file  in the existing [Streetbook files](https://drive.google.com/drive/folders/1bgEIyNARYHWX4_BfIvd4guq6lslBp8EZ) folder in our Team Drive. That is the file you need to use to update the search on cityofboston.gov.
3. Download that folder to your desktop. At this point, you will need to map a network drive to the `D:\wwwcob\publicworks\streetbook` folder on `ZPCOBWEB01`.
4. Drag the copy of the `streetbook_import.txt` file into that folder. The search will automatically update the next time `loader.asp` runs.
   1. If you need to force an immedaite update, follow the steps outlined above in the "Immediate Run" section.
