dotenvPyGithubjavalangfastapinumpyuvicorn
- Generate GitHub Access Token Follow instructions on this page
- Create a
.envfile in the root directory of the repository and create the following environment variable:GITHUB_ACCESS_TOKEN='your key here'
The web interface is built using React + Next.js. To start he UI:
cd congenial-system-web- Install dependencies with
yarn - Start server with
yarn dev
The Python API is built with FastAPI, and handles formatting of queries sent from the user through the UI.
It takes a string representation of the query and uses the Python package elasticsearch_dsl to build and format a suitable query.
Start the API by running make local while in the root directory of the repository.
The Crawler takes advantage of the Python package PyGithub to make requests to the Github Search API. The implemented crawler uses the search_repositories method and takes a query (on Github format) as parameter. For our use case, such query might look like: "created:2023-01-01..2023-01-31 language:Java".
The Parser is built on the Python package javalang to parse Java code into a tree with corresponding fields.
The search engine is built on Elastic Search Index. A prerequisite to running this system locally, is that you have an index running locally on PORT:9200.
The index consist of methods for both searching and indexing documents.
In main.py in the root directory, there is a function for enriching the index with data. What you have to do is:
- Specify the name of both class index and method index as well as mappings for those (Our mappings can be found in that file)
- Create indcies if they do not exist
- run the function
enrich_indexwith the follwing parameters:
- GitHub Access Token
- Indexer
- Method index name
- Class index name
- Date ranges (a list with string entries on format: 'YYYY-MM-DD..YYYY-MM-DD', used to divide search)
- Keywords (optional)
- Have a local Elastic Index running on PORT 9200.
- Start the backend API according to the instructions under "Python API"
- Start the UI according to the instructions under "Web Interface"
🔥 If you followed all steps, you should now be running the search engine locally. Head to localhost:3000 to try it out.