-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds expectation for deleted entities #317
Conversation
|
||
# mock `pandas.read_csv` to return the mock DataFrame | ||
mock_df = pd.DataFrame({"resource": ["2f7d900dd48fd02"]}) | ||
mocker.patch("pandas.read_csv", return_value=mock_df) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these lines necessary? I can't see where 'mock_df' is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The setup mocks the read_csv()
function, which is used to fetch resource data from the digital-land
database.
Since pd.read_csv(base_url)
returns a DataFrame, the mock_df
is used to replicate that behaviour.
# get dataset specific active resource list | ||
params = urllib.parse.urlencode( | ||
{ | ||
"sql": f"""select *,o.entity from reporting_historic_endpoints rhe join organisation o on rhe.organisation=o.organisation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For 'select *,o.entity ...' should there be an alias in front of the star or is 'o.entity' not required as the star will bring all of the columns in?
test_fact_resource_data.to_sql( | ||
"fact_resource", conn, if_exists="append", index=False | ||
) | ||
test_fact_data.to_sql("fact", conn, if_exists="append", index=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we want the if_exists
to be 'replace' as the tables are only meant for testing purposes it might append extra rows to a test table?
What type of PR is this? (check all applicable)
Description
This PR creates an expectation to identify and return deleted entities for datasets.
The implementation follows these steps:
Fetch Active Resources: Retrieve the list of active resources for a given organisation.
Identify Active Entities: Gather the active entities associated with each resource.
Compare Entities: Compare the entities from the platform with those on the active resource.
If an entity exists on the platform but not in the active resource, it is flagged as deleted.
The entity numbers identified as deleted are returned in the results.
Related Tickets & Documents
QA Instructions, Screenshots, Recordings
Please replace this line with instructions on how to test your changes, a note
on the devices and browsers this has been tested on, as well as any relevant
images for UI changes.
Added/updated tests?
We encourage you to keep the code coverage percentage at 80% and above. Please refer to the Digital Land Testing Guidance for more information.
have not been included
[optional] Are there any post deployment tasks we need to perform?
[optional] Are there any dependencies on other PRs or Work?