{"id":13764589,"url":"https://github.com/foxminchan/LawKnowledge","last_synced_at":"2025-05-10T19:31:50.286Z","repository":{"id":208080058,"uuid":"719866833","full_name":"foxminchan/LawKnowledge","owner":"foxminchan","description":"A legal knowledge search and Q\u0026A application based on Vietnam's Legal Code and legal document database ⚖️","archived":false,"fork":false,"pushed_at":"2024-03-17T04:30:53.000Z","size":182253,"stargazers_count":93,"open_issues_count":0,"forks_count":7,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-03T16:08:25.561Z","etag":null,"topics":["generative-ai","microservice","natural-language-processing","nlp","nx","searching","semantic-search"],"latest_commit_sha":null,"homepage":"https://foxminchan.github.io/LawKnowledge/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/foxminchan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":["foxminchan"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2023-11-17T04:10:19.000Z","updated_at":"2024-07-27T09:16:12.000Z","dependencies_parsed_at":"2023-12-27T07:42:26.017Z","dependency_job_id":"6ad5f028-6189-4083-a019-be19e6c9e37d","html_url":"https://github.com/foxminchan/LawKnowledge","commit_stats":{"total_commits":254,"total_committers":7,"mean_commits":"36.285714285714285","dds":"0.15748031496062997","last_synced_commit":"3feca00b79cb3d0d3034e21b581c08bed2759c68"},"previous_names":["foxminchan/lawknowledge"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxminchan%2FLawKnowledge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxminchan%2FLawKnowledge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxminchan%2FLawKnowledge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxminchan%2FLawKnowledge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foxminchan","download_url":"https://codeload.github.com/foxminchan/LawKnowledge/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224986075,"owners_count":17402936,"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":["generative-ai","microservice","natural-language-processing","nlp","nx","searching","semantic-search"],"created_at":"2024-08-03T16:00:23.399Z","updated_at":"2024-11-17T00:30:58.224Z","avatar_url":"https://github.com/foxminchan.png","language":"TypeScript","funding_links":["https://github.com/sponsors/foxminchan"],"categories":["Resources"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\t\u003cimg loading=\"lazy\" src=\"./assets/images/law.png\" alt=\"Law Knowledge\" height=\"150\"\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eLaw Knowlege\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n\tA legal knowledge search and Q\u0026A application based on Vietnam's Legal Code and legal document database\n\u003cp\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://foxminchan.github.io/LawKnowledge/\" rel=\"dofollow\" target=\"blank\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e\n\t\u003cbr/\u003e\n\t\u003cbr/\u003e\n\t\u003ca href=\"https://github.com/foxminchan/LawKnowledge/issues/new?assignees=\u0026labels=\u0026projects=\u0026template=bug_report.md\u0026title=%F0%9F%90%9B+Bug+Report%3A+\"\u003e🐛 Report Bug\u003c/a\u003e\n\t|\n\t\u003ca href=\"https://github.com/foxminchan/LawKnowledge/issues/new?assignees=\u0026labels=\u0026projects=\u0026template=feature_request.md\u0026title=%F0%9F%9A%80+Feature%3A+\"\u003e✈️ Request Feature\u003c/a\u003e\n\t|\n\t\u003ca href=\"https://t.me/+bz74heXQgBwwOWRl\"\u003e💬 Join Our Telegram\u003c/a\u003e\n\t|\n\t\u003ca href=\"https://github.com/foxminchan/LawKnowledge/wiki\"\u003e📚 Read Wiki\u003c/a\u003e\n\t|\n\t\u003ca href=\"https://github.com/users/foxminchan/projects/8\"\u003e📋 Roadmap\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://github.com/foxminchan/LawKnowledge/issues\" target=\"blank\"\u003e\n\t\t\u003cimg loading=\"lazy\" src=\"https://img.shields.io/github/issues/foxminchan/LawKnowledge?label=Issue\" alt=\"LawKnowledge issues\"/\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://github.com/foxminchan/LawKnowledge/blob/main/LICENSE\" target=\"blank\"\u003e\n\t\t\u003cimg loading=\"lazy\" src=\"https://img.shields.io/github/license/foxminchan/LawKnowledge?label=License\" alt=\"LawKnowledge license\"/\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://colab.research.google.com/drive/1HcL3VrdKhQ1f4ZxbYOhiw_kYTtxRlT_f?usp=sharing\" target=\"_blank\"\u003e\n\t\t\u003cimg loading=\"lazy\" src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Colab\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://gitpod.io/new/#https://github.com/foxminchan/LawKnowledge\" target=\"_blank\"\u003e\n\t\t\u003cimg loading=\"lazy\" src=\"https://img.shields.io/badge/Gidpod-Ready%20to%20Code-blue?logo=gitpod\" alt=\"Gitpod\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://t.me/+bz74heXQgBwwOWRl\" target=\"_blank\"\u003e\n\t\t\u003cimg loading=\"lazy\" src=\"https://img.shields.io/static/v1?message=Join%20chat\u0026color=9cf\u0026logo=telegram\u0026label=Teleram\" alt=\"Telegram\"\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cimg loading=\"lazy\" src=\"./assets/images/banner.gif\" alt=\"Preview\" width=\"100%\"\u003e\n\n\u003cbr/\u003e\n\n\u003cp align=\"justify\"\u003e\n\n⚙️ 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.\n\n\u003c/p\u003e\n\n\u003cbr/\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://sonarcloud.io/summary/new_code?id=foxminchan_LawKnowledge\" target=\"blank\"\u003e\n\t\t\u003cimg loading=\"lazy\" src=\"https://sonarcloud.io/images/project_badges/sonarcloud-white.svg\" alt=\"SonarCloud\" height=\"45\" /\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://app.pulumi.com/new?template=https://github.com/foxminchan/LawKnowledge/tree/main/deploys/iac/pulumi\" target=\"blank\"\u003e\n\t\t\u003cimg loading=\"lazy\" src=\"https://get.pulumi.com/new/button.svg\" alt=\"Pulumi\" height=\"45\" /\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch1\u003eFeatures\u003c/h1\u003e\n\n- 📖 Document Organization and Linking\n- 📦 Terminology Extraction\n- 🔍 Quick Search for Related Content\n- 🤖 User Query Support\n\n\u003ch1\u003eTable of Contents\u003c/h1\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eExpand contents\u003c/summary\u003e\n\n- [What is Law Knowledge?](#what-is-law-knowledge)\n- [Tentative technologies](#tentative-technologies)\n- [Building blocks](#building-blocks)\n- [Getting Started](#getting-started)\n\t- [🛠️ Prerequisites](#️-prerequisites)\n\t\t- [Infrastucture](#infrastucture)\n\t\t- [Services](#services)\n\t- [😄 HuggingFace Resources](#-huggingface-resources)\n\t- [🧑‍💻 Setup](#-setup)\n\t- [🚀 Running](#-running)\n\t- [🧪 Testing](#-testing)\n\t- [🧩 Other](#-other)\n- [Dependency Graph](#dependency-graph)\n- [CI/CD](#cicd)\n- [Contributing](#contributing)\n\t- [📖 Contributing Guidelines](#-contributing-guidelines)\n\t- [💁 Want to Help?](#-want-to-help)\n\t- [🫂 Code of Conduct](#-code-of-conduct)\n- [Support and Organization](#support-and-organization)\n- [License](#license)\n\n\u003c/details\u003e\n\n# What is Law Knowledge?\n\n\u003cp align=\"justify\"\u003e\nLaw 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.\n\u003c/p\u003e\n\n[![Sparkline](https://stars.medv.io/foxminchan/LawKnowledge.svg)](https://stars.medv.io/foxminchan/LawKnowledge)\n\n\u003cblockquote\u003e\n\t\u003cp align=\"justify\"\u003e\n\t\t\u003cb\u003eLaw Knowledge\u003c/b\u003e is a legal knowledge search and Q\u0026A application based on Vietnam's Legal Code and legal document database. The application is built on the \u003cb\u003eMicroservice Architecture\u003c/b\u003e and uses \u003cb\u003eGenerative AI\u003c/b\u003e to extract legal terms and \u003cb\u003eQuestion Answering\u003c/b\u003e to answer user questions. The application is built with \u003cb\u003eOpen Source\u003c/b\u003e technologies and is deployed on \u003cb\u003eCloud\u003c/b\u003e platforms.\n\t\u003c/p\u003e\n\u003c/blockquote\u003e\n\nIf you want to find out more about the contest, please visit the [VFOSSA website](https://vfossa.vn/tin-tuc/de-thi-phan-mem-nguon-mo-olp-2023-688.html).\n\n\u003cimg loading=\"lazy\" src=\"./assets/images/preview.png\" alt=\"Preview\" width=\"100%\"\u003e\n\n# Tentative technologies\n\n- [React](https://reactjs.org/)\n- [NestJS](https://nestjs.com/)\n- [Python](https://www.python.org/)\n- [Pulumi](https://www.pulumi.com/)\n- [Kafka](https://kafka.apache.org/)\n- [ArgoCD](https://argoproj.github.io/argo-cd/)\n- [Jenkins](https://www.jenkins.io/)\n- [Kubernetes](https://kubernetes.io/)\n- [OpenTelemetry](https://opentelemetry.io/)\n- [Grafana](https://grafana.com/), [Prometheus](https://prometheus.io/), [Zipkin](https://zipkin.io/), [Fluentd](https://www.fluentd.org/)\n\n# Building blocks\n\n\u003cp align=\"justify\"\u003e\nWe used \u003cb\u003eMicroservice Architecture\u003c/b\u003e to build this project to make it easier to scale and maintain. The following diagram shows the architecture of the project.\n\u003c/p\u003e\n\n\u003cimg loading=\"lazy\" src=\"./assets/images/architecture.svg\" alt=\"Architecture\" width=\"100%\"\u003e\n\n# Getting Started\n\n## 🛠️ Prerequisites\n\n### Infrastucture\n\n\u003cul\u003e\n\t\u003cli align=\"justify\"\u003e\n\t\t\u003cb\u003e\u003ca href=\"https://nx.dev/\" target=\"_blank\"\u003eNx\u003c/a\u003e\u003c/b\u003e - Nx is a set of extensible dev tools for monorepos.\n\t\u003c/li\u003e\n\t\u003cli align=\"justify\"\u003e\n\t\t\u003cb\u003e\u003ca href=\"https://nodejs.org/en/\" target=\"_blank\"\u003eNodejs\u003c/a\u003e\u003c/b\u003e - Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.\n\t\u003c/li\u003e\n\t\u003cli align=\"justify\"\u003e\n\t\t\u003cb\u003e\u003ca href=\"https://www.npmjs.com/\" target=\"_blank\"\u003epnpm\u003c/a\u003e\u003c/b\u003e - Fast, disk space efficient package manager.\n\t\u003c/li\u003e\n\t\u003cli align=\"justify\"\u003e\n\t\t\u003cb\u003e\u003ca href=\"https://www.python.org/\" target=\"_blank\"\u003ePython\u003c/a\u003e\u003c/b\u003e - Python is a programming language that lets you work quickly and integrate systems more effectively.\n\t\u003c/li\u003e\n\t\u003cli align=\"justify\"\u003e\n\t\t\u003cb\u003e\u003ca href=\"https://python-poetry.org/\" target=\"_blank\"\u003ePoetry\u003c/a\u003e\u003c/b\u003e - Poetry helps you declare, manage and install dependencies of Python projects, ensuring you have the right stack everywhere.\n\t\u003c/li\u003e\n\t\u003cli align=\"justify\"\u003e\n\t\t\u003cb\u003e\u003ca href=\"https://www.pulumi.com/\" target=\"_blank\"\u003ePulumi\u003c/a\u003e\u003c/b\u003e - Pulumi is a manage infrastructure, secrets, and configurations intuitively on any cloud.\n\t\u003c/li\u003e\n\t\u003cli align=\"justify\"\u003e\n\t\t\u003cb\u003e\u003ca href=\"https://www.docker.com/\" target=\"_blank\"\u003eDocker (Kubernetes Enabled)\u003c/a\u003e\u003c/b\u003e - Docker is an open platform for developing, shipping, and running applications.\n\t\u003c/li\u003e\n\t\u003cli align=\"justify\"\u003e\n\t\t\u003cb\u003e\u003ca href=\"https://helm.sh/\" target=\"_blank\"\u003eHelm\u003c/a\u003e\u003c/b\u003e - Helm is the best way to find, share, and use software built for Kubernetes.\n\t\u003c/li\u003e\n\u003c/ul\u003e\n\n### Services\n\n\u003cul\u003e\n\t\u003cli align=\"justify\"\u003e\n\t\t\u003cb\u003e\u003ca href=\"https://aws.amazon.com/\" target=\"_blank\"\u003eAWS\u003c/a\u003e\u003c/b\u003e - An Amazon Web Services account is required to deploy the infrastructure.\n\t\u003c/li\u003e\n\t\u003cli align=\"justify\"\u003e\n\t\t\u003cb\u003e\u003ca href=\"https://huggingface.co/\" target=\"_blank\"\u003eHuggingFace\u003c/a\u003e\u003c/b\u003e - A HuggingFace account is required to download and upload the dataset and model.\n\t\u003c/li\u003e\n\u003c/ul\u003e\n\n## 😄 HuggingFace Resources\n\n\u003cp align=\"justify\"\u003e\n\nYou can download the dataset from the following link:\n\n- [Law Knowledge Data](https://huggingface.co/datasets/foxminchan/law-knowledge): The dataset from [Pháp điển](https://phapdien.moj.gov.vn/) and [Văn bản pháp luật](https://vbpl.vn/).\n- [Law Knowledge Model](https://huggingface.co/foxminchan/law-knowledge): A fine-tuned model from [PhoBERT](https://huggingface.co/vinai/phobert-base-v2).\n\n\u003c/p\u003e\n\n## 🧑‍💻 Setup\n\nFirst, clone the repository to your local machine:\n\n```bash\ngit clone https://github.com/foxminchan/LawKnowledge\n```\n\nNext, navigate to the root directory of the project and install the dependencies:\n\n```bash\npnpm install --force\n```\n\n## 🚀 Running\n\nFor the website, you can run the following command:\n\n```bash\nnpx nx serve website --prod\n```\n\nFor the API, you can run the following command:\n\n```bash\n# For the API Gateway\nnpx nx serve api-gateway --prod\n\n# For the Auth Service\nnpx nx serve auth-svc --prod\n\n# For the Law Service\nnpx nx serve law-svc --prod\n\n# For the Search Service, navigate to the search-svc directory\nnpx nx build search-svc \u0026\u0026 cd apps/api/search-svc/search-svc \u0026\u0026 python main.py\n\n# For the Chat Service, navigate to the chat-svc directory\nnpx nx build chat-svc \u0026\u0026 cd apps/api/chat-svc/chat-svc \u0026\u0026 python main.py\n```\n\nTo traning the model, you can run the following command:\n\n```bash\nnpx nx build bert \u0026\u0026 cd apps/nlp/bert/bert \u0026\u0026 python main.py\n```\n\nTo set up the infrastructure, you can run the following command:\n\n```bash\nnpx nx up pulumi\n```\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e \u003cp align=\"justify\"\u003e\n\u003e If you want to run with Nx, make sure you have installed `poetry` globally. Python version must be `\u003e=3.9.1 \u003c=3.12`.\n\u003e \u003c/p\u003e\n\n## 🧪 Testing\n\nFor the website, you can run the following command:\n\n```bash\nnpx nx test website-e2e\n```\n\nFor the API, you can run the following command:\n\n```bash\n# For the Auth Service\nnpx nx test auth-svc-e2e\n\n# For the Law Service\nnpx nx test law-svc-e2e\n\n# For the Search Service\nnpx nx test search-svc-e2e\n\n# For the Chat Service\nnpx nx test chat-svc\n```\n\nTo test the model, you can run the following command:\n\n```bash\nnpx nx test bert\n```\n\n## 🧩 Other\n\nTo run the tooling for processing the dataset, you can run the following command:\n\n```bash\nnpx nx build processor \u0026\u0026 cd apps/nlp/processor/processor \u0026\u0026 python main.py\n```\n\nFor running documentation, you can run the following command:\n\n```bash\nnpx nx serve docs\n```\n\nFor running the Diagram as Code, you can run the following command:\n\n```bash\nnpx nx build dac \u0026\u0026 cd assets/dac/dac \u0026\u0026 python main.py\n```\n\nSome useful scripts:\n\n```bash\n# Navigate to the scripts directory\ncd tools/scripts \u0026\u0026 ls\n\n# + scripts\n# +-- build.sh --\u003e Build the project\n# +-- clean.sh --\u003e Clean the docker image\n# +-- init.sh --\u003e Initialize the project\n# +-- prepare.sh --\u003e Prepare the project\n# +-- start.sh --\u003e Start the project\n# +-- start-o11y.sh --\u003e Start the observability stack\n# +-- stop-o11y.sh --\u003e Stop the observability stack\n\n# Run the script\n./\u003cscript-name\u003e\n````\n\n# Dependency Graph\n\nYou can see the dependency graph of the project by running the following command:\n\n```bash\nnpx nx dep-graph\n```\n\nHere is the dependency graph of the project:\n\n\u003cimg loading=\"lazy\" src=\"./assets/images/dep-graph.png\" alt=\"Dependency Graph\" width=\"100%\"\u003e\n\n# CI/CD\n\n\u003cimg loading=\"lazy\" src=\"./assets/images/cicd.svg\" alt=\"CI/CD\" width=\"100%\"\u003e\n\n# Contributing\n\n## 📖 Contributing Guidelines\n\n\u003cp align=\"justify\"\u003e\n\nWe 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:\n\nRead through our [contributing guidelines](.github/CONTRIBUTING.md) to learn about our submission process, coding rules, and more.\n\n\u003c/p\u003e\n\n## 💁 Want to Help?\n\n\u003cp align=\"justify\"\u003e\n\nWant to report a bug, contribute some code, or improve the documentation? Excellent! Read up on our guidelines for [contributing](.github/CONTRIBUTING.md) and then check out one of our issues labeled as \u003ckbd\u003e[help wanted](https://github.com/foxminchan/LawKnowledge/labels/help%20wanted)\u003c/kbd\u003e or \u003ckbd\u003e[good first issue](https://github.com/foxminchan/LawKnowledge/labels/good%20first%20issue)\u003c/kbd\u003e.\n\n\u003c/p\u003e\n\n## 🫂 Code of Conduct\n\n\u003cp align=\"justify\"\u003e\n\nHelp us keep Law Knowledge open and inclusive. Please read and follow our [Code of Conduct](.github/CODE_OF_CONDUCT.md).\n\n\u003c/p\u003e\n\n# Support and Organization\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://hutech.edu.vn/\" target=\"_blank\"\u003e\n\t\t\u003cimg loading=\"lazy\" src=\"./assets/images/hutech.png\" height=\"60px\" alt=\"Hutech\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://vfossa.vn/\" target=\"_blank\"\u003e\n\t\t\u003cimg loading=\"lazy\" src=\"./assets/images/vfossa.png\" height=\"60px\" alt=\"Hutech\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"http://husc.hueuni.edu.vn/\" target=\"_blank\"\u003e\n\t\t\u003cimg loading=\"lazy\" src=\"./assets/images/husc.jpg\" height=\"60px\" alt=\"Husc\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://olp.husc.edu.vn/\" target=\"_blank\"\u003e\n\t\t\u003cimg loading=\"lazy\" src=\"./assets/images/icpc.jpg\" height=\"60px\" alt=\"ICPC\"\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n\n# License\n\n\u003cp align=\"justify\"\u003e\n\nThis project is licensed under the terms of the [MIT](LICENSE) license.\n\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxminchan%2FLawKnowledge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoxminchan%2FLawKnowledge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxminchan%2FLawKnowledge/lists"}