Skip to content

foxminchan/LawKnowledge

Repository files navigation

Law Knowledge

Law Knowlege

A legal knowledge search and Q&A application based on Vietnam's Legal Code and legal document database

Explore the docs »

🐛 Report Bug | ✈️ Request Feature | 💬 Join Our Telegram | 📚 Read Wiki | 📋 Roadmap

LawKnowledge issues LawKnowledge license Colab Gitpod Telegram

Preview


⚙️ This project used SonarCloud to analyze the code quality of the project. Pulumi for infrastructure as code (IaC). The badge below shows the quality of the code. Click on the badge to see the details.


SonarCloud Pulumi

Features

  • 📖 Document Organization and Linking
  • 📦 Terminology Extraction
  • 🔍 Quick Search for Related Content
  • 🤖 User Query Support

Table of Contents

Expand contents

What is Law Knowledge?

Law Knowledge is an app designed to provide quick access to Vietnam's legal information, including laws and legal documents. It's ideal for professionals, students, or anyone needing insights into Vietnamese legal codes and regulations.

Sparkline

Law Knowledge is a legal knowledge search and Q&A application based on Vietnam's Legal Code and legal document database. The application is built on the Microservice Architecture and uses Generative AI to extract legal terms and Question Answering to answer user questions. The application is built with Open Source technologies and is deployed on Cloud platforms.

If you want to find out more about the contest, please visit the VFOSSA website.

Preview

Tentative technologies

Building blocks

We used Microservice Architecture to build this project to make it easier to scale and maintain. The following diagram shows the architecture of the project.

Architecture

Getting Started

🛠️ Prerequisites

Infrastucture

  • Nx - Nx is a set of extensible dev tools for monorepos.
  • Nodejs - Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
  • pnpm - Fast, disk space efficient package manager.
  • Python - Python is a programming language that lets you work quickly and integrate systems more effectively.
  • Poetry - Poetry helps you declare, manage and install dependencies of Python projects, ensuring you have the right stack everywhere.
  • Pulumi - Pulumi is a manage infrastructure, secrets, and configurations intuitively on any cloud.
  • Docker (Kubernetes Enabled) - Docker is an open platform for developing, shipping, and running applications.
  • Helm - Helm is the best way to find, share, and use software built for Kubernetes.

Services

  • AWS - An Amazon Web Services account is required to deploy the infrastructure.
  • HuggingFace - A HuggingFace account is required to download and upload the dataset and model.

😄 HuggingFace Resources

You can download the dataset from the following link:

🧑‍💻 Setup

First, clone the repository to your local machine:

git clone https://github.com/foxminchan/LawKnowledge

Next, navigate to the root directory of the project and install the dependencies:

pnpm install --force

🚀 Running

For the website, you can run the following command:

npx nx serve website --prod

For the API, you can run the following command:

# For the API Gateway
npx nx serve api-gateway --prod

# For the Auth Service
npx nx serve auth-svc --prod

# For the Law Service
npx nx serve law-svc --prod

# For the Search Service, navigate to the search-svc directory
npx nx build search-svc && cd apps/api/search-svc/search-svc && python main.py

# For the Chat Service, navigate to the chat-svc directory
npx nx build chat-svc && cd apps/api/chat-svc/chat-svc && python main.py

To traning the model, you can run the following command:

npx nx build bert && cd apps/nlp/bert/bert && python main.py

To set up the infrastructure, you can run the following command:

npx nx up pulumi

Important

If you want to run with Nx, make sure you have installed `poetry` globally. Python version must be `>=3.9.1 <=3.12`.

🧪 Testing

For the website, you can run the following command:

npx nx test website-e2e

For the API, you can run the following command:

# For the Auth Service
npx nx test auth-svc-e2e

# For the Law Service
npx nx test law-svc-e2e

# For the Search Service
npx nx test search-svc-e2e

# For the Chat Service
npx nx test chat-svc

To test the model, you can run the following command:

npx nx test bert

🧩 Other

To run the tooling for processing the dataset, you can run the following command:

npx nx build processor && cd apps/nlp/processor/processor && python main.py

For running documentation, you can run the following command:

npx nx serve docs

For running the Diagram as Code, you can run the following command:

npx nx build dac && cd assets/dac/dac && python main.py

Some useful scripts:

# Navigate to the scripts directory
cd tools/scripts && ls

# + scripts
# +-- build.sh --> Build the project
# +-- clean.sh --> Clean the docker image
# +-- init.sh --> Initialize the project
# +-- prepare.sh --> Prepare the project
# +-- start.sh --> Start the project
# +-- start-o11y.sh --> Start the observability stack
# +-- stop-o11y.sh --> Stop the observability stack

# Run the script
./<script-name>

Dependency Graph

You can see the dependency graph of the project by running the following command:

npx nx dep-graph

Here is the dependency graph of the project:

Dependency Graph

CI/CD

CI/CD

Contributing

📖 Contributing Guidelines

We are excited that you are interested in contributing to this project! Before submitting your contribution, please make sure to take a moment and read through the following guidelines:

Read through our contributing guidelines to learn about our submission process, coding rules, and more.

💁 Want to Help?

Want to report a bug, contribute some code, or improve the documentation? Excellent! Read up on our guidelines for contributing and then check out one of our issues labeled as help wanted or good first issue.

🫂 Code of Conduct

Help us keep Law Knowledge open and inclusive. Please read and follow our Code of Conduct.

Support and Organization

Hutech Hutech Husc ICPC

License

This project is licensed under the terms of the MIT license.