{"id":20153256,"url":"https://github.com/pmutua/drf_csv_xlsx_file_upload","last_synced_at":"2025-04-09T21:32:58.884Z","repository":{"id":98959846,"uuid":"187590552","full_name":"pmutua/drf_csv_xlsx_file_upload","owner":"pmutua","description":"Demo Django (Django Rest Framework) API uploads .csv/.xlsx for bulk data, queries via text for accurate results. Integrated with OpenAI using Langchain library. Watch full implementation via this video below.","archived":false,"fork":false,"pushed_at":"2023-11-11T05:11:09.000Z","size":1401,"stargazers_count":14,"open_issues_count":3,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T23:26:48.840Z","etag":null,"topics":["api-rest","bulk-inserts","csv","csv-files","csv-reading","django","django-framework","django-rest-framework","djangorestframework","langchain","langchain-python","openai-api","pandas","pandas-projects","python","python-project","python3","uploading-files","xlsx-files"],"latest_commit_sha":null,"homepage":"https://www.youtube.com/watch?v=gXYvhHocz84\u0026t=4333s","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pmutua.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-05-20T07:33:26.000Z","updated_at":"2025-02-27T17:25:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"bc55ac32-d427-4a23-84dd-5851f8e33a3e","html_url":"https://github.com/pmutua/drf_csv_xlsx_file_upload","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmutua%2Fdrf_csv_xlsx_file_upload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmutua%2Fdrf_csv_xlsx_file_upload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmutua%2Fdrf_csv_xlsx_file_upload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmutua%2Fdrf_csv_xlsx_file_upload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pmutua","download_url":"https://codeload.github.com/pmutua/drf_csv_xlsx_file_upload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248114917,"owners_count":21050141,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-rest","bulk-inserts","csv","csv-files","csv-reading","django","django-framework","django-rest-framework","djangorestframework","langchain","langchain-python","openai-api","pandas","pandas-projects","python","python-project","python3","uploading-files","xlsx-files"],"created_at":"2024-11-13T23:17:50.865Z","updated_at":"2025-04-09T21:32:58.842Z","avatar_url":"https://github.com/pmutua.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Drf File Upload\n\nAPI allows a user to upload `.csv` \u0026 `xlsx` files containing patient names and emails then load the data into the database. Query Database and csv data with langchain.\n\nRequirements:\n\n```bash\nPython \u003e=3.0\nDjango==3.0\ndjangorestframework==3.14.0\npandas==2.0.3\nlangchain==0.0.229\nopenai\ntabulate\n```\n\n## Features\n\n- Uploading a file.\n\n- Import works only for *.csv or *.xlsx files.\n\n- Show error message if one tries to upload files in other formats.\n\n- Show response when the import is done\n\n- Show response if import wasn't done and the reason why.\n\n- List all patients after the file has been uploaded.\n- Query Database with LLM\n- Query CSV with LLM\n\n## Usage\n\nRun:\n\n`python manage.py makemigrations`\n\n`python manage.py migrate`\n\n### Create User\n\n`python manage.py createsuperuser` follow prompt\n\n### Making a POST request\n\n\u0026nbsp;\n\u0026nbsp;\n![alt text](/static/postman01.PNG)\n\n#### View the new data seeded\n\n\u0026nbsp;\n\u0026nbsp;\n![alt text](/static/postman03.PNG)\n\n#### TODO\n\n- Show error message if the file is corrupted.\n\n\u003c!-- ### Clearing migrations\n\n1. #### Remove the all migrations files within your project\n\nOr if you are using a unix-like OS you can run the following script (inside your project dir):\n\n```bash\nfind . -path \"*/migrations/*.py\" -not -name \"__init__.py\" -delete\nfind . -path \"*/migrations/*.pyc\"  -delete.\n\n```\n\n2. #### Drop the current database, or delete the db.sqlite3 if it is your case.\n\n3. #### Create the initial migrations and generate the database schema\n\n```bash\npython manage.py makemigrations\npython manage.py migrate\n``` --\u003e\n\n#### Author\n\nPhilip Mutua\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmutua%2Fdrf_csv_xlsx_file_upload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpmutua%2Fdrf_csv_xlsx_file_upload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmutua%2Fdrf_csv_xlsx_file_upload/lists"}