Skip to content

Commit 66948b0

Browse files
authored
Merge pull request #369 from codeforpdx/fix-metadata-null-city
Encode state-level city metadata as "null" string
2 parents 2b55a26 + b99b9f0 commit 66948b0

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

backend/scripts/generate_metadata_jsonl.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,13 @@ def in_scope(path: Path) -> bool:
6868
entries.append(
6969
Document(
7070
id=txt_file.stem,
71-
struct_data={"city": city, "state": "or"},
71+
# State-level docs use the literal string "null" (not JSON null,
72+
# which Vertex drops on import) so the retriever's city: ANY("null")
73+
# filter matches them.
74+
struct_data={
75+
"city": city if city is not None else "null",
76+
"state": "or",
77+
},
7278
content=Document.Content(
7379
mime_type="text/plain",
7480
uri=f"gs://{bucket}/{txt_file.name}",

backend/tests/test_generate_metadata_jsonl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_state_entry_structure(self, doc_tree: Path):
5858
entries = build_entries(doc_tree, "my-bucket", {"or"})
5959
entry = entries[0]
6060
assert entry.id == "ORS090"
61-
assert entry.struct_data == {"city": None, "state": "or"}
61+
assert entry.struct_data == {"city": "null", "state": "or"}
6262
assert entry.content.mime_type == "text/plain"
6363
assert entry.content.uri == "gs://my-bucket/ORS090.txt"
6464

0 commit comments

Comments
 (0)