You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: The location and sentence models established in PPUC/PxPUC/models.py are crucial for the search algorithm and contract pages. The general rundown of how these objects are used from the frontend to the backend:
Researchers.jsx (Line 125) Makes the API call with the user’s search query
api.jsx (Line 18) Creates the endpoint connection from urls.py to then be used in the frontend in JSON
urls.py (Lines 57-60) Connects urls created in api.jsx to view ResearchersSearchList function in views.py
views.py (Lines 233-284) This is where the bulk of the search logic is implemented. Connects with the location serializer first to establish the relationship between location and sentence. For each sentence for a given location (which has a relationship to a contract that has these sentences), get sentences that contain search query words iteratively.
Example search query from user: “Police officer salary” -> “Police officer” -> “Police” (breaks down search string and compares it with sentences) These sentences are given ranks as well, as count is incremented, to determine which should be shown first when the time comes to display them
serializers.py (Lines 8-54) Connects location serializer and sentence serializer. Location calls get_sentences with the location object data that then uses the serializer for sentences to serialize those models. This forms the relationship
serializers.py (Lines 141-144) Connected sentence serializer that was used in the previous step to the sentence model in models.py
models.py (Lines 62-69) Instantiates the sentence model with a relationship to the location model
models.py (Lines 10-19) Instantiates the location model
These objects/models are populated from the following script:
add_contracts.py (Lines 205-207) Populates the locations based on text file names of the contracts at PPUC/PxPUC/static/app/{any}.txt
add_contracts.py (Lines 220-222) Populates the contract models with the location from step one
add_contracts.py (Lines 246-248) Populates the sentence models within the contract in step two from the location in step one.
Source: (Any branch) PPUC/PxPUC/[any filename].py, PPUC/frontend/src/components/Researchers.jsx, PPUC/scripts/add_contracts.py
Description: The location and sentence models established in PPUC/PxPUC/models.py are crucial for the search algorithm and contract pages. The general rundown of how these objects are used from the frontend to the backend:
Example search query from user: “Police officer salary” -> “Police officer” -> “Police” (breaks down search string and compares it with sentences) These sentences are given ranks as well, as count is incremented, to determine which should be shown first when the time comes to display them
These objects/models are populated from the following script:
Additional Notes: https://docs.google.com/document/d/1ixJNlHZgvns8YmCt1Nk1t2sfYvMRkp8a9VZyP2NUJek/edit?usp=sharing
https://docs.google.com/document/d/1Qrdd_ZCrckT_slLfsI6t-UZ8JcrhZFO-4uf5KISCqo0/edit
Video Notes: https://drive.google.com/file/d/1_nIiSDXGQ5ZMT-HfuwKbO1nfPPeUl_3s/view?usp=drive_link
The text was updated successfully, but these errors were encountered: