CodeForPhilly / CodeForPhilly/balancer-main

Add Title to the DB when uploading a file.

Open
#274 2 comments 0 reactions 1 assignee Claimed by @ricanontherun View on GitHub
Dominant language
TypeScript
Stars
21
Forks
19
PR merge metrics
No merged PRs in 30d

Description

Summary
When a user uploads a document via the [UploadFile](https://balancertestsite.com/UploadFile) page, the backend should automatically extract the document title (if available) and populate the title field in the database. Currently, this field is being saved as null.

Current Behavior

- Uploaded files are saved successfully.
- The title column in the database remains null.

Expected Behavior

- Upon file upload, the server should:

1. Parse the document.
2. Attempt to extract a meaningful title (e.g., from the PDF metadata, first page header, or first large/bold line).
3. Save the extracted title to the corresponding database entry.

Backend Details

Code location: server/API/views/uploadfile.py

This logic should be added during the upload process after the file has been saved and parsed.

Suggestion: Use openAI API endpoint and sent in the first 50 words of the document and ask it to extract the document title.
https://balancertestsite.com/UploadFile
https://balancertestsite.com/listoffiles

![Image](https://github.com/user-attachments/assets/ef8f973e-3e88-40de-a40f-5af6568d4bbb)

![Image](https://github.com/user-attachments/assets/6619dab2-73dd-440e-8f11-1c8024fb4a6b)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.