├── legal-ai-server ├── env │ ├── lib64 │ ├── pip-selfcheck.json │ ├── pyvenv.cfg │ └── share │ │ └── python-wheels │ │ ├── pip-8.1.1-py2.py3-none-any.whl │ │ ├── progress-1.2-py2.py3-none-any.whl │ │ ├── six-1.10.0-py2.py3-none-any.whl │ │ ├── wheel-0.29.0-py2.py3-none-any.whl │ │ ├── chardet-2.3.0-py2.py3-none-any.whl │ │ ├── colorama-0.3.7-py2.py3-none-any.whl │ │ ├── distlib-0.2.2-py2.py3-none-any.whl │ │ ├── html5lib-0.999-py2.py3-none-any.whl │ │ ├── packaging-16.6-py2.py3-none-any.whl │ │ ├── requests-2.9.1-py2.py3-none-any.whl │ │ ├── retrying-1.3.3-py2.py3-none-any.whl │ │ ├── urllib3-1.13.1-py2.py3-none-any.whl │ │ ├── ipaddress-0.0.0-py2.py3-none-any.whl │ │ ├── lockfile-0.12.2-py2.py3-none-any.whl │ │ ├── pyparsing-2.0.3-py2.py3-none-any.whl │ │ ├── setuptools-20.7.0-py2.py3-none-any.whl │ │ ├── CacheControl-0.11.5-py2.py3-none-any.whl │ │ └── pkg_resources-0.0.0-py2.py3-none-any.whl ├── .gitignore ├── README.md ├── application.wsgi ├── requirements.txt └── server.py ├── webApp ├── src │ ├── app │ │ ├── app.component.scss │ │ ├── layout │ │ │ ├── layout.component.scss │ │ │ ├── layout.component.html │ │ │ ├── components │ │ │ │ └── topnav │ │ │ │ │ ├── topnav.component.html │ │ │ │ │ ├── topnav.component.ts │ │ │ │ │ ├── topnav.component.spec.ts │ │ │ │ │ └── topnav.component.scss │ │ │ ├── layout.component.ts │ │ │ ├── layout.module.spec.ts │ │ │ ├── dashboard │ │ │ │ ├── dashboard.module.spec.ts │ │ │ │ ├── dashboard.service.spec.ts │ │ │ │ ├── dashboard-routing.module.ts │ │ │ │ ├── dashboard.component.spec.ts │ │ │ │ ├── dashboard.module.ts │ │ │ │ ├── dashboard.component.scss │ │ │ │ ├── dashboard.service.ts │ │ │ │ ├── dashboard.component.html │ │ │ │ └── dashboard.component.ts │ │ │ ├── layout-routing.module.ts │ │ │ ├── layout.component.spec.ts │ │ │ └── layout.module.ts │ │ ├── shared │ │ │ ├── guard │ │ │ │ ├── index.ts │ │ │ │ ├── auth.guard.ts │ │ │ │ └── auth.guard.spec.ts │ │ │ ├── pipes │ │ │ │ └── pipes.module.ts │ │ │ └── services │ │ │ │ ├── rest.service.spec.ts │ │ │ │ └── rest.service.ts │ │ ├── app.component.html │ │ ├── app.component.ts │ │ ├── login │ │ │ ├── login.module.spec.ts │ │ │ ├── login-routing.module.ts │ │ │ ├── login.component.ts │ │ │ ├── login.module.ts │ │ │ ├── login.component.spec.ts │ │ │ ├── login.component.scss │ │ │ └── login.component.html │ │ ├── app-routing.module.ts │ │ ├── app.module.ts │ │ └── app.component.spec.ts │ ├── favicon.ico │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── styles │ │ ├── styles.scss │ │ ├── _responsive.scss │ │ ├── _main.scss │ │ ├── _material.scss │ │ └── _utils.scss │ ├── assets │ │ ├── images │ │ │ ├── card-1.jpg │ │ │ ├── card-2.jpg │ │ │ └── card-3.jpg │ │ ├── fonts │ │ │ └── FontinSans │ │ │ │ ├── Fontin_Sans_B.otf │ │ │ │ ├── Fontin_Sans_BI.otf │ │ │ │ ├── Fontin_Sans_I.otf │ │ │ │ ├── Fontin_Sans_R.otf │ │ │ │ └── Fontin_Sans_SC.otf │ │ └── i18n │ │ │ └── en.json │ ├── tslint.json │ ├── tsconfig.app.json │ ├── tsconfig.spec.json │ ├── browserslist │ ├── main.ts │ ├── index.html │ ├── test.ts │ ├── karma.conf.js │ └── polyfills.ts ├── e2e │ ├── src │ │ ├── app.po.ts │ │ └── app.e2e-spec.ts │ ├── tsconfig.e2e.json │ └── protractor.conf.js ├── .editorconfig ├── tsconfig.json ├── LICENSE ├── .gitignore ├── README.md ├── package.json ├── tslint.json └── angular.json ├── .DS_Store ├── README.md ├── elastic_upload.py ├── LICENSE ├── requirements.txt └── law_eda.py /legal-ai-server/env/lib64: -------------------------------------------------------------------------------- 1 | lib -------------------------------------------------------------------------------- /webApp/src/app/app.component.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /webApp/src/app/layout/layout.component.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /webApp/src/app/shared/guard/index.ts: -------------------------------------------------------------------------------- 1 | export * from './auth.guard'; 2 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/.DS_Store -------------------------------------------------------------------------------- /legal-ai-server/env/pip-selfcheck.json: -------------------------------------------------------------------------------- 1 | {"last_check":"2018-12-15T16:37:24Z","pypi_version":"18.1"} -------------------------------------------------------------------------------- /webApp/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/webApp/src/favicon.ico -------------------------------------------------------------------------------- /webApp/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /legal-ai-server/env/pyvenv.cfg: -------------------------------------------------------------------------------- 1 | home = /usr/bin 2 | include-system-site-packages = false 3 | version = 3.5.2 4 | -------------------------------------------------------------------------------- /webApp/src/styles/styles.scss: -------------------------------------------------------------------------------- 1 | @import 'material'; 2 | @import 'main'; 3 | @import 'utils'; 4 | @import 'responsive'; 5 | -------------------------------------------------------------------------------- /webApp/src/assets/images/card-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/webApp/src/assets/images/card-1.jpg -------------------------------------------------------------------------------- /webApp/src/assets/images/card-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/webApp/src/assets/images/card-2.jpg -------------------------------------------------------------------------------- /webApp/src/assets/images/card-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/webApp/src/assets/images/card-3.jpg -------------------------------------------------------------------------------- /webApp/src/assets/fonts/FontinSans/Fontin_Sans_B.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/webApp/src/assets/fonts/FontinSans/Fontin_Sans_B.otf -------------------------------------------------------------------------------- /webApp/src/assets/fonts/FontinSans/Fontin_Sans_BI.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/webApp/src/assets/fonts/FontinSans/Fontin_Sans_BI.otf -------------------------------------------------------------------------------- /webApp/src/assets/fonts/FontinSans/Fontin_Sans_I.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/webApp/src/assets/fonts/FontinSans/Fontin_Sans_I.otf -------------------------------------------------------------------------------- /webApp/src/assets/fonts/FontinSans/Fontin_Sans_R.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/webApp/src/assets/fonts/FontinSans/Fontin_Sans_R.otf -------------------------------------------------------------------------------- /webApp/src/assets/fonts/FontinSans/Fontin_Sans_SC.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/webApp/src/assets/fonts/FontinSans/Fontin_Sans_SC.otf -------------------------------------------------------------------------------- /legal-ai-server/.gitignore: -------------------------------------------------------------------------------- 1 | # Virtualenv 2 | .Python 3 | bin 4 | lib 5 | include 6 | *.py[cod] 7 | .vscode 8 | 9 | # Mac OS X custom attribute files 10 | .DS_Store 11 | -------------------------------------------------------------------------------- /webApp/src/app/layout/layout.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
-------------------------------------------------------------------------------- /legal-ai-server/env/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/legal-ai-server/env/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl -------------------------------------------------------------------------------- /legal-ai-server/env/share/python-wheels/progress-1.2-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/legal-ai-server/env/share/python-wheels/progress-1.2-py2.py3-none-any.whl -------------------------------------------------------------------------------- /legal-ai-server/env/share/python-wheels/six-1.10.0-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/legal-ai-server/env/share/python-wheels/six-1.10.0-py2.py3-none-any.whl -------------------------------------------------------------------------------- /legal-ai-server/env/share/python-wheels/wheel-0.29.0-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/legal-ai-server/env/share/python-wheels/wheel-0.29.0-py2.py3-none-any.whl -------------------------------------------------------------------------------- /legal-ai-server/env/share/python-wheels/chardet-2.3.0-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/legal-ai-server/env/share/python-wheels/chardet-2.3.0-py2.py3-none-any.whl -------------------------------------------------------------------------------- /legal-ai-server/env/share/python-wheels/colorama-0.3.7-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/legal-ai-server/env/share/python-wheels/colorama-0.3.7-py2.py3-none-any.whl -------------------------------------------------------------------------------- /legal-ai-server/env/share/python-wheels/distlib-0.2.2-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/legal-ai-server/env/share/python-wheels/distlib-0.2.2-py2.py3-none-any.whl -------------------------------------------------------------------------------- /legal-ai-server/env/share/python-wheels/html5lib-0.999-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/legal-ai-server/env/share/python-wheels/html5lib-0.999-py2.py3-none-any.whl -------------------------------------------------------------------------------- /legal-ai-server/env/share/python-wheels/packaging-16.6-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/legal-ai-server/env/share/python-wheels/packaging-16.6-py2.py3-none-any.whl -------------------------------------------------------------------------------- /legal-ai-server/env/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/legal-ai-server/env/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl -------------------------------------------------------------------------------- /legal-ai-server/env/share/python-wheels/retrying-1.3.3-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/legal-ai-server/env/share/python-wheels/retrying-1.3.3-py2.py3-none-any.whl -------------------------------------------------------------------------------- /legal-ai-server/env/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/legal-ai-server/env/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl -------------------------------------------------------------------------------- /legal-ai-server/env/share/python-wheels/ipaddress-0.0.0-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/legal-ai-server/env/share/python-wheels/ipaddress-0.0.0-py2.py3-none-any.whl -------------------------------------------------------------------------------- /legal-ai-server/env/share/python-wheels/lockfile-0.12.2-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/legal-ai-server/env/share/python-wheels/lockfile-0.12.2-py2.py3-none-any.whl -------------------------------------------------------------------------------- /legal-ai-server/env/share/python-wheels/pyparsing-2.0.3-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/legal-ai-server/env/share/python-wheels/pyparsing-2.0.3-py2.py3-none-any.whl -------------------------------------------------------------------------------- /legal-ai-server/env/share/python-wheels/setuptools-20.7.0-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/legal-ai-server/env/share/python-wheels/setuptools-20.7.0-py2.py3-none-any.whl -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Decentralized Legal-AI 2 | 3 | #### An AI based legal search platform, that curates relevant legal search based on searched problem, that could be used by lawyers to speed up their process of research. 4 | -------------------------------------------------------------------------------- /legal-ai-server/env/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/legal-ai-server/env/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl -------------------------------------------------------------------------------- /legal-ai-server/env/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aditya-shahh/Legal-AI/HEAD/legal-ai-server/env/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl -------------------------------------------------------------------------------- /webApp/src/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tslint.json", 3 | "rules": { 4 | "directive-selector": [true, "attribute", "app", "camelCase"], 5 | "component-selector": [true, "element", "app", "kebab-case"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /webApp/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "types": [] 6 | }, 7 | "exclude": [ 8 | "test.ts", 9 | "**/*.spec.ts" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /webApp/src/app/shared/pipes/pipes.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | 4 | @NgModule({ 5 | imports: [CommonModule], 6 | declarations: [] 7 | }) 8 | export class PipesModule {} 9 | -------------------------------------------------------------------------------- /webApp/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /legal-ai-server/README.md: -------------------------------------------------------------------------------- 1 | # installation instructions 2 | 3 | run 4 | ```markdown 5 | $ pyvenv-3.5 env 6 | $ source env/bin/activate 7 | ``` 8 | 9 | then do 10 | 11 | pip install requirements.txt 12 | 13 | if not work, then do 14 | 15 | $ pip install --upgrade -r requirements.txt -------------------------------------------------------------------------------- /webApp/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } -------------------------------------------------------------------------------- /webApp/src/styles/_responsive.scss: -------------------------------------------------------------------------------- 1 | @media screen and (max-width: 992px) { 2 | .main-container { 3 | left: 0px; 4 | } 5 | } 6 | 7 | @media screen and (max-width: 992px) { 8 | .push-right { 9 | #sidebar { 10 | left: 0 !important; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /legal-ai-server/application.wsgi: -------------------------------------------------------------------------------- 1 | import os, sys 2 | 3 | PROJECT_DIR = '/www/helloflask.enigmeta.com/helloflask' 4 | 5 | activate_this = os.path.join(PROJECT_DIR, 'bin', 'activate_this.py') 6 | execfile(activate_this, dict(__file__=activate_this)) 7 | sys.path.append(PROJECT_DIR) 8 | 9 | from helloflask import app as application -------------------------------------------------------------------------------- /webApp/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /webApp/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 | 10 |

