Skip to content
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

Auto-generated Pull Request for fix/empty-publication #429

Merged
merged 17 commits into from
May 3, 2024

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented May 3, 2024

Pulling 'fix/empty-publication into develop. Please review and merge.

…function

The cache fetching logic was extracted from the
FetchPublicationFromEuroPMC function into a new function called
FetchPublicationFromCache. This change was made to improve code
readability and maintainability. Now, the FetchPublicationFromEuroPMC
function is more focused on its main responsibility, which is fetching
publications from EuroPMC. The cache fetching logic is now encapsulated
in its own function, making the code easier to understand and modify if
needed.
…on by removing unnecessary error handling

The FetchPublicationFromEuroPMC function was simplified by removing the
error handling related to the EuroPMC2Pub function. This change was made
because the EuroPMC2Pub function itself is responsible for handling its
own errors.
… when no publication is found

The EuroPMC2Pub function has been refactored to return an error instead
of an empty Publication object when no publication is found. This change
makes error handling more explicit and prevents potential issues
downstream where an empty Publication object might be incorrectly
processed. The function now also takes an additional 'id' parameter,
which is used to provide a more specific error message when no
publication is found.
…caching of publications

The unused repo parameter was removed from the
FetchPublicationFromEuroPMC function to clean up the code and improve
readability. A new function, StorePublicationInCache, was added to
handle the caching of publications. This separates the concerns of
fetching and caching publications, making the code more maintainable and
easier to understand.
…function

The redis key creation was being repeated in multiple places in the
code. To adhere to the DRY (Don't Repeat Yourself) principle, the key
creation logic has been extracted into a separate function named
'makeRedisKey'.
The changes introduce a caching mechanism for publication data. Now,
before fetching data from EuroPMC, the system checks if the data is
already available in the cache. If it is, the cached data is returned,
reducing the need for external API calls. If the data is not in the
cache, it is fetched from EuroPMC and then stored in the cache for
future use.
@pull-request-size pull-request-size bot added size/L and removed size/M labels May 3, 2024
The fetch.go file was removed because its functionality was redundant
and no longer needed in the project. This helps to keep the codebase
clean and maintainable.
… fetching

The FetchPublication function has been refactored to first attempt to
fetch the publication from cache. If the publication is not found in
cache, it fetches from the EuroPMC endpoint and then stores the result
in cache.
…r 404 status code

The unused imports were removed to clean up the code and improve
readability. The error handling for a 404 status code was removed
because it was redundant and unnecessary. The function will now return
an error for any status code that is not 200, which simplifies the error
handling and makes the function more efficient.
…p function

The context parameter was removed from the GetResp function as it was
not being used. This simplifies the function signature and avoids
confusion about the function's usage.
…ving cache handling

The cache handling logic was removed from the Publication function in
the publication.go file. This simplifies the function by reducing the
number of error handling blocks and makes the function more readable.
The cache handling is now done in the FetchPublication function, which
abstracts the complexity away from the Publication function. This change
is part of an effort to make the codebase more maintainable and easier
to understand.
…with FetchPublication for better code reuse

The FetchPublicationFromEuroPMC function was replaced with
FetchPublication in multiple files to promote code reuse and
maintainability. The error handling was also improved by adding more
context to the error messages, making it easier to debug issues when
they arise.
…etchGOAs and fetchOrganisms functions

The context parameter was removed from fetchGOAs and fetchOrganisms
functions as it was not being used, simplifying the function signatures.
The function parameters in organism.go were broken down into multiple
lines to improve readability and maintainability of the code.
…om GetResp function call

The context import and argument were removed from the GetResp function
call in the fetch_test.go file. This was done because the context was
not being used within the function, thus removing it simplifies the
function signature and the test.
…on call

The fetchGOAs function was simplified by removing the context parameter,
which was not being used. This makes the function call cleaner and
easier to understand. The test for fetchGOAs was updated to reflect this
change.
@cybersiddhu cybersiddhu added the automerge automerge pr label May 3, 2024
@kodiakhq kodiakhq bot merged commit 61518b4 into develop May 3, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant