Skip to content

Conversation

@em-baggie
Copy link
Collaborator

@em-baggie em-baggie commented Jul 21, 2025

Closes #99

See #102

@em-baggie em-baggie requested review from CarolineMorton and oylenshpeegul and removed request for CarolineMorton July 21, 2025 21:24
Copy link
Collaborator

@CarolineMorton CarolineMorton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @em-baggie

Thanks for getting this done. This is really fantastic. Well done.

Sorry for the delay in review.

I am going to approve this but if you could add a couple of docs mentioned above this would be great. thanks.

Comment on lines +296 to +307
async fn test_download_usage_from_url() -> Result<(), CodeListBuilderError> {
let mock_server = MockServer::start().await;
let usage_year = UsageYear::Y2020_21;

let test_data = LONG_TEST_DATA;

Mock::given(method("GET"))
.and(path(usage_year.path()))
.respond_with(ResponseTemplate::new(200).set_body_string(test_data))
.mount(&mock_server)
.await;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool to see. I hadn't come across this crate before.

That being said I am not sure we really need to test the functionality of what is essentially a reqwest call. It might be better to concentrate on calls that fail and if the error message that gets passed back is understandable. has the url changed? is the file corrupted? is it too big to be downloaded? etc.

for now, lets keep this test in as it is useful documentation anyway.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I'll add in a test that mocks the server to return an error code and make sure the custom error picks this up and displays this in a useful way.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that sounds like a great use of this crate.

@em-baggie
Copy link
Collaborator Author

I've improved the docs and error handling, so will merge this now.

@em-baggie em-baggie merged commit dc86aac into main Aug 8, 2025
7 checks passed
@em-baggie em-baggie deleted the usage_data branch August 8, 2025 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exploratory work: Loading usage dataset for SNOMED

4 participants