**
Celes Assignment is a Python-based project developed to create authenticated endpoints that perform queries on a dataset of parquet files. The project leverages FastAPI for building APIs and Firebase for authentication, ensuring secure and efficient data handling.
- Python (preferably the latest version)
- Firebase Account
- FastAPI
- Uvicorn
- Pytest for running unit tests
-
Create a Firebase Project: Go to the Firebase Console and create a new project.
-
Download Credentials:
- Navigate to the Project settings > Service accounts.
- Click on "Generate new private key" and download the
credentials.json
file. - Place this file in the root directory of the project.
-
Create Verified User:
- In Firebase, set up authentication (Email/Password) and create a user.
- Store the user's email and password in a
.env
file in the root directory of the project with the keysFIREBASE_USERNAME
andFIREBASE_PASSWORD
.
-
Retrieve Firebase Configuration Data:
- Go to the Firebase Console.
- Select your project.
- Click on the gear icon next to "Project Overview" and choose "Project settings".
- Under "Your apps", select the app for which you want the configuration.
- Here, you'll find your Firebase configuration object (
firebaseConfig
).
-
Create Firebase Configuration File:
-
Create a file named
firebase_config.py
in theceles_microservice
folder of your project. -
Copy your Firebase configuration data into this file in the following format:
pythonCopy code
# celes_microservice/firebase_config.py firebaseConfig = { "apiKey": "your-api-key", "authDomain": "your-project-id.firebaseapp.com", "projectId": "your-project-id", "storageBucket": "your-project-id.appspot.com", "messagingSenderId": "your-messaging-sender-id", "appId": "your-app-id", "databaseURL": "your-database-url" }
-
Replace the placeholder values with your actual Firebase project settings.
-
-
Using Firebase Configuration in Your Application:
-
Import this configuration into your application wherever you need to initialize Firebase:
pythonCopy code
`from .firebase_config import firebaseConfig
-
-
Securing Configuration Data:
- Remember that your Firebase configuration data, especially the
apiKey
, should be handled securely. - Avoid exposing these details in public repositories or unsecured files.
- Remember that your Firebase configuration data, especially the
-
Clone the Repository:
bashCopy code
git clone <repository_url> cd <repository_name>
-
Install Dependencies:
bashCopy code
pip install -r requirements.txt
-
Set Up Environment Variables:
- Ensure the
.env
file is correctly configured with Firebase credentials.
- Ensure the
-
Run the Application:
-
Start the FastAPI application using Uvicorn:
bashCopy code
uvicorn api_queries:app --reload
-
Store the parquet data files in the relative path '/resources/data_files'.
To verify that all endpoints are functioning as expected:
-
Execute Unit Tests:
bashCopy code
pytest unit_tests.py
-
Test Results:
- Review the output of pytest to ensure all tests pass successfully.
Once the microservice is up and running, the authenticated endpoints can be accessed and integrated into any user interface or system that requires data querying capabilities on the parquet dataset.
**