Loading...

11 |
-------------------------------------------------------------------------------- /webApp/src/app/layout/components/topnav/topnav.component.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /webApp/src/styles/_main.scss: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | height: 100%; 4 | margin: 0; 5 | font-family: 'Fontil Sans'; 6 | } 7 | 8 | .main-container { 9 | position: absolute; 10 | top: 64px; 11 | left: 250px; 12 | right: 0; 13 | bottom: 0; 14 | padding: 20px; 15 | } 16 | 17 | .mb-20 { 18 | margin-bottom: 20px; 19 | } 20 | -------------------------------------------------------------------------------- /webApp/src/app/layout/layout.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-layout', 5 | templateUrl: './layout.component.html', 6 | styleUrls: ['./layout.component.scss'] 7 | }) 8 | export class LayoutComponent implements OnInit { 9 | constructor() {} 10 | 11 | ngOnInit() {} 12 | } 13 | -------------------------------------------------------------------------------- /webApp/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "test.ts", 12 | "polyfills.ts" 13 | ], 14 | "include": [ 15 | "**/*.spec.ts", 16 | "**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /webApp/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | templateUrl: './app.component.html', 7 | styleUrls: ['./app.component.scss'] 8 | }) 9 | export class AppComponent implements OnInit { 10 | constructor() { 11 | } 12 | 13 | ngOnInit() { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /webApp/src/app/login/login.module.spec.ts: -------------------------------------------------------------------------------- 1 | import { LoginModule } from './login.module'; 2 | 3 | describe('LoginModule', () => { 4 | let loginModule: LoginModule; 5 | 6 | beforeEach(() => { 7 | loginModule = new LoginModule(); 8 | }); 9 | 10 | it('should create an instance', () => { 11 | expect(loginModule).toBeTruthy(); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /webApp/e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('workspace-project App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Welcome to app!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /webApp/src/app/layout/layout.module.spec.ts: -------------------------------------------------------------------------------- 1 | import { LayoutModule } from './layout.module'; 2 | 3 | describe('LayoutModule', () => { 4 | let layoutModule: LayoutModule; 5 | 6 | beforeEach(() => { 7 | layoutModule = new LayoutModule(); 8 | }); 9 | 10 | it('should create an instance', () => { 11 | expect(layoutModule).toBeTruthy(); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /webApp/src/app/shared/services/rest.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { RestService } from './rest.service'; 4 | 5 | describe('RestService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: RestService = TestBed.get(RestService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /webApp/src/app/layout/dashboard/dashboard.module.spec.ts: -------------------------------------------------------------------------------- 1 | import { DashboardModule } from './dashboard.module'; 2 | 3 | describe('DashboardModule', () => { 4 | let dashboardModule: DashboardModule; 5 | 6 | beforeEach(() => { 7 | dashboardModule = new DashboardModule(); 8 | }); 9 | 10 | it('should create an instance', () => { 11 | expect(dashboardModule).toBeTruthy(); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /webApp/src/browserslist: -------------------------------------------------------------------------------- 1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | # For IE 9-11 support, please uncomment the last line of the file and adjust as needed 5 | > 0.5% 6 | last 2 versions 7 | Firefox ESR 8 | not dead 9 | # IE 9-11 10 | -------------------------------------------------------------------------------- /webApp/src/app/layout/dashboard/dashboard.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { DashboardService } from './dashboard.service'; 4 | 5 | describe('DashboardService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: DashboardService = TestBed.get(DashboardService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /webApp/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | import 'hammerjs'; 4 | 5 | import { AppModule } from './app/app.module'; 6 | import { environment } from './environments/environment'; 7 | 8 | if (environment.production) { 9 | enableProdMode(); 10 | } 11 | 12 | platformBrowserDynamic().bootstrapModule(AppModule) 13 | .catch(err => console.error(err)); 14 | -------------------------------------------------------------------------------- /webApp/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Legal AI 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /webApp/src/app/login/login-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | 4 | import { LoginComponent } from './login.component'; 5 | 6 | const routes: Routes = [ 7 | { 8 | path: '', 9 | component: LoginComponent 10 | } 11 | ]; 12 | 13 | @NgModule({ 14 | imports: [RouterModule.forChild(routes)], 15 | exports: [RouterModule] 16 | }) 17 | export class LoginRoutingModule {} 18 | -------------------------------------------------------------------------------- /webApp/src/app/layout/dashboard/dashboard-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { DashboardComponent } from './dashboard.component'; 4 | 5 | const routes: Routes = [ 6 | { 7 | path: '', 8 | component: DashboardComponent 9 | } 10 | ]; 11 | 12 | @NgModule({ 13 | imports: [RouterModule.forChild(routes)], 14 | exports: [RouterModule] 15 | }) 16 | export class DashboardRoutingModule {} 17 | -------------------------------------------------------------------------------- /webApp/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "module": "es2015", 9 | "moduleResolution": "node", 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "target": "es5", 13 | "typeRoots": [ 14 | "node_modules/@types" 15 | ], 16 | "lib": [ 17 | "es2018", 18 | "dom" 19 | ] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /webApp/src/app/shared/guard/auth.guard.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { CanActivate } from '@angular/router'; 3 | import { Router } from '@angular/router'; 4 | 5 | @Injectable() 6 | export class AuthGuard implements CanActivate { 7 | constructor(private router: Router) {} 8 | 9 | canActivate() { 10 | if (localStorage.getItem('isLoggedin')) { 11 | return true; 12 | } 13 | return true; 14 | // this.router.navigate(['/login']); 15 | // return false; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /webApp/src/app/shared/guard/auth.guard.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async, inject } from '@angular/core/testing'; 2 | import { RouterTestingModule } from '@angular/router/testing'; 3 | 4 | import { AuthGuard } from './auth.guard'; 5 | 6 | describe('AuthGuard', () => { 7 | beforeEach(() => { 8 | TestBed.configureTestingModule({ 9 | imports: [ RouterTestingModule ], 10 | providers: [AuthGuard] 11 | }); 12 | }); 13 | 14 | it('should ...', inject([AuthGuard], (guard: AuthGuard) => { 15 | expect(guard).toBeTruthy(); 16 | })); 17 | }); 18 | -------------------------------------------------------------------------------- /webApp/src/app/login/login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | 4 | @Component({ 5 | selector: 'app-login', 6 | templateUrl: './login.component.html', 7 | styleUrls: ['./login.component.scss'] 8 | }) 9 | export class LoginComponent implements OnInit { 10 | constructor(private router: Router) {} 11 | 12 | ngOnInit() {} 13 | 14 | onLogin() { 15 | localStorage.setItem('isLoggedin', 'true'); 16 | this.router.navigate(['/dashboard']); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /webApp/src/styles/_material.scss: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Fontil Sans'; 3 | src: url('../assets/fonts/FontinSans/Fontin_Sans_R.otf') format('opentype'); 4 | } 5 | 6 | @import '~@angular/material/prebuilt-themes/deeppurple-amber.css'; 7 | @import '~@angular/material/theming'; 8 | 9 | $custom-typography: mat-typography-config( 10 | $font-family: 'Fontil Sans, monospace', 11 | $headline: mat-typography-level(32px, 48px, 700), 12 | $body-1: mat-typography-level(16px, 24px, 500) 13 | ); 14 | @include angular-material-typography($custom-typography); 15 | -------------------------------------------------------------------------------- /webApp/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2018 StartJavascript 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /webApp/src/app/layout/components/topnav/topnav.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router, NavigationEnd } from '@angular/router'; 3 | 4 | @Component({ 5 | selector: 'app-topnav', 6 | templateUrl: './topnav.component.html', 7 | styleUrls: ['./topnav.component.scss'] 8 | }) 9 | export class TopnavComponent implements OnInit { 10 | 11 | constructor(public router: Router) { 12 | } 13 | 14 | ngOnInit() { 15 | } 16 | 17 | onLoggedout() { 18 | localStorage.removeItem('isLoggedin'); 19 | this.router.navigate(['/login']); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /webApp/src/app/shared/services/rest.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient, HttpHeaders } from '@angular/common/http'; 3 | import { environment } from '../../../environments/environment'; 4 | import { Router } from '@angular/router'; 5 | 6 | @Injectable({ 7 | providedIn: 'root' 8 | }) 9 | export class RestService { 10 | 11 | constructor( private _http: HttpClient, 12 | private _router: Router 13 | ) { } 14 | 15 | 16 | public sendLegalData(data) { 17 | 18 | 19 | const url = environment.ip + '/case_search'; 20 | 21 | return this._http.get(url); 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /webApp/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import { AuthGuard } from './shared/guard/auth.guard'; 4 | 5 | const routes: Routes = [ 6 | { 7 | path: '', 8 | loadChildren: './layout/layout.module#LayoutModule', 9 | canActivate: [AuthGuard] 10 | }, 11 | { 12 | path: 'login', 13 | loadChildren: './login/login.module#LoginModule' 14 | } 15 | ]; 16 | 17 | @NgModule({ 18 | imports: [RouterModule.forRoot(routes)], 19 | exports: [RouterModule], 20 | providers: [AuthGuard] 21 | }) 22 | export class AppRoutingModule {} 23 | -------------------------------------------------------------------------------- /webApp/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | 8 | # dependencies 9 | /node_modules 10 | 11 | # IDEs and editors 12 | /.idea 13 | .project 14 | .classpath 15 | .c9/ 16 | *.launch 17 | .settings/ 18 | *.sublime-workspace 19 | 20 | # IDE - VSCode 21 | .vscode/* 22 | !.vscode/settings.json 23 | !.vscode/tasks.json 24 | !.vscode/launch.json 25 | !.vscode/extensions.json 26 | 27 | # misc 28 | /.sass-cache 29 | /connect.lock 30 | /coverage 31 | /libpeerconnection.log 32 | npm-debug.log 33 | yarn-error.log 34 | testem.log 35 | /typings 36 | 37 | # System Files 38 | .DS_Store 39 | Thumbs.db 40 | -------------------------------------------------------------------------------- /webApp/src/app/login/login.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { FlexLayoutModule } from '@angular/flex-layout'; 4 | import { MatButtonModule, MatCheckboxModule, MatInputModule } from '@angular/material'; 5 | 6 | import { LoginRoutingModule } from './login-routing.module'; 7 | import { LoginComponent } from './login.component'; 8 | 9 | @NgModule({ 10 | imports: [ 11 | CommonModule, 12 | LoginRoutingModule, 13 | MatInputModule, 14 | MatCheckboxModule, 15 | MatButtonModule, 16 | FlexLayoutModule 17 | ], 18 | declarations: [LoginComponent] 19 | }) 20 | export class LoginModule {} 21 | -------------------------------------------------------------------------------- /webApp/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false, 7 | 8 | ip : 'abc' 9 | }; 10 | 11 | /* 12 | * For easier debugging in development mode, you can import the following file 13 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 14 | * 15 | * This import should be commented out in production mode because it will have a negative impact 16 | * on performance if an error is thrown. 17 | */ 18 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 19 | -------------------------------------------------------------------------------- /webApp/src/app/layout/layout-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | 4 | import { LayoutComponent } from './layout.component'; 5 | 6 | const routes: Routes = [ 7 | { 8 | path: '', 9 | component: LayoutComponent, 10 | children: [ 11 | { 12 | path: '', 13 | redirectTo: 'dashboard' 14 | }, 15 | { 16 | path: 'dashboard', 17 | loadChildren: './dashboard/dashboard.module#DashboardModule' 18 | } 19 | ] 20 | } 21 | ]; 22 | 23 | @NgModule({ 24 | imports: [RouterModule.forChild(routes)], 25 | exports: [RouterModule] 26 | }) 27 | export class LayoutRoutingModule {} 28 | -------------------------------------------------------------------------------- /webApp/src/app/layout/layout.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | import { LayoutComponent } from './layout.component'; 3 | 4 | describe('LayoutComponent', () => { 5 | let component: LayoutComponent; 6 | let fixture: ComponentFixture; 7 | 8 | beforeEach(async(() => { 9 | TestBed.configureTestingModule({ 10 | declarations: [LayoutComponent] 11 | }).compileComponents(); 12 | })); 13 | 14 | beforeEach(() => { 15 | fixture = TestBed.createComponent(LayoutComponent); 16 | component = fixture.componentInstance; 17 | fixture.detectChanges(); 18 | }); 19 | 20 | it('should create', () => { 21 | expect(component).toBeTruthy(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /webApp/src/app/login/login.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LoginComponent } from './login.component'; 4 | 5 | describe('LoginComponent', () => { 6 | let component: LoginComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [LoginComponent] 12 | }).compileComponents(); 13 | })); 14 | 15 | beforeEach(() => { 16 | fixture = TestBed.createComponent(LoginComponent); 17 | component = fixture.componentInstance; 18 | fixture.detectChanges(); 19 | }); 20 | 21 | it('should create', () => { 22 | expect(component).toBeTruthy(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /webApp/src/app/layout/components/topnav/topnav.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { TopnavComponent } from './topnav.component'; 4 | 5 | describe('TopnavComponent', () => { 6 | let component: TopnavComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [TopnavComponent] 12 | }).compileComponents(); 13 | })); 14 | 15 | beforeEach(() => { 16 | fixture = TestBed.createComponent(TopnavComponent); 17 | component = fixture.componentInstance; 18 | fixture.detectChanges(); 19 | }); 20 | 21 | it('should create', () => { 22 | expect(component).toBeTruthy(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /webApp/src/app/layout/dashboard/dashboard.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | import { DashboardComponent } from './dashboard.component'; 3 | 4 | describe('DashboardComponent', () => { 5 | let component: DashboardComponent; 6 | let fixture: ComponentFixture; 7 | 8 | beforeEach(async(() => { 9 | TestBed.configureTestingModule({ 10 | declarations: [DashboardComponent] 11 | }).compileComponents(); 12 | })); 13 | 14 | beforeEach(() => { 15 | fixture = TestBed.createComponent(DashboardComponent); 16 | component = fixture.componentInstance; 17 | fixture.detectChanges(); 18 | }); 19 | 20 | it('should create', () => { 21 | expect(component).toBeTruthy(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /elastic_upload.py: -------------------------------------------------------------------------------- 1 | # pip install elasticsearch 2 | import elasticsearch 3 | from datetime import datetime 4 | from pymongo import MongoClient 5 | 6 | print('connecting to db') 7 | # client = MongoClient() 8 | client = MongoClient() 9 | db = client.legal_ai 10 | cases = db.cases 11 | 12 | print('connected') 13 | print('starting upload') 14 | date = datetime(1980, 1, 1) 15 | es = elasticsearch.Elasticsearch() # use default of localhost, port 9200 16 | all_cases = cases.find({ "decision_date":{"$gte":date}}) 17 | id=1 18 | for each_case in all_cases: 19 | new_data = { "id": str(each_case['_id']), "case_body": each_case['case_body'] } 20 | es.index(index='case_law', doc_type='case_body', id=id, body=new_data) 21 | id+=1 22 | 23 | print('completed... checking for `contract breach` in the dataset') 24 | es.search(index='case_law', q='contract breach') -------------------------------------------------------------------------------- /webApp/e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './src/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: require('path').join(__dirname, './tsconfig.e2e.json') 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; -------------------------------------------------------------------------------- /legal-ai-server/requirements.txt: -------------------------------------------------------------------------------- 1 | astroid==2.1.0 2 | bcrypt==3.1.5 3 | certifi==2018.11.29 4 | cffi==1.11.5 5 | chardet==3.0.4 6 | Click==7.0 7 | Flask==1.0.2 8 | certifi==2018.11.29 9 | chardet==3.0.4 10 | Click==7.0 11 | elasticsearch==6.3.1 12 | Flask==1.0.2 13 | Flask-Cors==3.0.7 14 | idna==2.8 15 | isort==4.3.4 16 | itsdangerous==1.1.0 17 | Jinja2==2.10 18 | jsonlines==1.2.0 19 | lazy-object-proxy==1.3.1 20 | MarkupSafe==1.1.0 21 | mccabe==0.6.1 22 | pkg-resources==0.0.0 23 | pycparser==2.19 24 | pylint==2.2.2 25 | pymongo==3.7.2 26 | requests==2.21.0 27 | simplejson==3.16.0 28 | six==1.12.0 29 | typed-ast==1.1.0 30 | urllib3==1.24.1 31 | lazy-object-proxy==1.3.1 32 | MarkupSafe==1.1.0 33 | mccabe==0.6.1 34 | pylint==2.2.2 35 | python-dateutil==2.7.5 36 | requests==2.21.0 37 | six==1.12.0 38 | urllib3==1.24.1 39 | watson-developer-cloud==2.5.1 40 | websocket-client==0.48.0 41 | Werkzeug==0.14.1 42 | wrapt==1.10.11 43 | -------------------------------------------------------------------------------- /webApp/src/app/layout/components/topnav/topnav.component.scss: -------------------------------------------------------------------------------- 1 | :host { 2 | display: block; 3 | position: fixed; 4 | left: 0; 5 | right: 0; 6 | top: 0; 7 | z-index: 1000; 8 | } 9 | .nav-brand { 10 | width: 215px; 11 | text-align: center; 12 | } 13 | .topnav-icon { 14 | text-decoration: none; 15 | display: flex; 16 | color: #fff; 17 | } 18 | 19 | .nav-spacer { 20 | flex: 1 1 auto; 21 | } 22 | 23 | .visible-md { 24 | display: none; 25 | } 26 | .visible-sm { 27 | display: none; 28 | } 29 | 30 | @media screen and (max-width: 992px) { 31 | .visible-md { 32 | display: block; 33 | } 34 | } 35 | @media screen and (max-width: 768px) { 36 | .visible-sm { 37 | display: block; 38 | } 39 | .nav-brand { 40 | width: 100%; 41 | } 42 | } 43 | @media screen and (max-width: 768px) { 44 | .hidden-sm { 45 | display: none; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /webApp/src/app/layout/layout.module.ts: -------------------------------------------------------------------------------- 1 | import { CommonModule } from '@angular/common'; 2 | import { NgModule } from '@angular/core'; 3 | import { 4 | MatButtonModule, 5 | MatIconModule, 6 | MatInputModule, 7 | MatListModule, 8 | MatMenuModule, 9 | MatSidenavModule, 10 | MatToolbarModule 11 | } from '@angular/material'; 12 | import { TopnavComponent } from './components/topnav/topnav.component'; 13 | import { LayoutRoutingModule } from './layout-routing.module'; 14 | import { LayoutComponent } from './layout.component'; 15 | 16 | @NgModule({ 17 | imports: [ 18 | CommonModule, 19 | LayoutRoutingModule, 20 | MatToolbarModule, 21 | MatButtonModule, 22 | MatSidenavModule, 23 | MatIconModule, 24 | MatInputModule, 25 | MatMenuModule, 26 | MatListModule 27 | ], 28 | declarations: [LayoutComponent, TopnavComponent] 29 | }) 30 | 31 | export class LayoutModule {} 32 | -------------------------------------------------------------------------------- /webApp/src/assets/i18n/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "Dashboard": "Dashboard", 3 | "Charts": "Charts", 4 | "Tables": "Tables", 5 | "Forms": "Forms", 6 | "Material Grid": "Material Grid", 7 | "Material Component": "Material Component", 8 | "Menu": "Menu", 9 | "Submenu": "Submenu", 10 | "Blank Page": "Blank Page", 11 | "More Theme": "More Themes", 12 | "Download Now": "Download Now", 13 | "Language": "Language", 14 | "English": "English", 15 | "French": "French", 16 | "Urdu": "Urdu", 17 | "Spanish": "Spanish", 18 | "Italian": "Italian", 19 | "Farsi": "Farsi", 20 | "German": "German", 21 | "Simplified Chinese": "Simplified Chinese", 22 | "Search": "Search", 23 | "Settings": "Settings", 24 | "Profile": "Profile", 25 | "Inbox": "Inbox", 26 | "Log Out": "Log Out", 27 | "Pending Task": "Pending Task", 28 | "In queue": "In queue", 29 | "Mail": "Mail", 30 | "View All": "View All" 31 | } 32 | -------------------------------------------------------------------------------- /webApp/src/app/layout/dashboard/dashboard.module.ts: -------------------------------------------------------------------------------- 1 | import { CommonModule } from '@angular/common'; 2 | import { NgModule } from '@angular/core'; 3 | import { FlexLayoutModule } from '@angular/flex-layout'; 4 | import { MatButtonModule, MatCardModule, MatIconModule, MatTableModule, MatSelectModule, MatInputModule } from '@angular/material'; 5 | import { MatGridListModule } from '@angular/material/grid-list'; 6 | import { FormsModule } from '@angular/forms'; 7 | 8 | import { DashboardRoutingModule } from './dashboard-routing.module'; 9 | import { DashboardComponent } from './dashboard.component'; 10 | 11 | @NgModule({ 12 | imports: [ 13 | CommonModule, 14 | DashboardRoutingModule, 15 | MatGridListModule, 16 | MatCardModule, 17 | FlexLayoutModule, 18 | MatCardModule, 19 | MatTableModule, 20 | MatButtonModule, 21 | MatIconModule, 22 | MatSelectModule, 23 | MatInputModule, 24 | FormsModule 25 | ], 26 | declarations: [DashboardComponent] 27 | }) 28 | export class DashboardModule {} 29 | -------------------------------------------------------------------------------- /webApp/README.md: -------------------------------------------------------------------------------- 1 | # LegalAI 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.8. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Flyn Sequeira 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /webApp/src/app/layout/dashboard/dashboard.component.scss: -------------------------------------------------------------------------------- 1 | table { 2 | width: 100%; 3 | } 4 | .mat-card { 5 | text-align: center; 6 | img { 7 | border-radius: 5px; 8 | margin-top: -25px; 9 | } 10 | } 11 | .mat-table { 12 | box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 13 | 0 1px 5px 0 rgba(0, 0, 0, 0.12); 14 | } 15 | 16 | .mb-20 { 17 | margin-bottom: 20px; 18 | } 19 | 20 | .query-full-width { 21 | width: 75%; 22 | } 23 | 24 | td{ 25 | white-space:nowrap; 26 | overflow:hidden; 27 | text-overflow:ellipsis; 28 | } 29 | 30 | .example-card { 31 | max-width: 75%; 32 | } 33 | 34 | .example-header-image { 35 | background-image: url('https://material.angular.io/assets/img/examples/shiba1.jpg'); 36 | background-size: cover; 37 | } 38 | 39 | .mat-card { 40 | margin-top: 40px; 41 | } 42 | 43 | 44 | .test { 45 | font-size: 16px; 46 | line-height: 16px; 47 | height: 32px; 48 | overflow: hidden; 49 | } 50 | .show { 51 | overflow: visible; 52 | height: auto; 53 | } 54 | 55 | .mat-card-subtitle{ 56 | display: inline; 57 | } -------------------------------------------------------------------------------- /webApp/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/long-stack-trace-zone'; 4 | import 'zone.js/dist/proxy.js'; 5 | import 'zone.js/dist/sync-test'; 6 | import 'zone.js/dist/jasmine-patch'; 7 | import 'zone.js/dist/async-test'; 8 | import 'zone.js/dist/fake-async-test'; 9 | import { getTestBed } from '@angular/core/testing'; 10 | import { 11 | BrowserDynamicTestingModule, 12 | platformBrowserDynamicTesting 13 | } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 16 | declare const __karma__: any; 17 | declare const require: any; 18 | 19 | // Prevent Karma from running prematurely. 20 | __karma__.loaded = function () {}; 21 | 22 | // First, initialize the Angular testing environment. 23 | getTestBed().initTestEnvironment( 24 | BrowserDynamicTestingModule, 25 | platformBrowserDynamicTesting() 26 | ); 27 | // Then we find all the tests. 28 | const context = require.context('./', true, /\.spec\.ts$/); 29 | // And load the modules. 30 | context.keys().map(context); 31 | // Finally, start Karma to run the tests. 32 | __karma__.start(); 33 | -------------------------------------------------------------------------------- /webApp/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { LayoutModule } from '@angular/cdk/layout'; 2 | import { OverlayModule } from '@angular/cdk/overlay'; 3 | import { NgModule } from '@angular/core'; 4 | import { 5 | MatButtonModule, 6 | MatIconModule, 7 | MatListModule, 8 | MatSidenavModule, 9 | MatToolbarModule, 10 | MatCardModule 11 | } from '@angular/material'; 12 | import { BrowserModule } from '@angular/platform-browser'; 13 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 14 | import { HttpClientModule, HttpClient } from '@angular/common/http'; 15 | import { RestService } from './shared/services/rest.service'; 16 | 17 | import { AppRoutingModule } from './app-routing.module'; 18 | import { AppComponent } from './app.component'; 19 | import { NgxSpinnerModule } from 'ngx-spinner'; 20 | 21 | @NgModule({ 22 | declarations: [AppComponent], 23 | imports: [ 24 | BrowserModule, 25 | AppRoutingModule, 26 | BrowserAnimationsModule, 27 | LayoutModule, 28 | OverlayModule, 29 | HttpClientModule, 30 | NgxSpinnerModule 31 | ], 32 | providers: [RestService], 33 | bootstrap: [AppComponent] 34 | }) 35 | export class AppModule {} 36 | -------------------------------------------------------------------------------- /webApp/src/app/layout/dashboard/dashboard.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient, HttpParams,HttpHeaders } from '@angular/common/http'; 3 | import { Headers } from "@angular/http"; 4 | import { throwError } from "rxjs"; 5 | import { catchError, map, tap } from "rxjs/operators"; 6 | 7 | 8 | 9 | 10 | @Injectable({ 11 | providedIn: 'root' 12 | }) 13 | export class DashboardService { 14 | 15 | constructor(private http: HttpClient) { } 16 | 17 | 18 | searchQuery(search_string) { 19 | let opts; 20 | opts = { 21 | headers: this.getCommonHeaders(), 22 | params: new HttpParams().set('page', '0').set('search_string', search_string) 23 | } 24 | let search_url = "http://localhost:5000/api/search-case" 25 | return this.http.get(search_url, opts).pipe( 26 | map(res => { 27 | let searchResult = res; 28 | return searchResult; 29 | }), 30 | catchError(this.handleErrors) 31 | ); 32 | } 33 | getCommonHeaders() { 34 | let headers = new HttpHeaders() 35 | .append('Content-Type', 'application/json') 36 | return headers; 37 | } 38 | handleErrors(error: Response) { 39 | return throwError(error); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /webApp/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, TestBed } from '@angular/core/testing'; 2 | import { RouterTestingModule } from '@angular/router/testing'; 3 | import { AppComponent } from './app.component'; 4 | 5 | describe('AppComponent', () => { 6 | beforeEach(async(() => { 7 | TestBed.configureTestingModule({ 8 | imports: [RouterTestingModule], 9 | declarations: [AppComponent] 10 | }).compileComponents(); 11 | })); 12 | it('should create the app', async(() => { 13 | const fixture = TestBed.createComponent(AppComponent); 14 | const app = fixture.debugElement.componentInstance; 15 | expect(app).toBeTruthy(); 16 | })); 17 | it(`should have as title 'app'`, async(() => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.debugElement.componentInstance; 20 | expect(app.title).toEqual('app'); 21 | })); 22 | it('should render title in a h1 tag', async(() => { 23 | const fixture = TestBed.createComponent(AppComponent); 24 | fixture.detectChanges(); 25 | const compiled = fixture.debugElement.nativeElement; 26 | expect(compiled.querySelector('h1').textContent).toContain( 27 | 'Welcome to app!' 28 | ); 29 | })); 30 | }); 31 | -------------------------------------------------------------------------------- /webApp/src/app/login/login.component.scss: -------------------------------------------------------------------------------- 1 | .login-page { 2 | display: flex; 3 | align-items: center; 4 | justify-content: center; 5 | height: 100vh; 6 | position: relative; 7 | .content { 8 | z-index: 1; 9 | display: flex; 10 | align-items: center; 11 | justify-content: center; 12 | .app-name { 13 | margin-top: 0px; 14 | padding-bottom: 10px; 15 | font-size: 32px; 16 | } 17 | .login-form { 18 | padding: 40px; 19 | background: #fff; 20 | width: 500px; 21 | box-shadow: 0 0 10px #ddd; 22 | input:-webkit-autofill { 23 | -webkit-box-shadow: 0 0 0 30px white inset; 24 | } 25 | } 26 | } 27 | 28 | &:after { 29 | content: ''; 30 | background: #fff; 31 | position: absolute; 32 | top: 0; 33 | left: 0; 34 | bottom: 50%; 35 | right: 0; 36 | } 37 | &:before { 38 | content: ''; 39 | background: #3f51b5; 40 | position: absolute; 41 | top: 50%; 42 | left: 0; 43 | bottom: 0; 44 | right: 0; 45 | } 46 | } 47 | .text-center { 48 | text-align: center; 49 | } 50 | .w-100 { 51 | width: 100%; 52 | } 53 | -------------------------------------------------------------------------------- /webApp/src/app/layout/dashboard/dashboard.component.html: -------------------------------------------------------------------------------- 1 |
2 |

Tell us about your legal problem, and we'll show you relevant results with insights.

3 | 4 | 5 | {{60- incidentDescription.value.length}}/60 6 | No results found for your query. 7 | Please enter your query. 8 |
9 |
10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 |
18 | Case {{(i) + (1) }}
19 | '{{cat.label}}'   20 |
21 | 22 | 23 |
24 | {{case.analytics.summary}} 25 |
26 | 27 |
28 | 29 | 30 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 |
39 | -------------------------------------------------------------------------------- /webApp/src/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | const defaults = { 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../coverage'), 20 | reports: ['html', 'lcovonly'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | angularCli: { 24 | environment: 'dev' 25 | }, 26 | reporters: ['progress', 'kjhtml'], 27 | port: 9876, 28 | colors: true, 29 | logLevel: config.LOG_INFO, 30 | autoWatch: true, 31 | browsers: ['Chrome'], 32 | singleRun: false, 33 | } 34 | 35 | if (process.env.TEST_CI) { 36 | Object.assign(defaults, { 37 | autoWatch: false, 38 | browsers: ['ChromeHeadlessNoSandbox'], 39 | singleRun: true, 40 | customLaunchers: { 41 | ChromeHeadlessNoSandbox: { 42 | base: 'ChromeHeadless', 43 | flags: ['--no-sandbox'] 44 | } 45 | }, 46 | browserNoActivityTimeout: 60000, 47 | }) 48 | } 49 | 50 | config.set(defaults) 51 | }; 52 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | apturl==0.5.2 2 | autoenv==1.0.0 3 | beautifulsoup4==4.4.1 4 | blinker==1.3 5 | Brlapi==0.6.4 6 | chardet==2.3.0 7 | checkbox-support==0.22 8 | Click==7.0 9 | command-not-found==0.3 10 | cryptography==1.2.3 11 | defer==1.0.6 12 | feedparser==5.1.3 13 | Flask==1.0.2 14 | Flask-PyMongo==2.2.0 15 | guacamole==0.9.2 16 | html5lib==0.999 17 | httplib2==0.9.1 18 | idna==2.0 19 | itsdangerous==1.1.0 20 | Jinja2==2.10 21 | language-selector==0.1 22 | louis==2.6.4 23 | lxml==3.5.0 24 | Mako==1.0.3 25 | MarkupSafe==0.23 26 | oauthlib==1.0.3 27 | onboard==1.2.0 28 | padme==1.1.1 29 | pexpect==4.0.1 30 | Pillow==3.1.2 31 | plainbox==0.25 32 | ptyprocess==0.5 33 | pyasn1==0.1.9 34 | pycups==1.9.73 35 | pycurl==7.43.0 36 | pygobject==3.20.0 37 | PyJWT==1.3.0 38 | pymongo==3.7.2 39 | pyparsing==2.0.3 40 | python-apt==1.1.0b1+ubuntu0.16.4.2 41 | python-debian==0.1.27 42 | python-systemd==231 43 | pyxdg==0.25 44 | reportlab==3.3.0 45 | requests==2.9.1 46 | screen-resolution-extra==0.0.0 47 | sessioninstaller==0.0.0 48 | six==1.10.0 49 | system-service==0.3 50 | ubuntu-drivers-common==0.0.0 51 | ufw==0.35 52 | unattended-upgrades==0.1 53 | unity-scope-calculator==0.1 54 | unity-scope-chromiumbookmarks==0.1 55 | unity-scope-colourlovers==0.1 56 | unity-scope-devhelp==0.1 57 | unity-scope-firefoxbookmarks==0.1 58 | unity-scope-gdrive==0.7 59 | unity-scope-manpages==0.1 60 | unity-scope-openclipart==0.1 61 | unity-scope-texdoc==0.1 62 | unity-scope-tomboy==0.1 63 | unity-scope-virtualbox==0.1 64 | unity-scope-yelp==0.1 65 | unity-scope-zotero==0.1 66 | urllib3==1.13.1 67 | usb-creator==0.3.0 68 | Werkzeug==0.14.1 69 | xdiagnose==3.8.4.1 70 | xkit==0.0.0 71 | XlsxWriter==0.7.3 72 | -------------------------------------------------------------------------------- /webApp/src/styles/_utils.scss: -------------------------------------------------------------------------------- 1 | .m-0 { 2 | margin: 0; 3 | } 4 | .p-0 { 5 | padding: 0; 6 | } 7 | .mt5 { 8 | padding-top: 5px; 9 | } 10 | .mt10 { 11 | padding-top: 10px; 12 | } 13 | .mt15 { 14 | padding-top: 15px; 15 | } 16 | .mt20 { 17 | padding-top: 20px; 18 | } 19 | .mb5 { 20 | padding-bottom: 5px; 21 | } 22 | .mb10 { 23 | padding-bottom: 10px; 24 | } 25 | .mb15 { 26 | padding-bottom: 15px; 27 | } 28 | .mb20 { 29 | padding-bottom: 20px; 30 | } 31 | .ml5 { 32 | padding-left: 5px; 33 | } 34 | .ml10 { 35 | padding-left: 10px; 36 | } 37 | .ml15 { 38 | padding-left: 15px; 39 | } 40 | .ml20 { 41 | padding-left: 20px; 42 | } 43 | .mr5 { 44 | padding-right: 5px; 45 | } 46 | .mr10 { 47 | padding-right: 10px; 48 | } 49 | .mr15 { 50 | padding-right: 15px; 51 | } 52 | .mr20 { 53 | padding-right: 20px; 54 | } 55 | 56 | .pt5 { 57 | padding-top: 5px; 58 | } 59 | .pt10 { 60 | padding-top: 10px; 61 | } 62 | .pt15 { 63 | padding-top: 15px; 64 | } 65 | .pt20 { 66 | padding-top: 20px; 67 | } 68 | .pb5 { 69 | padding-bottom: 5px; 70 | } 71 | .pb10 { 72 | padding-bottom: 10px; 73 | } 74 | .pb15 { 75 | padding-bottom: 15px; 76 | } 77 | .pb20 { 78 | padding-bottom: 20px; 79 | } 80 | .pl5 { 81 | padding-left: 5px; 82 | } 83 | .pl10 { 84 | padding-left: 10px; 85 | } 86 | .pl15 { 87 | padding-left: 15px; 88 | } 89 | .pl20 { 90 | padding-left: 20px; 91 | } 92 | .pr5 { 93 | padding-right: 5px; 94 | } 95 | .pr10 { 96 | padding-right: 10px; 97 | } 98 | .pr15 { 99 | padding-right: 15px; 100 | } 101 | .pr20 { 102 | padding-right: 20px; 103 | } 104 | -------------------------------------------------------------------------------- /webApp/src/app/login/login.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /webApp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sb-admin-material", 3 | "version": "7.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve --progress", 7 | "build": "ng build --prod", 8 | "gitbuild": "ng build --prod", 9 | "test": "ng test", 10 | "lint": "ng lint", 11 | "e2e": "ng e2e" 12 | }, 13 | "private": true, 14 | "dependencies": { 15 | "@angular/animations": "7.0.2", 16 | "@angular/cdk": "7.0.2", 17 | "@angular/common": "7.0.2", 18 | "@angular/compiler": "7.0.2", 19 | "@angular/core": "7.0.2", 20 | "@angular/flex-layout": "7.0.0-beta.19", 21 | "@angular/forms": "7.0.2", 22 | "@angular/http": "7.0.2", 23 | "@angular/material": "7.0.2", 24 | "@angular/platform-browser": "7.0.2", 25 | "@angular/platform-browser-dynamic": "7.0.2", 26 | "@angular/router": "7.0.2", 27 | "core-js": "2.5.7", 28 | "hammerjs": "2.0.8", 29 | "ngx-spinner": "^6.1.2", 30 | "package.json": "^2.0.1", 31 | "rxjs": "6.3.3", 32 | "web-animations-js": "2.3.1", 33 | "zone.js": "0.8.26" 34 | }, 35 | "devDependencies": { 36 | "@angular-devkit/build-angular": "0.10.4", 37 | "@angular/cli": "7.0.4", 38 | "@angular/compiler-cli": "7.0.2", 39 | "@angular/language-service": "7.0.2", 40 | "@types/jasmine": "2.8.9", 41 | "@types/jasminewd2": "2.0.5", 42 | "@types/node": "10.12.2", 43 | "codelyzer": "4.5.0", 44 | "jasmine-core": "3.3.0", 45 | "jasmine-spec-reporter": "4.2.1", 46 | "karma": "3.1.1", 47 | "karma-chrome-launcher": "2.2.0", 48 | "karma-coverage-istanbul-reporter": "2.0.4", 49 | "karma-jasmine": "1.1.2", 50 | "karma-jasmine-html-reporter": "1.4.0", 51 | "protractor": "5.4.1", 52 | "ts-node": "7.0.1", 53 | "tslint": "5.11.0", 54 | "typescript": "3.1.1" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /law_eda.py: -------------------------------------------------------------------------------- 1 | # pip install pymongo 2 | # pip install jsonlines 3 | 4 | import jsonlines 5 | from pymongo import MongoClient 6 | import xml.etree.ElementTree as ET 7 | import datetime 8 | 9 | client = MongoClient() 10 | db = client.legal_ai 11 | cases = db.cases 12 | 13 | print("about to upload jsonl file to local mongodb") 14 | id_saved = [] 15 | with jsonlines.open('./data.jsonl') as reader: 16 | for obj in reader: 17 | if int(obj['decision_date'][0:4])>1950: 18 | case_id = cases.insert_one(obj).inserted_id 19 | id_saved.append(case_id) 20 | 21 | print("Added all the files... No of documents added: "+str(len(id_saved))) 22 | 23 | all_cases = cases.find() 24 | 25 | for each_case in all_cases: 26 | 27 | # String to timestamp format 28 | try: 29 | decision_date = datetime.datetime.strptime(each_case['decision_date'], "%Y-%m-%d %H:%M:%S") 30 | except: 31 | try: 32 | decision_date = datetime.datetime.strptime(each_case['decision_date'], "%Y-%m-%d") 33 | except: 34 | try: 35 | decision_date = datetime.datetime.strptime(each_case['decision_date'], "%Y-%m") 36 | except: 37 | try: 38 | decision_date = datetime.datetime.strptime(each_case['decision_date'], "%Y") 39 | except: 40 | pass 41 | 42 | # clean xml dataset to pure string for nlp 43 | root = ET.fromstring(each_case['casebody']['data']) 44 | summary='' 45 | for child in root: 46 | for sub_child in child: 47 | if 'footnotemark' in sub_child.tag[sub_child.tag.index("}")+1:] or 'author' in sub_child.tag[sub_child.tag.index("}")+1:]: 48 | continue 49 | summary+=sub_child.text + "\n" 50 | 51 | # Update each case 52 | myquery = { "_id": each_case['_id'] } 53 | newvalues = { "$set": { "case_body": summary, "decision_date": decision_date } } 54 | cases.update_one(myquery, newvalues) 55 | 56 | print('completed. Check database'); -------------------------------------------------------------------------------- /legal-ai-server/server.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template, request, redirect, url_for, session 2 | from pymongo import MongoClient 3 | import bcrypt 4 | import datetime 5 | import requests 6 | import json 7 | import time 8 | from watson_developer_cloud import NaturalLanguageUnderstandingV1 9 | from watson_developer_cloud.natural_language_understanding_v1 import Features, CategoriesOptions, SemanticRolesOptions 10 | import elasticsearch 11 | from flask_cors import CORS 12 | 13 | 14 | def connect(): 15 | connection = MongoClient('localhost', 27017) 16 | handle = connection["flask_reminders"] 17 | return handle 18 | 19 | app = Flask(__name__) 20 | handle = connect() 21 | 22 | cors = CORS(app, resources={r"/api/*": {"origins": "*"}}) 23 | 24 | @app.route("/") 25 | def hello(): 26 | return "Hello World!" 27 | 28 | 29 | @app.route("/api/search-case", methods=['GET']) 30 | def search_case(): 31 | search_string = request.args.get('search_string') 32 | es = elasticsearch.Elasticsearch() # use default of localhost, port 9200 33 | # es.search(index='case_law', q='contract breach') 34 | result = es.search(index='case_law', q=search_string) 35 | search_results = [] 36 | 37 | for each_hit in result['hits']['hits']: 38 | search_results.append({'id':each_hit['_source']['id'], 'case_body':each_hit['_source']['case_body']}) 39 | summarized_search_result = summarize_case(search_results) 40 | return json.dumps({ 'summarized_search_result' : summarized_search_result }) 41 | 42 | 43 | 44 | def summarize_case(search_results): 45 | summary = '' 46 | for index,each_result in enumerate(search_results): 47 | natural_language_understanding = NaturalLanguageUnderstandingV1(version='2018-11-16',iam_apikey='fhfAp9h12U5DSbZ0AzPomZ-suKwnboNAg3EdorPHsB5e',url='https://gateway-lon.watsonplatform.net/natural-language-understanding/api') 48 | search_results[index]['analytics'] = natural_language_understanding.analyze(text=each_result['case_body'],language='en',features=Features(categories=CategoriesOptions(limit=3),semantic_roles=SemanticRolesOptions())).get_result() 49 | for role in search_results[index]['analytics']['semantic_roles']: 50 | if role['sentence'] not in summary: 51 | summary+=' '+role['sentence'] 52 | search_results[index]['analytics']['summary']=summary 53 | 54 | return search_results 55 | # natural_language_understanding = NaturalLanguageUnderstandingV1(version='2018-11-16',iam_apikey='fhfAp9h12U5DSbZ0AzPomZ-suKwnboNAg3EdorPHsB5e',url='https://gateway-lon.watsonplatform.net/natural-language-understanding/api') 56 | # res = natural_language_understanding.analyze(text='What the hell is going on!!!!',features=Features(categories=CategoriesOptions(limit=3))).get_result() 57 | # print(res) 58 | 59 | if __name__ == "__main__": 60 | app.run() 61 | -------------------------------------------------------------------------------- /webApp/src/app/layout/dashboard/dashboard.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, ViewChild } from '@angular/core'; 2 | import { RestService } from '../../shared/services/rest.service'; 3 | import { DashboardService } from './dashboard.service'; 4 | import {MatPaginator, MatTableDataSource} from '@angular/material'; 5 | import { NgxSpinnerService } from 'ngx-spinner'; 6 | import { SHARED_FORM_DIRECTIVES } from '@angular/forms/src/directives'; 7 | 8 | @Component({ 9 | selector: 'app-dashboard', 10 | templateUrl: './dashboard.component.html', 11 | styleUrls: ['./dashboard.component.scss'] 12 | }) 13 | export class DashboardComponent implements OnInit { 14 | userQuery: String; 15 | caseList = []; 16 | showTable = false; 17 | error = false; 18 | emptyErr = false; 19 | show = false; 20 | 21 | // demoDataset = { 22 | // "sentiment": { 23 | // "document": { 24 | // "score": -0.479108, 25 | // "label": "negative" 26 | // } 27 | // }, 28 | // "emotion": { 29 | // "document": { 30 | // "emotion": { 31 | // "sadness": 0.494381, 32 | // "joy": 0.475491, 33 | // "fear": 0.088296, 34 | // "disgust": 0.127116, 35 | // "anger": 0.133539 36 | // } 37 | // } 38 | // } 39 | // }; 40 | 41 | 42 | constructor(private _rest: RestService, private dashboardService: DashboardService, private _spinner: NgxSpinnerService) { 43 | } 44 | 45 | displayedColumns: string[] = ['legal_id', 'case_body']; 46 | 47 | 48 | ngOnInit() { 49 | 50 | } 51 | 52 | 53 | submitForm() { 54 | this._spinner.show(); 55 | 56 | if (this.userQuery !== undefined) { 57 | 58 | this.dashboardService.searchQuery(this.userQuery).subscribe(searchResult => { 59 | this._spinner.hide(); 60 | console.log(searchResult); 61 | this.caseList = searchResult['summarized_search_result']; 62 | console.log(this.caseList); 63 | this.showTable = true; 64 | if (Object.keys(this.caseList).length === 0) { 65 | this.showTable = false; 66 | this.error = true; 67 | } 68 | }, err => { 69 | this._spinner.hide(); 70 | console.log(err); 71 | }); 72 | 73 | } else { 74 | this._spinner.hide(); 75 | this.emptyErr = true; 76 | } 77 | 78 | } 79 | 80 | toggleShow(i) { 81 | console.log(i); 82 | // document.querySelector('div-' + i).style.cssText = "--my-var: #000" 83 | if ( document.getElementById(i).className.indexOf('show') > -1 ) { 84 | document.getElementById(i).classList.remove('show'); 85 | } else { 86 | document.getElementById(i).classList.add('show'); 87 | } 88 | this.show = true; 89 | 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /webApp/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | import 'core-js/es6/array'; 2 | import 'core-js/es6/date'; 3 | import 'core-js/es6/function'; 4 | import 'core-js/es6/map'; 5 | import 'core-js/es6/math'; 6 | import 'core-js/es6/number'; 7 | import 'core-js/es6/object'; 8 | import 'core-js/es6/parse-float'; 9 | import 'core-js/es6/parse-int'; 10 | import 'core-js/es6/regexp'; 11 | import 'core-js/es6/set'; 12 | import 'core-js/es6/string'; 13 | import 'core-js/es6/symbol'; 14 | import 'core-js/es6/weak-map'; 15 | import 'core-js/es7/reflect'; 16 | import 'web-animations-js'; 17 | import 'zone.js/dist/zone'; 18 | 19 | /** 20 | * This file includes polyfills needed by Angular and is loaded before the app. 21 | * You can add your own extra polyfills to this file. 22 | * 23 | * This file is divided into 2 sections: 24 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 25 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 26 | * file. 27 | * 28 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 29 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 30 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 31 | * 32 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html 33 | */ 34 | 35 | /*************************************************************************************************** 36 | * BROWSER POLYFILLS 37 | */ 38 | 39 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/ 40 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 41 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 42 | 43 | /** IE10 and IE11 requires the following for the Reflect API. */ 44 | // import 'core-js/es6/reflect'; 45 | 46 | /** Evergreen browsers require these. **/ 47 | // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. 48 | /** 49 | * Web Animations `@angular/platform-browser/animations` 50 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 51 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 52 | **/ 53 | // Run `npm install --save web-animations-js`. 54 | 55 | /** 56 | * By default, zone.js will patch all possible macroTask and DomEvents 57 | * user can disable parts of macroTask/DomEvents patch by setting following flags 58 | */ 59 | 60 | // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 61 | // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 62 | // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 63 | 64 | /* 65 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 66 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 67 | */ 68 | // (window as any).__Zone_enable_cross_context_check = true; 69 | 70 | /*************************************************************************************************** 71 | * Zone JS is required by default for Angular itself. 72 | */ 73 | /*************************************************************************************************** 74 | * APPLICATION IMPORTS 75 | */ 76 | -------------------------------------------------------------------------------- /webApp/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "arrow-return-shorthand": true, 7 | "callable-types": true, 8 | "class-name": true, 9 | "comment-format": [ 10 | true, 11 | "check-space" 12 | ], 13 | "curly": true, 14 | "deprecation": { 15 | "severity": "warn" 16 | }, 17 | "eofline": true, 18 | "forin": true, 19 | "import-blacklist": [ 20 | true, 21 | "rxjs/Rx" 22 | ], 23 | "import-spacing": true, 24 | "indent": [ 25 | true, 26 | "spaces" 27 | ], 28 | "interface-over-type-literal": true, 29 | "label-position": true, 30 | "max-line-length": [ 31 | true, 32 | 140 33 | ], 34 | "member-access": false, 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-arg": true, 47 | "no-bitwise": true, 48 | "no-console": [ 49 | true, 50 | "debug", 51 | "info", 52 | "time", 53 | "timeEnd", 54 | "trace" 55 | ], 56 | "no-construct": true, 57 | "no-debugger": true, 58 | "no-duplicate-super": true, 59 | "no-empty": false, 60 | "no-empty-interface": true, 61 | "no-eval": true, 62 | "no-inferrable-types": [ 63 | true, 64 | "ignore-params" 65 | ], 66 | "no-misused-new": true, 67 | "no-non-null-assertion": true, 68 | "no-redundant-jsdoc": true, 69 | "no-shadowed-variable": true, 70 | "no-string-literal": false, 71 | "no-string-throw": true, 72 | "no-switch-case-fall-through": true, 73 | "no-trailing-whitespace": true, 74 | "no-unnecessary-initializer": true, 75 | "no-unused-expression": true, 76 | "no-use-before-declare": true, 77 | "no-var-keyword": true, 78 | "object-literal-sort-keys": false, 79 | "one-line": [ 80 | true, 81 | "check-open-brace", 82 | "check-catch", 83 | "check-else", 84 | "check-whitespace" 85 | ], 86 | "prefer-const": true, 87 | "quotemark": [ 88 | true, 89 | "single" 90 | ], 91 | "radix": true, 92 | "semicolon": [ 93 | true, 94 | "always" 95 | ], 96 | "triple-equals": [ 97 | true, 98 | "allow-null-check" 99 | ], 100 | "typedef-whitespace": [ 101 | true, 102 | { 103 | "call-signature": "nospace", 104 | "index-signature": "nospace", 105 | "parameter": "nospace", 106 | "property-declaration": "nospace", 107 | "variable-declaration": "nospace" 108 | } 109 | ], 110 | "unified-signatures": true, 111 | "variable-name": false, 112 | "whitespace": [ 113 | true, 114 | "check-branch", 115 | "check-decl", 116 | "check-operator", 117 | "check-separator", 118 | "check-type" 119 | ], 120 | "directive-selector": [ 121 | true, 122 | "attribute", 123 | "app", 124 | "camelCase" 125 | ], 126 | "component-selector": [ 127 | true, 128 | "element", 129 | "app", 130 | "kebab-case" 131 | ], 132 | "no-output-on-prefix": true, 133 | "use-input-property-decorator": true, 134 | "use-output-property-decorator": true, 135 | "use-host-property-decorator": true, 136 | "no-input-rename": true, 137 | "no-output-rename": true, 138 | "use-life-cycle-interface": true, 139 | "use-pipe-transform-interface": true, 140 | "component-class-suffix": true, 141 | "directive-class-suffix": true 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /webApp/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "ng-material": { 7 | "root": "", 8 | "sourceRoot": "src", 9 | "projectType": "application", 10 | "prefix": "app", 11 | "schematics": { 12 | "@schematics/angular:component": { 13 | "styleext": "scss" 14 | } 15 | }, 16 | "architect": { 17 | "build": { 18 | "builder": "@angular-devkit/build-angular:browser", 19 | "options": { 20 | "outputPath": "dist", 21 | "index": "src/index.html", 22 | "main": "src/main.ts", 23 | "tsConfig": "src/tsconfig.app.json", 24 | "polyfills": "src/polyfills.ts", 25 | "assets": [ 26 | "src/assets", 27 | "src/favicon.ico" 28 | ], 29 | "styles": [ 30 | "src/styles/styles.scss" 31 | ], 32 | "scripts": [ 33 | ] 34 | }, 35 | "configurations": { 36 | "production": { 37 | "fileReplacements": [ 38 | { 39 | "replace": "src/environments/environment.ts", 40 | "with": "src/environments/environment.prod.ts" 41 | } 42 | ], 43 | "optimization": true, 44 | "outputHashing": "all", 45 | "sourceMap": false, 46 | "extractCss": true, 47 | "namedChunks": false, 48 | "aot": true, 49 | "extractLicenses": true, 50 | "vendorChunk": false, 51 | "buildOptimizer": true, 52 | "budgets": [ 53 | { 54 | "type": "initial", 55 | "maximumWarning": "2mb", 56 | "maximumError": "5mb" 57 | } 58 | ] 59 | } 60 | } 61 | }, 62 | "serve": { 63 | "builder": "@angular-devkit/build-angular:dev-server", 64 | "options": { 65 | "browserTarget": "ng-material:build" 66 | }, 67 | "configurations": { 68 | "production": { 69 | "browserTarget": "ng-material:build:production" 70 | } 71 | } 72 | }, 73 | "extract-i18n": { 74 | "builder": "@angular-devkit/build-angular:extract-i18n", 75 | "options": { 76 | "browserTarget": "ng-material:build" 77 | } 78 | }, 79 | "test": { 80 | "builder": "@angular-devkit/build-angular:karma", 81 | "options": { 82 | "main": "src/test.ts", 83 | "polyfills": "src/polyfills.ts", 84 | "tsConfig": "src/tsconfig.spec.json", 85 | "karmaConfig": "src/karma.conf.js", 86 | "scripts": [ 87 | "node_modules/chart.js/dist/Chart.js" 88 | ], 89 | "styles": [ 90 | "styles.scss" 91 | ], 92 | "assets": [ 93 | "src/assets", 94 | "src/favicon.ico" 95 | ] 96 | } 97 | }, 98 | "lint": { 99 | "builder": "@angular-devkit/build-angular:tslint", 100 | "options": { 101 | "tsConfig": [ 102 | "src/tsconfig.app.json", 103 | "src/tsconfig.spec.json" 104 | ], 105 | "exclude": [ 106 | "**/node_modules/**" 107 | ] 108 | } 109 | } 110 | } 111 | }, 112 | "ng-material-e2e": { 113 | "root": "e2e/", 114 | "projectType": "application", 115 | "prefix": "", 116 | "architect": { 117 | "e2e": { 118 | "builder": "@angular-devkit/build-angular:protractor", 119 | "options": { 120 | "protractorConfig": "e2e/protractor.conf.js", 121 | "devServerTarget": "ng-material:serve" 122 | }, 123 | "configurations": { 124 | "production": { 125 | "devServerTarget": "ng-material:serve:production" 126 | } 127 | } 128 | }, 129 | "lint": { 130 | "builder": "@angular-devkit/build-angular:tslint", 131 | "options": { 132 | "tsConfig": "e2e/tsconfig.e2e.json", 133 | "exclude": [ 134 | "**/node_modules/**" 135 | ] 136 | } 137 | } 138 | } 139 | } 140 | }, 141 | "defaultProject": "ng-material" 142 | } 143 | --------------------------------------------------------------------------------