Skip to content

Commit

Permalink
Feature/rename update type field names (#41)
Browse files Browse the repository at this point in the history
rename update type field names

lots of test data files renamed without change which is good as the
updates made should be identical.

---------

Co-authored-by: Mark <[email protected]>
  • Loading branch information
THOR300 and Mark authored Apr 13, 2023
1 parent 9a16c0a commit 0a68e1a
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -939,41 +939,41 @@
"updated_documents": {
"TESTCCLW.executive.1.1": [
{
"db_value": "name",
"csv_value": "new name",
"s3_value": "name",
"db_value": "new name",
"type": "name"
}
],
"TESTCCLW.executive.2.2": [
{
"db_value": "description",
"csv_value": "new description",
"s3_value": "description",
"db_value": "new description",
"type": "description"
}
],
"TESTCCLW.executive.3.3": [
{
"db_value": "http://existing.com",
"csv_value": "http://new.com",
"s3_value": "http://existing.com",
"db_value": "http://new.com",
"type": "source_url"
}
],
"TESTCCLW.executive.4.4": [
{
"db_value": "description",
"csv_value": "new description",
"s3_value": "description",
"db_value": "new description",
"type": "description"
},
{
"db_value": "http://existing.com",
"csv_value": "http://new.com",
"s3_value": "http://existing.com",
"db_value": "http://new.com",
"type": "source_url"
}
],
"TESTCCLW.executive.5.5": [
{
"db_value": "description",
"csv_value": "new description",
"s3_value": "description",
"db_value": "new description",
"type": "description"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -939,41 +939,41 @@
"updated_documents": {
"TESTCCLW.executive.1.1": [
{
"db_value": "name",
"csv_value": "new name",
"s3_value": "name",
"db_value": "new name",
"type": "name"
}
],
"TESTCCLW.executive.2.2": [
{
"db_value": "description",
"csv_value": "new description",
"s3_value": "description",
"db_value": "new description",
"type": "description"
}
],
"TESTCCLW.executive.3.3": [
{
"db_value": "http://existing.com",
"csv_value": "http://new.com",
"s3_value": "http://existing.com",
"db_value": "http://new.com",
"type": "source_url"
}
],
"TESTCCLW.executive.4.4": [
{
"db_value": "description",
"csv_value": "new description",
"s3_value": "description",
"db_value": "new description",
"type": "description"
},
{
"db_value": "http://existing.com",
"csv_value": "http://new.com",
"s3_value": "http://existing.com",
"db_value": "http://new.com",
"type": "source_url"
}
],
"TESTCCLW.executive.5.5": [
{
"db_value": "description",
"csv_value": "new description",
"s3_value": "description",
"db_value": "new description",
"type": "description"
}
]
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/navigator_data_ingest/base/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class Update(BaseModel):
"""Class describing the results of comparing csv data against the db data to identify updates."""

db_value: Union[str, datetime]
csv_value: Union[str, datetime]
s3_value: Union[str, datetime]
type: UpdateTypes


Expand Down
4 changes: 2 additions & 2 deletions src/navigator_data_ingest/base/updated_document_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ def update_dont_parse(
update_file_field(
document_path=document_file,
field=str(document_update.type.value),
new_value=document_update.csv_value,
existing_value=document_update.db_value,
new_value=document_update.db_value,
existing_value=document_update.s3_value,
)
)

Expand Down
14 changes: 7 additions & 7 deletions src/navigator_data_ingest/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,26 +224,26 @@ def test_updates(s3_document_id):
s3_document_id: [
{
"type": "name",
"csv_value": "NEW NAME",
"db_value": "An example document name.",
"db_value": "NEW NAME",
"s3_value": "An example document name.",
},
{
"type": "description",
"csv_value": "NEW DESCRIPTION",
"db_value": "An example document description.",
"db_value": "NEW DESCRIPTION",
"s3_value": "An example document description.",
},
{
"type": "source_url",
"csv_value": "https://www.NEW_SOURCE_URL.pdf",
"db_value": "https://domain/path/to/document.pdf",
"db_value": "https://www.NEW_SOURCE_URL.pdf",
"s3_value": "https://domain/path/to/document.pdf",
},
]
}

return [
Update(
type=UpdateTypes(update["type"]),
csv_value=update["csv_value"],
s3_value=update["s3_value"],
db_value=update["db_value"],
)
for update in updates[s3_document_id]
Expand Down
8 changes: 4 additions & 4 deletions src/navigator_data_ingest/tests/test_update_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ def test_update_dont_parse(
parser_input_doc_data[
PipelineFieldMapping[UpdateTypes(update_to_document_description.type)]
]
== update_to_document_description.csv_value
== update_to_document_description.db_value
)

embeddings_input_doc_data = json.loads(embeddings_input_doc.read_text())
assert (
embeddings_input_doc_data[
PipelineFieldMapping[UpdateTypes(update_to_document_description.type)]
]
== update_to_document_description.csv_value
== update_to_document_description.db_value
)

embeddings_input_translated_doc_data = json.loads(
Expand All @@ -143,15 +143,15 @@ def test_update_dont_parse(
embeddings_input_translated_doc_data[
PipelineFieldMapping[UpdateTypes(update_to_document_description.type)]
]
== update_to_document_description.csv_value
== update_to_document_description.db_value
)

indexer_input_doc_json_data = json.loads(indexer_input_doc_json.read_text())
assert (
indexer_input_doc_json_data[
PipelineFieldMapping[UpdateTypes(update_to_document_description.type)]
]
== update_to_document_description.csv_value
== update_to_document_description.db_value
)


Expand Down

0 comments on commit 0a68e1a

Please sign in to comment.