Patra is a Django-based web application for guiding users through the early stages of preparing patent registration documents.
The platform combines OTP-based authentication, user profile management, project tracking, an AI-assisted patent chatbot, dynamic patent form generation, chat history, and Word document export.
Patra was developed as a 5-member team project, based on a real client requirement, and is currently structured as a local development version.
- Overview
- Core Features
- Patent Form Content
- Tech Stack
- Project Structure
- Getting Started
- AI Prompt Configuration
- Environment Variables
- Main Workflow
- Current Scope
- Security Notes
- Team
- License
Preparing patent registration documents usually requires collecting detailed technical information in a structured way. Patra approaches this process through a guided conversation instead of asking the user to complete a static form from the beginning.
The user selects the invention type, chooses the preferred level of AI assistance, interacts with the chatbot, provides the required information step by step, and receives a generated patent form based on the conversation.
The system also keeps previous chats and projects available, so users can review, continue, search, and manage their patent-related conversations.
This repository is intended for local development and portfolio review. It does not depend on a public deployment or a specific production domain.
- OTP-based login
- User profile completion and editing
- Automatic redirection for returning users
- Home page after login
- Toolbar navigation for profile, projects, history, and chat
- Display of project cards
- Project status display
- User profile editing
- Project title management
- Ability to edit project/chat titles
-
Step-by-step patent registration chatbot
-
Sending and receiving messages
-
Invention type selection by the user
-
Support for different invention types:
- Process
- Product
- Hybrid
-
Chatbot behavior changes based on the selected invention type
Patra allows the user to choose how much the AI should be involved in completing the patent form.
The user can decide whether the AI should only organize and record the provided information, or whether it should also help improve and rewrite the descriptions.
Based on this choice, the backend loads a different system prompt and adjusts the chatbot behavior.
- Automatic form generation based on the selected invention type
- Smart form generation from the information provided during chat
- Pre-filling form sections based on user answers
- Avoiding unnecessary fields when they are not relevant to the selected invention type
- Saving the latest generated form for each conversation
- Chat history section available from the interface
- List of previous chats and projects
- Conversations ordered by creation/update time
- Ability to reopen and continue previous chats
- Search among projects and chats by title
After the conversation is completed, the generated patent content can be exported as Word documents.
The export flow is designed to produce structured outputs such as:
- Invention summary
- Invention description
- Claims document
The generated patent forms are designed to organize invention-related information into structured sections.
Depending on the selected invention type and the information collected during the chat, the form may include sections such as:
- Invention title
- Technical field
- Background or problem statement
- Summary of the invention
- Detailed description
- Key components or process steps
- Claims
- Additional invention-specific details
The exact form structure can change based on whether the invention is a process, product, or hybrid invention.
- Python
- Django
- Django REST Framework
- Django Templates
- SQLite for local development
- PostgreSQL-compatible driver included through
psycopg2-binary - OpenAI API integration
- Kavenegar package for OTP/SMS workflow
python-docxfor Word document generationpython-dotenvanddjango-environfor environment configuration- HTML and CSS
Patra/
├── chat/ # Chatbot, conversations, form generation, exports
│ ├── Services/ # Word document export utilities
│ ├── models.py
│ ├── service.py
│ ├── urls.py
│ └── views.py
│
├── users/ # Authentication, OTP, profiles, user flow
│ ├── middleware/
│ ├── models.py
│ ├── urls.py
│ └── views.py
│
├── mysite/ # Django project configuration
│ ├── settings.py
│ └── urls.py
│
├── templates/ # HTML templates
├── media/ # Generated or uploaded files
├── manage.py
├── requirements.txt
├── README.md
└── LICENSE
Follow these steps to run Patra locally.
git clone https://github.com/PatraTeam/Patra.git
cd Patrapython -m venv .venvOn Windows CMD:
.venv\Scripts\activateOn Windows PowerShell:
.venv\Scripts\Activate.ps1On macOS/Linux:
source .venv/bin/activatepip install -r requirements.txtpython manage.py migratepython manage.py runserverOpen the project in your browser:
http://127.0.0.1:8000/
Patra uses external system prompt files to control the behavior of the AI assistant.
These prompt files are intentionally excluded from the repository and must be created locally on each developer machine or server. This does not mean the AI layer is missing; it means the actual prompt content is treated as environment-specific project logic.
At the project root, create a directory named:
prompts/
Expected structure:
Patra/
├── manage.py
├── prompts/
│ ├── process_generative.txt
│ ├── process_non_generative.txt
│ ├── product_generative.txt
│ ├── product_non_generative.txt
│ ├── hybrid_generative.txt
│ └── hybrid_non_generative.txt
Each file should contain the complete system-level instructions for the AI assistant.
The backend selects the prompt file based on two values:
invention_typedetails
| Invention Type | Details | Loaded Prompt File |
|---|---|---|
| process | false | process_non_generative.txt |
| process | true | process_generative.txt |
| product | false | product_non_generative.txt |
| product | true | product_generative.txt |
| hybrid | false | hybrid_non_generative.txt |
| hybrid | true | hybrid_generative.txt |
This structure keeps the AI behavior modular and allows the project to support different levels of AI involvement.
For public repositories, keeping the main prompt files private can be a safer approach because prompts may contain internal product logic, conversation strategy, or client-specific instructions.
Create a .env file in the project root, at the same level as manage.py.
Example:
SECRET_KEY=your-django-secret-key
DEBUG=True
ALLOWED_HOSTS=127.0.0.1,localhost
USE_MOCK=True
OPENAI_API_KEY=For local testing without connecting to the OpenAI API:
USE_MOCK=TrueFor API-connected testing:
USE_MOCK=False
OPENAI_API_KEY=your-openai-api-keyDo not commit .env files or real API keys to the repository.
OTP Login
↓
Profile Completion
↓
Home / Dashboard
↓
Select Invention Type
↓
Choose AI Assistance Level
↓
Start AI-Guided Chat
↓
Generate Patent Form
↓
Review or Continue Previous Projects
↓
Export Word Documents
Patra is currently designed as a local development version.
Important notes about the current scope:
- The project is not tied to a public production domain.
- External services such as OpenAI and SMS/OTP providers require proper environment configuration.
- AI prompt files are intentionally excluded from the repository and must be created locally.
- Generated patent content should be reviewed by a human expert before real submission.
- The project helps organize patent documentation, but it is not a replacement for legal or professional patent advice.
Before using this repository in a public or portfolio setting, make sure that:
- No real API keys are committed.
.envfiles are kept out of Git.- Local database files such as
db.sqlite3are not committed. - Prompt files are kept private if they contain internal system instructions.
- Any previously exposed API key is rotated.
- Generated media files are reviewed before being committed.
Patra was developed by a 5-member team using an Agile/Scrum-based workflow and was shaped around a real client use case.
| Name | GitHub | Main Contribution |
|---|---|---|
| Saba Zarifi | @armilazarifi | Scrum Master, AI Lead, chatbot logic, and dynamic prompt selection |
| Yasaman Banaei | @Banaeiyasman-bit | Product Manager, user flow design, and UI/UX design in Figma |
| Yasmina Hajizadeh | @yasi1383 | Frontend implementation and Django template development |
| Roya Mohammadi | @royamhmdi | Backend development, database structure, and data models |
| Soroush Beyranvand | @Ox50R0U5H | Backend development, application logic, and frontend–backend integration |
This project is licensed under the MIT License.
See the LICENSE file for more information.