06 - Journals ingestion
06 - Pattern-Trigger
- Setup python environment:
python3 -m venv env
source env/bin/activate
pip3 install --upgrade pip
pip3 install psycopg2-binary
pip3 install -r requirements.txt- Install Postgresql
echo "POSTGRES_USERNAME=<your_db_username>" >> .env
echo "POSTGRES_PASSWORD=<your_db_password>" >> .env
alembic upgrade head # Apply db migrations- Generate OpenAI API Key
echo "OPENAI_API_KEY=<your_api_key_here>" >> .env- Run the server locally at localhost
python3 app/main.pyUse Postman Collection to run the API
- Create user
/api/v1/auth/register
curl -XPOST 'http://localhost:8000/api/v1/auth/register' \
--header 'Content-Type: application/json' \
--data-raw '{
"user_name": "John Doe",
"user_age": 42,
"user_password": "abcd1234",
"user_email": "abcd@xyz.com"
}'- Create journal entrys
/api/v1/journal/create
curl -XPOST 'http://localhost:8000/api/v1/journal/create' \
--header 'Content-Type: application/json' \
--data '{
"user_id": 0,
"content": "Today was a very good day",
"date": "2024-12-08"
}'
curl -XPOST 'http://localhost:8000/api/v1/journal/create' \
--header 'Content-Type: application/json' \
--data '{
"user_id": 0,
"content": "Today was a bad day",
"date": "2024-12-07"
}'- Summarise with LLM
/api/v1/summarise
curl -XPOST 'http://localhost:8000/api/v1/llm/summarise' \
--header 'Content-Type: application/json' \
--data '{
"user_id": 0,
"days": [
"2024-12-08",
"2024-12-06"
]
}'