Giter VIP home page Giter VIP logo

legal-documentation-assistant's Introduction

Legal-Documentation-Assistant

Table of Contents

About The Project

Legal documentation can be a complicated and time-consuming process, especially for individuals and small businesses who may not have access to legal resources. In addition, the language and jargon used in legal documents can be difficult for non-lawyers to understand, which can lead to errors and misunderstandings.

Objective: The objective of this project is to develop an AI-powered solution that can simplify legal documentation for individuals and small businesses in India, by automatically drafting legal documents in plain language and using easy-to-understand terms.

Features:

  1. User-friendly interface to input relevant information such as parties involved, terms of the agreement, and other necessary details.

  2. AI-powered document generation that automatically recommends legal documents based on user query.

  3. Ability to customize legal documents based on the specific needs of the user.

  4. Integration with existing legal resources and databases to ensure accuracy and completeness of the legal documents.

Impact: The proposed solution can greatly benefit individuals and small businesses in India, who often face challenges with legal documentation due to limited access to legal resources. By simplifying legal documentation, this solution can potentially save time, reduce errors, and increase access to justice.

Data: We have made use of LawRato for the dataset of legal documents.

Demo

Screencast-from-28-03-24-10_30_07-PM-IST.1.mp4

Tech Stack

  • react

  • tailwind

  • python

  • flask

  • psql

File Structure

👨‍💻Legal-Documentation-Assistant
 ┣ 📂assets                            // Contains all the reference gifs, images
 ┣ 📂client                            // Frontend        
 ┃ ┣ 📂src                                      
 ┃ ┃ ┣ 📂components  
 ┃ ┃ ┃ ┣ 📄Chat.jsx
 ┃ ┃ ┣ 📄about.jsx
 ┃ ┃ ┣ 📄Faq.jsx
 ┃ ┃ ┣ 📄Home.jsx
 ┃ ┃ ┣ 📄InputForm.jsx
 ┃ ┃ ┣ 📄LoginPage.jsx
 ┃ ┣ 📂public 
 ┃ ┃ ┣ 📄index.html
 ┣ 📂model                             // Standalone model         
 ┃ ┣ 📄similarity.py                   // Based on Cosine Similarity
 ┃ ┣ 📄bot.py    
 ┃ ┣ 📄chat.py                         // To chat with the standalone model
 ┃ ┣ 📄model.py                        // Based on Bag of Words
 ┃ ┣ 📄train.py                        
 ┃ ┣ 📄dataset.py 
 ┃ ┣ 📄util.py   
 ┃ ┣ 📄trained_model.pth
 ┃ ┣ 📄intents.json                    // Dataset 
 ┣ 📂server                            // Backend 
 ┃ ┣ 📂docs  
 ┃ ┃ ┣ 📄localfile.docx
 ┃ ┃ ┣ 📄Output2.docx
 ┃ ┣ 📄app.py 
 ┃ ┣ 📄createdatabase.py  
 ┃ ┣ 📄requirements.txt      
 ┣ 📄README.md

Getting Started

Installation

Clone the project by typing the following command in your Terminal/CommandPrompt

git clone https://github.com/PritK99/Legal-Documentation-Assistant.git

Navigate to the Legal Documentation Assistant folder

cd Legal-Documentation-Assistant

Frontend

Open a new terminal in root folder and navigate to the client folder

cd client/

Install all the required dependencies

npm i

To run the frontend

npm start

Once the above command is executed, the frontend will be running at localhost:3000. You can visit http://localhost:3000/ to view the website.

Backend

Open a new terminal in root folder and navigate to the server folder

cd server

Create a virtual environment to install all the dependencies

python -m venv docbuddy

Activate the virtual environment

For Windows: docbuddy\Scripts\activate

For Linux: source docbuddy/bin/activate

Install all the required dependencies

pip install -r requirements.txt

To create a database on render and creating a environment file, follow the given steps

  1. Visit the website and create an account or sign in.
  2. Next, choose a new service as PostgreSQL to create a new database service.
  3. Give an appropriate name to the database and the instance name.
  4. Select Free option in the Instance type and hit Create Database button at the bottom.

A new empty PostgreSQL database service will then be created. You can view all the services on your Render Dashboard.

Note
The PostgreSQL database service will remain free on render only upto 3 months.

Next, create a .env file containing the credentials of your database. Sample .env file looks like:

DATABASE_HOST=your_database_host
DATABASE_NAME=your_database_name
DATABASE_USER=your_database_username
PASSWORD=your_database_password
DATABASE_PORT=your_database_port

Note
DATABASE_HOST in .env should be of form <Hostname>.<region>-postgres.render.com. For example, if the region of database is Oregon (US West), then hostname can be <Hostname>.oregon-postgres.render.com

You can get all this database credentials by visiting the PostgreSQL database service you created on your render dashboard.

Once the .env file is setup, next run the createdatabase.py script using the following command in the terminal:

python server/createdatabase.py  

Running the createdatabase.py script will create the entire database for you.

Note
If you want to create the PostgreSQL database on your local device instead of hosting on render, you are free to do so. But, you need to change the .env file accordingly.

To run the backend

python app.py

Screenshots of the Website

  • Home Page

    home

  • Documents Page

    forms

  • Dynamic form page (generated for the specific legal document)

    dynamic forms

  • Document Editor

    doc_editor

  • Downloading the document

    download

  • Chatbot

    chatbot

  • FAQ page

    faq

  • About Page

    about_page

Contributors

References

  • LawRato for the dataset of legal documents.

License

MIT License

legal-documentation-assistant's People

Contributors

devayani03 avatar kgan31 avatar m-g-rathod avatar pritk99 avatar shark-21 avatar vrnimje avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

legal-documentation-assistant's Issues

how to establish the connection with the database in render..I get a issue while creating the database

(docbuddy) PS C:\Users\anush\Legal-Documentation-Assistant\server> python createdatabase.py
Traceback (most recent call last):
File "C:\Users\anush\Legal-Documentation-Assistant\server\createdatabase.py", line 10, in
conn = psycopg2.connect(database='final_legal_documentation', user='final_legal_documentation_user',
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\anush\Legal-Documentation-Assistant\server\docbuddy\Lib\site-packages\psycopg2_init_.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
psycopg2.OperationalError: connection to server at "dpg-ckah8tcg66mc73falae0-a.oregon-postgres.render.com" (35.227.164.209), port 5432 failed: SSL connection has been closed unexpectedly
I get this error while creating the database.so can u give me suggestions of what to do to resolve this error?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.