Skip to content

Commit 601198f

Browse files
committed
fix matching for AOR and MIAMI address
Signed-off-by: John Seekins <[email protected]>
1 parent 5565f76 commit 601198f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

enrichers/openstreetmap.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ def search(self) -> dict:
6565
logger.debug(" OSM search error for '%s': %s", facility_name, e)
6666
self.resp_info["search_query_steps"].append(f"(Failed -> {e})") # type: ignore [attr-defined]
6767
continue
68-
if data:
69-
return self.resp_info
7068
# when the URL result is a "way" this is usually correct.
7169
# checks top five results.
7270
match_terms = ["prison", "detention", "correctional", "jail"]
@@ -86,6 +84,8 @@ def search(self) -> dict:
8684
self.resp_info["details"]["longitude"] = lon # type: ignore [index]
8785
self.resp_info["title"] = title
8886
return self.resp_info
87+
if not data:
88+
return self.resp_info
8989
# fallback to first result
9090
first_result = data[0]
9191
logger.debug("Address searches didn't directly find anything, just using the first result: %s", first_result)

field_offices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def _extract_single_office(self, element: BeautifulSoup, page_url: str) -> dict:
171171
office["email"] = email[0]["href"].split(":", 1)[1]
172172
detail_txt = details.text # type: ignore [union-attr]
173173
logger.debug("Detail text: %s", detail_txt)
174-
aor_match = re.match(r"Area of Responsibility:(.+)\n?Email", detail_txt)
174+
aor_match = re.search(r"Area of Responsibility:(.+)Email", detail_txt)
175175
if aor_match:
176176
office["aor"] = aor_match.group(1).strip().replace("\xa0", " ")
177177

scraper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ def _clean_street(self, street: str, locality: str = "") -> Tuple[str, bool]:
118118
{"match": "351 Elliott Street", "replace": "351 ELLIOTT ST", "locality": "Honolulu"},
119119
{"match": "1 Success Loop Rd", "replace": "1 SUCCESS LOOP DR", "locality": "Berlin"},
120120
{"match": "700 Arch Street", "replace": "700 ARCH ST", "locality": "Philadelphia"},
121-
{"match": "33 NE 4th Street", "replace": "33 NE 4 STREET", "locality": "Miami"},
122121
{"match": "1300 Metropolitan", "replace": "1300 METROPOLITAN AVE", "locality": "Leavenworth"},
123122
{"match": "601 McDonough Blvd SE", "replace": "601 MCDONOUGH BOULEVARD SE", "locality": "Atlanta"},
124123
{"match": "1705 E Hanna Rd", "replace": "1705 EAST HANNA RD", "locality": "Eloy"},
@@ -155,7 +154,8 @@ def _clean_street(self, street: str, locality: str = "") -> Tuple[str, bool]:
155154
{"match": "9998 S. Highway 98", "replace": "9998 SOUTH HIGHWAY 83", "locality": "Laredo"},
156155
# a unique one, 'cause the PHONE NUMBER IS IN THE ADDRESS?!
157156
{"match": "911 PARR BLVD 775 328 3308", "replace": "911 E Parr Blvd", "locality": "RENO"},
158-
# fix a few shockingly bad addresses in spreadsheet
157+
# fix a few bad addresses in spreadsheet
158+
{"match": "33 NE 4 STREET", "replace": "33 NE 4th Street", "locality": "MIAMI"},
159159
{"match": "DEPARTMENT OF CORRECTIONS 1618 ASH STREET", "replace": "1618 Ash Street", "locality": "ERIE"},
160160
{"match": "203 ASPINAL AVE. PO BOX 3236", "replace": "203 Aspinall Avenue", "locality": "HAGATNA"},
161161
{

0 commit comments

Comments
 (0)