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

Implement backend endpoint for simulated search results based on GitHub Finesse Data #2

Closed
4 of 5 tasks
CFIALeronB opened this issue Nov 9, 2023 · 3 comments · Fixed by #7
Closed
4 of 5 tasks
Assignees

Comments

@CFIALeronB
Copy link
Contributor

CFIALeronB commented Nov 9, 2023

Summary

Create a Flask endpoint /search in the Finesse-Backend to serve simulated search results. The endpoint should fetch JSON file contents from a specified GitHub repository and return the file that matches the search query included in the POST request. It should also distinguish between requests for simulated data and requests for real data, which should be fetched from a different source.

Details

  • The endpoint should only return simulated data if a specific flag (useSimulatedData) is set to True in the POST request's JSON payload.
  • When useSimulatedData is True, the server should:
    • Fetch the list of files from the GitHub repository at https://api.github.com/repos/ai-cfia/finesse-data/contents.
    • Iterate over the files to find a match for the query (case-insensitive).
    • Fetch the content of the matched file using the download_url and return it as the response.
  • If no matching file is found, return a 404 response with an appropriate error message.
  • If useSimulatedData is False, or the parameter is missing, the server should not attempt to fetch simulated data. Instead, it should:
    • Indicate that real data fetching is not yet implemented (return a 501 response).
    • In the future, this should be replaced with logic to fetch real data from Louis-DB.

Acceptance Criteria

  • Endpoint /search accepts a POST request with JSON payload containing query and useSimulatedData.
  • Returns matching JSON content from the GitHub repository when useSimulatedData is True.
  • Returns an error message when no match is found or when fetching real data.
  • Proper error handling for GitHub API interaction.
  • Unit tests for new endpoint logic.
@CFIALeronB CFIALeronB moved this to Todo in Finesse Nov 9, 2023
@rngadam
Copy link

rngadam commented Nov 10, 2023

thanks for taking the time to create very complete issues!

k-allagbe added a commit that referenced this issue Nov 24, 2023
k-allagbe added a commit that referenced this issue Nov 24, 2023
k-allagbe added a commit that referenced this issue Nov 24, 2023
k-allagbe added a commit that referenced this issue Nov 24, 2023
@k-allagbe k-allagbe self-assigned this Nov 27, 2023
@k-allagbe k-allagbe moved this from Todo to In Progress in Finesse Nov 27, 2023
k-allagbe added a commit that referenced this issue Nov 27, 2023
k-allagbe added a commit that referenced this issue Nov 27, 2023
k-allagbe added a commit that referenced this issue Nov 27, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in Finesse Nov 27, 2023
@rngadam
Copy link

rngadam commented Nov 27, 2023

@k-allagbe I see the checklist is not updated. were all the tasks completed or some things postponed to future issues?

@k-allagbe
Copy link
Member

@k-allagbe I see the checklist is not updated. were all the tasks completed or some things postponed to future issues?

The implementation is a little different: we have a separate endpoint for each search option. I missed the useSimulateData requirement. In my opinion, separate endpoints is probably okay for now as we don't know which search option is the "default" one yet. But I could definitely come back to this later if required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants