This repository contains a full-stack application for checking patent infringement against a company's products. The app features a backend built with Node.js and a frontend built using React.js. The application uses a language model API to determine potential patent infringements.
- Docker and Docker Compose installed.
- Node.js (if building locally without Docker).
-
Update the OpenAI API Key:
- Open the backend/app/config.js file.
- Replace the value
your_openai_api_key_herewith your OpenAI API key.
-
Build and Run the Application Using Docker Compose:
- Run the following command to build the backend and frontend services:
docker-compose build
- Start the application:
docker-compose up
- Run the following command to build the backend and frontend services:
-
Access the Application:
- Frontend: Visit
http://localhost:3000to access the application. - Backend: API endpoints are available at
http://localhost:3001.
- Frontend: Visit
- Navigate to the
backendandfrontenddirectories and runnpm installin both. - Start the backend:
cd backend npm start - Start the frontend:
cd frontend npm start
- Homepage: When you first visit the homepage, you will see a form to enter a Patent ID and a Company Name.
- Enter Patent ID: Type in the patent ID you want to check.
- Enter Company Name: Type in the company name whose products you wish to analyze.
- Submit the Form: Click on the "Check Infringement" button.
- View Results: After submitting, the app will display the top two products that potentially infringe on the patent, including explanations, relevant claims, and infringement likelihood.
The system architecture includes the following components:
---
title: AI Patent Infringement Check App
---
flowchart TB
subgraph Client["Client Layer"]
Browser["User's Browser"]
Frontend["React Frontend (Dockerized)"]
end
subgraph Backend["Server Layer (Dockerized)"]
NodeBackend["Node.js Backend"]
Template["OpenAI Prompt Template"]
subgraph Processing["Data Processing"]
InputHandler["Patent ID & Company Input Handler"]
end
end
subgraph External["External Services"]
OpenAI["OpenAI API"]
end
Browser --> Frontend
Frontend --> NodeBackend
NodeBackend --> InputHandler
InputHandler --> Template
Template --> InputHandler
InputHandler --> NodeBackend
NodeBackend --Prompt with Patent & Company Info--> OpenAI
OpenAI --Response Standard JSON--> NodeBackend
NodeBackend --> Frontend
classDef docker fill:#e1f5fe,stroke:#01579b
classDef process fill:#e8f5e9,stroke:#2e7d32
classDef External fill:#fff3e0,stroke:#e65100
class Frontend,NodeBackend docker
class InputHandler,Template process
class OpenAI,Standard External
- React Frontend: Provides a responsive user interface where users can input patent IDs and company names, and view results.
- Node.js Backend: Manages incoming requests, interacts with the local dataset, and uses OpenAI API for analysis.
- OpenAI prompt template - It's a template for the OpenAI API to generate static responses as expected.
- Integrationn of OpenAI API: Processes patent and product data to determine potential infringement and provides analysis.
- OpenAI Response Standardization - Standardizes the response from the OpenAI API as JSON based on the prompt template.
- Input Patent ID and Company Name: Users can input a patent ID and the name of a company whose products they want to check.
- Run Patent Infringement Analysis: The backend uses the patent details and company products to generate an infringement analysis via the OpenAI API.
- Return Top Two Infringing Products: The analysis identifies the top two products likely infringing on the patent and details which claims are at risk.
- Dockerized Deployment: Both frontend and backend are containerized using Docker, simplifying installation and deployment.
Feel free to reach out for any questions!
- Initialize Project Structure:
- Set up a repository and initialize Node.js (or Python) for the backend.
- Set up the frontend framework and create necessary components.
- Docker Configuration:
- Write a
Dockerfilefor both frontend and backend services. - Use
docker-composeto orchestrate these services together.
- Write a
- Set Up API Endpoints:
- Create an endpoint to receive user input (
/infringement-check), which will accept patent ID and company name. - Create an endpoint for retrieving saved analysis reports (
/saved-reports).
- Create an endpoint to receive user input (
- Data Handling:
- Load the
patents.jsonandcompany_products.jsonfiles to extract the necessary data. - Develop logic to fuzzy match company names using a library like fuzzywuzzy (Python) or similar.
- Load the
- Infringement Analysis Logic:
- Integrate with the LLM (via API) to generate explanations and determine the infringement likelihood.
- Implement a simple caching mechanism to reduce repetitive API calls for the same analysis.
- Save Reports Functionality:
- Create a report-saving endpoint (
/save-report) to persist infringement results. Store saved reports in a file or use a lightweight database like SQLite.
- Create a report-saving endpoint (
- UI for Input:
- Develop a form where users can enter the patent ID and company name.
- Add basic validation to ensure the user has entered all required fields.
- Results Display:
- Design a UI component to display the infringement analysis, including product details and relevant claims.
- Ensure that the results are easy to read and well formatted.
- Saved Reports Page:
- Create a page to view previously saved reports. Display them in a user-friendly way.
- LLM API Integration:
- Integrate the backend with the LLM API for performing patent analysis.
- Handle any API rate limits or errors gracefully to avoid breaking the user experience.
- End-to-End Testing:
- Test the complete flow from frontend to backend, ensuring that inputs are correctly processed and results are displayed.
- Write unit tests for core functionality, including API calls and data processing.
- Dockerize the Application:
- Write separate
Dockerfiles for both frontend and backend services. - Use
docker-composeto create a unified environment.
- Write separate
- Hosting (Bonus):
- Deploy the app on a hosting platform like AWS, DigitalOcean, or use Heroku for simplicity.
- Ensure that the web server has all necessary configurations to run the containerized app.
- Write README.md:
- Include setup instructions, how to run the app using Docker, and any assumptions made.
- Provide an overview of the core functionalities and how to use the app.
- User Input Parsing (Bonus):
- Implement fuzzy matching of company names to handle slight differences or typos in user input.
- Saving and Viewing Reports (Bonus):
- Add an option for users to save analysis results and view them later.
- Store saved reports in JSON or a simple database.
- Code Review: Perform a final review of the code, refactoring where necessary.
- UI/UX Improvements: Improve the UI for better user experience, such as adding loading indicators during analysis.
- Bug Fixes: Address any discovered bugs, especially those that could break user input or analysis flows.