mirror of
https://github.com/kuhyx/ARAI.git
synced 2026-07-04 13:23:03 +02:00
Merge branch 'kuhyx'
This commit is contained in:
commit
b293753ab1
@ -1,52 +1,107 @@
|
||||
from flask import Flask, jsonify, request
|
||||
from flask import Flask, request, jsonify
|
||||
from flask_cors import CORS, cross_origin
|
||||
import pathlib
|
||||
import sys
|
||||
import pandas as pd
|
||||
import os
|
||||
|
||||
app = Flask(__name__)
|
||||
cors = CORS(app)
|
||||
app.config['CORS_HEADERS'] = 'Content-Type'
|
||||
|
||||
@cross_origin()
|
||||
@app.route("/", methods=['POST'])
|
||||
def statistics_output():
|
||||
data = request.get_json()
|
||||
cost_of_trial = data.get('response_data', {}).get('cost_of_trial')
|
||||
time_of_trial = data.get('response_data', {}).get('time_of_trial')
|
||||
|
||||
response = {
|
||||
"response_type": "statics_output",
|
||||
"response_data": {
|
||||
"cost_of_trial": cost_of_trial, # cena w PLN (integer)
|
||||
"time_of_trial": time_of_trial # czas w formacie UTC (unix time stamp)
|
||||
}
|
||||
}
|
||||
|
||||
return jsonify(response)
|
||||
|
||||
def recommended_mediators():
|
||||
data = request.get_json()
|
||||
request_type = data.get('request_type', {}).get('request_type')
|
||||
request_data = data.get('request_data', {}).get('experts_called')
|
||||
generic_input = data.get('generic_input', {}).get('generic_input')
|
||||
trial_cost = data.get('trial_cost', {}).get('trial_cost')
|
||||
localization = data.get('localization', {}).get('localization')
|
||||
experts_called = data.get('experts_called', {}).get('experts_called')
|
||||
witnesses_called = data.get('witnesses_called', {}).get('witnesses_called')
|
||||
|
||||
top_5 = {}
|
||||
list_of_mediators = []
|
||||
|
||||
for i in range(5):
|
||||
mediator = {}
|
||||
top_5.add(mediator)
|
||||
input = data.get('request_data', {})
|
||||
|
||||
response = {
|
||||
liczba_miesiecy, koszt = calc_stats("2", 25000, True)
|
||||
|
||||
top_5 = {
|
||||
"response_type": "recommended_mediators",
|
||||
"response_data": {
|
||||
"name": name,
|
||||
"specialization": specialization,
|
||||
"localization": localization,
|
||||
"score": score,
|
||||
"number_of_opinions": number_of_opinions
|
||||
"response_data": {"first": {
|
||||
"cost_of_trial": koszt,
|
||||
"time_of_trial": liczba_miesiecy
|
||||
}, "second": [{
|
||||
"name": "Mateusz Szpyruk",
|
||||
"specialization": "Prawo podatkowe",
|
||||
"location": input.get("location"),
|
||||
"ai_rating": 99,
|
||||
"user_rating": 99,
|
||||
"number_of_opinions": 5
|
||||
}, {
|
||||
"name": "Jan Kowalski",
|
||||
"specialization": "Prawo pracy",
|
||||
"location": input.get("location"),
|
||||
"ai_rating": 90,
|
||||
"user_rating": 99,
|
||||
"number_of_opinions": 5
|
||||
}, {
|
||||
"name": "Jan Kowalski",
|
||||
"specialization": "Prawo pracy",
|
||||
"location": input.get("location"),
|
||||
"ai_rating": 90,
|
||||
"user_rating": 99,
|
||||
"number_of_opinions": 5
|
||||
}]}
|
||||
}
|
||||
}
|
||||
|
||||
return jsonify(top_5)
|
||||
|
||||
|
||||
def calc_stats(typ,kwota,biegly):
|
||||
mapka = {'1':'cywilnej','2':'górniczej','3':'gospodarczej','4':'prawa pracy & ubezpieczeń'}
|
||||
koszt_bieglego= 1789.42
|
||||
koszt = 0
|
||||
danePath = 'dane.xlsx'
|
||||
if kwota < 100000 and typ != '4':
|
||||
df = pd.read_excel(danePath,sheet_name='rejon')
|
||||
mask = df['RODZAJ'] == int(typ)
|
||||
liczba_miesiecy = df[mask]['mean']
|
||||
procent = (1 - df[mask]['procent do 12 miesięcy']) * 100
|
||||
koszt_sadu = 0
|
||||
koszt_adwokata = 0
|
||||
if kwota <= 500:
|
||||
koszt_sadu = 30
|
||||
koszt_adwokata = 90
|
||||
elif kwota > 500 and kwota <= 1500:
|
||||
koszt_sadu = 100
|
||||
koszt_adwokata = 270
|
||||
elif kwota > 1500 and kwota <= 4000:
|
||||
koszt_sadu = 200
|
||||
elif kwota > 4000 and kwota <= 7500:
|
||||
koszt_sadu = 400
|
||||
elif kwota > 7500 and kwota <= 10000:
|
||||
koszt_sadu = 500
|
||||
elif kwota > 10000 and kwota <= 15000:
|
||||
koszt_sadu = 750
|
||||
elif kwota > 15000 and kwota <= 20000:
|
||||
koszt_sadu = 1000
|
||||
elif kwota > 20000:
|
||||
koszt_sadu = kwota * 0.05
|
||||
if koszt_sadu > 20000:
|
||||
koszt_sadu = 20000
|
||||
|
||||
if kwota > 1500 and kwota <= 5000:
|
||||
koszt_adwokata = 900
|
||||
elif kwota > 5000 and kwota <= 10000:
|
||||
koszt_adwokata = 1800
|
||||
elif kwota > 10000 and kwota <= 50000:
|
||||
koszt_adwokata = 3600
|
||||
elif kwota > 50000 and kwota <= 100000:
|
||||
koszt_adwokata = 5400
|
||||
|
||||
|
||||
if biegly == 'True':
|
||||
koszt = koszt_sadu + koszt_adwokata + koszt_bieglego
|
||||
else:
|
||||
koszt = koszt_sadu + koszt_adwokata
|
||||
print(f"Średni czas trwania rozprawy typu {mapka[typ]} wynosi {round(liczba_miesiecy,0).to_string(index=False)} miesięcy, a {procent.to_string(index=False)}% spraw trwa dłuzej niz rok, jej minimalny koszt wyniesie {koszt}")
|
||||
returnMiesiace = round(liczba_miesiecy,0).to_string(index=False)
|
||||
print(returnMiesiace, koszt)
|
||||
return returnMiesiace, koszt
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
||||
BIN
Backend_correct/dane.xlsx
Normal file
BIN
Backend_correct/dane.xlsx
Normal file
Binary file not shown.
16
arai-frontend/.editorconfig
Normal file
16
arai-frontend/.editorconfig
Normal file
@ -0,0 +1,16 @@
|
||||
# Editor configuration, see https://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.ts]
|
||||
quote_type = single
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
||||
42
arai-frontend/.gitignore
vendored
Normal file
42
arai-frontend/.gitignore
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# Compiled output
|
||||
/dist
|
||||
/tmp
|
||||
/out-tsc
|
||||
/bazel-out
|
||||
|
||||
# Node
|
||||
/node_modules
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
|
||||
# IDEs and editors
|
||||
.idea/
|
||||
.project
|
||||
.classpath
|
||||
.c9/
|
||||
*.launch
|
||||
.settings/
|
||||
*.sublime-workspace
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
.history/*
|
||||
|
||||
# Miscellaneous
|
||||
/.angular/cache
|
||||
.sass-cache/
|
||||
/connect.lock
|
||||
/coverage
|
||||
/libpeerconnection.log
|
||||
testem.log
|
||||
/typings
|
||||
|
||||
# System files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
27
arai-frontend/README.md
Normal file
27
arai-frontend/README.md
Normal file
@ -0,0 +1,27 @@
|
||||
# AraiFrontend
|
||||
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.0.3.
|
||||
|
||||
## Development server
|
||||
|
||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
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`.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||
|
||||
## Running end-to-end tests
|
||||
|
||||
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
|
||||
|
||||
## Further help
|
||||
|
||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
||||
106
arai-frontend/angular.json
Normal file
106
arai-frontend/angular.json
Normal file
@ -0,0 +1,106 @@
|
||||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"arai-frontend": {
|
||||
"projectType": "application",
|
||||
"schematics": {
|
||||
"@schematics/angular:component": {
|
||||
"style": "scss"
|
||||
}
|
||||
},
|
||||
"root": "",
|
||||
"sourceRoot": "src",
|
||||
"prefix": "app",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:application",
|
||||
"options": {
|
||||
"outputPath": "dist/arai-frontend",
|
||||
"index": "src/index.html",
|
||||
"browser": "src/main.ts",
|
||||
"polyfills": [
|
||||
"zone.js"
|
||||
],
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
],
|
||||
"styles": [
|
||||
"@angular/material/prebuilt-themes/indigo-pink.css"
|
||||
],
|
||||
"scripts": [],
|
||||
"server": "src/main.server.ts",
|
||||
"prerender": false,
|
||||
"ssr": false
|
||||
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "initial",
|
||||
"maximumWarning": "500kb",
|
||||
"maximumError": "1mb"
|
||||
},
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "2kb",
|
||||
"maximumError": "4kb"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all"
|
||||
},
|
||||
"development": {
|
||||
"optimization": false,
|
||||
"extractLicenses": false,
|
||||
"sourceMap": true
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"configurations": {
|
||||
"production": {
|
||||
"buildTarget": "arai-frontend:build:production"
|
||||
},
|
||||
"development": {
|
||||
"buildTarget": "arai-frontend:build:development"
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "development"
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||
"options": {
|
||||
"buildTarget": "arai-frontend:build"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"polyfills": [
|
||||
"zone.js",
|
||||
"zone.js/testing"
|
||||
],
|
||||
"tsConfig": "tsconfig.spec.json",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
],
|
||||
"styles": [
|
||||
"@angular/material/prebuilt-themes/indigo-pink.css",
|
||||
"src/styles.scss"
|
||||
],
|
||||
"scripts": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
54
arai-frontend/package.json
Normal file
54
arai-frontend/package.json
Normal file
@ -0,0 +1,54 @@
|
||||
{
|
||||
"name": "arai-frontend",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build": "ng build",
|
||||
"watch": "ng build --watch --configuration development",
|
||||
"test": "ng test",
|
||||
"serve:ssr:arai-frontend": "node dist/arai-frontend/server/server.mjs"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "^17.0.0",
|
||||
"@angular/cdk": "^17.2.2",
|
||||
"@angular/common": "^17.0.0",
|
||||
"@angular/compiler": "^17.0.0",
|
||||
"@angular/core": "^17.0.0",
|
||||
"@angular/flex-layout": "15.0.0-beta.42",
|
||||
"@angular/forms": "^17.0.0",
|
||||
"@angular/material": "^17.2.2",
|
||||
"@angular/platform-browser": "^17.0.0",
|
||||
"@angular/platform-browser-dynamic": "^17.0.0",
|
||||
"@angular/platform-server": "^17.0.0",
|
||||
"@angular/router": "^17.0.0",
|
||||
"@angular/ssr": "^17.0.3",
|
||||
"express": "^4.18.2",
|
||||
"faker": "^6.6.6",
|
||||
"json-server": "1.0.0-alpha.23",
|
||||
"rxjs": "~7.8.0",
|
||||
"socket.io-client": "^4.7.4",
|
||||
"tslib": "^2.3.0",
|
||||
"uuid": "^9.0.1",
|
||||
"zone.js": "~0.14.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "^17.0.3",
|
||||
"@angular/cli": "^17.0.3",
|
||||
"@angular/compiler-cli": "^17.0.0",
|
||||
"@faker-js/faker": "^8.4.1",
|
||||
"@types/express": "^4.17.17",
|
||||
"@types/faker": "^6.6.9",
|
||||
"@types/jasmine": "~5.1.0",
|
||||
"@types/node": "^18.18.0",
|
||||
"@types/uuid": "^9.0.8",
|
||||
"jasmine-core": "~5.1.0",
|
||||
"karma": "~6.4.0",
|
||||
"karma-chrome-launcher": "~3.2.0",
|
||||
"karma-coverage": "~2.2.0",
|
||||
"karma-jasmine": "~5.1.0",
|
||||
"karma-jasmine-html-reporter": "~2.1.0",
|
||||
"typescript": "~5.2.2"
|
||||
}
|
||||
}
|
||||
8262
arai-frontend/pnpm-lock.yaml
Normal file
8262
arai-frontend/pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load Diff
8
arai-frontend/proxy.conf.json
Normal file
8
arai-frontend/proxy.conf.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"/api": {
|
||||
"target": "http://localhost:5000",
|
||||
"secure": false,
|
||||
"changeOrigin": true
|
||||
}
|
||||
}
|
||||
|
||||
56
arai-frontend/server.ts
Normal file
56
arai-frontend/server.ts
Normal file
@ -0,0 +1,56 @@
|
||||
import { APP_BASE_HREF } from '@angular/common';
|
||||
import { CommonEngine } from '@angular/ssr';
|
||||
import express from 'express';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { dirname, join, resolve } from 'node:path';
|
||||
import bootstrap from './src/main.server';
|
||||
|
||||
// The Express app is exported so that it can be used by serverless Functions.
|
||||
export function app(): express.Express {
|
||||
const server = express();
|
||||
const serverDistFolder = dirname(fileURLToPath(import.meta.url));
|
||||
const browserDistFolder = resolve(serverDistFolder, '../browser');
|
||||
const indexHtml = join(serverDistFolder, 'index.server.html');
|
||||
|
||||
const commonEngine = new CommonEngine();
|
||||
|
||||
server.set('view engine', 'html');
|
||||
server.set('views', browserDistFolder);
|
||||
|
||||
// Example Express Rest API endpoints
|
||||
// server.get('/api/**', (req, res) => { });
|
||||
// Serve static files from /browser
|
||||
server.get('*.*', express.static(browserDistFolder, {
|
||||
maxAge: '1y'
|
||||
}));
|
||||
|
||||
// All regular routes use the Angular engine
|
||||
server.get('*', (req, res, next) => {
|
||||
const { protocol, originalUrl, baseUrl, headers } = req;
|
||||
|
||||
commonEngine
|
||||
.render({
|
||||
bootstrap,
|
||||
documentFilePath: indexHtml,
|
||||
url: `${protocol}://${headers.host}${originalUrl}`,
|
||||
publicPath: browserDistFolder,
|
||||
providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],
|
||||
})
|
||||
.then((html) => res.send(html))
|
||||
.catch((err) => next(err));
|
||||
});
|
||||
|
||||
return server;
|
||||
}
|
||||
|
||||
function run(): void {
|
||||
const port = process.env['PORT'] || 4000;
|
||||
|
||||
// Start up the Node server
|
||||
const server = app();
|
||||
server.listen(port, () => {
|
||||
console.log(`Node Express server listening on http://localhost:${port}`);
|
||||
});
|
||||
}
|
||||
|
||||
run();
|
||||
1
arai-frontend/src/app/app.component.html
Normal file
1
arai-frontend/src/app/app.component.html
Normal file
@ -0,0 +1 @@
|
||||
<router-outlet></router-outlet>
|
||||
0
arai-frontend/src/app/app.component.scss
Normal file
0
arai-frontend/src/app/app.component.scss
Normal file
29
arai-frontend/src/app/app.component.spec.ts
Normal file
29
arai-frontend/src/app/app.component.spec.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [AppComponent],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
it('should create the app', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should have the 'arai-frontend' title`, () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app.title).toEqual('arai-frontend');
|
||||
});
|
||||
|
||||
it('should render title', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.nativeElement as HTMLElement;
|
||||
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, arai-frontend');
|
||||
});
|
||||
});
|
||||
18
arai-frontend/src/app/app.component.ts
Normal file
18
arai-frontend/src/app/app.component.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { RouterModule, RouterOutlet } from '@angular/router';
|
||||
import { CaseInputComponent } from './case-input/case-input.component';
|
||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { BackendService } from './backend.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
standalone: true,
|
||||
imports: [RouterOutlet, CaseInputComponent, FlexLayoutModule, HttpClientModule, RouterModule],
|
||||
providers: [BackendService],
|
||||
templateUrl: './app.component.html',
|
||||
styleUrl: './app.component.scss'
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'arai-frontend';
|
||||
}
|
||||
11
arai-frontend/src/app/app.config.server.ts
Normal file
11
arai-frontend/src/app/app.config.server.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
|
||||
import { provideServerRendering } from '@angular/platform-server';
|
||||
import { appConfig } from './app.config';
|
||||
|
||||
const serverConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
provideServerRendering()
|
||||
]
|
||||
};
|
||||
|
||||
export const config = mergeApplicationConfig(appConfig, serverConfig);
|
||||
10
arai-frontend/src/app/app.config.ts
Normal file
10
arai-frontend/src/app/app.config.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { ApplicationConfig } from '@angular/core';
|
||||
import { provideRouter } from '@angular/router';
|
||||
|
||||
import { routes } from './app.routes';
|
||||
import { provideClientHydration } from '@angular/platform-browser';
|
||||
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [provideRouter(routes), provideClientHydration(), provideAnimationsAsync()]
|
||||
};
|
||||
22
arai-frontend/src/app/app.routes.ts
Normal file
22
arai-frontend/src/app/app.routes.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { Routes } from '@angular/router';
|
||||
import { CaseInputComponent } from './case-input/case-input.component';
|
||||
import { CostViewComponent } from './cost-view/cost-view.component';
|
||||
import { MediatorsListComponent } from './mediators-list/mediators-list.component';
|
||||
|
||||
export const routes: Routes = [
|
||||
{
|
||||
path: '', // Explicit root path configuration
|
||||
redirectTo: '/input', // Redirect to '/input' as a default route
|
||||
pathMatch: 'full' // Ensures full match of the path
|
||||
},
|
||||
{
|
||||
path: '', // Base path for children
|
||||
children: [
|
||||
{path: 'input', component: CaseInputComponent},
|
||||
{path: 'koszt', component: CostViewComponent},
|
||||
{path: 'mediatorzy', component: MediatorsListComponent},
|
||||
{path: '**', component: CaseInputComponent} // Wildcard route for unmatched paths
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
16
arai-frontend/src/app/backend.service.spec.ts
Normal file
16
arai-frontend/src/app/backend.service.spec.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { BackendService } from './backend.service';
|
||||
|
||||
describe('BackendService', () => {
|
||||
let service: BackendService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(BackendService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
71
arai-frontend/src/app/backend.service.ts
Normal file
71
arai-frontend/src/app/backend.service.ts
Normal file
@ -0,0 +1,71 @@
|
||||
import { EventEmitter, Injectable } from '@angular/core';
|
||||
import { GenericRequest, GenericResponse, RecommendedMediatorsResponse, ReturnResponse, StatisticsOutputResponse, UserInputRequest } from './requests-responses';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class BackendService {
|
||||
address = "http://localhost:5000";
|
||||
|
||||
public genericResponsesArray: GenericResponse[] = [];
|
||||
public userInputArray: UserInputRequest[] = [];
|
||||
public recommendedMediatorsResponsesArray: RecommendedMediatorsResponse[] = [];
|
||||
public recommendedMediatorsResponsesArrayEvent = new EventEmitter<RecommendedMediatorsResponse>();
|
||||
public statisticsOutputResponseArray: StatisticsOutputResponse[] = [];
|
||||
public statisticsOutputResponseArrayEvent = new EventEmitter<StatisticsOutputResponse>();
|
||||
|
||||
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
}
|
||||
|
||||
private filterMessages(message: GenericResponse) {
|
||||
this.genericResponsesArray.push(message);
|
||||
if(message.response_type === "recommended_mediators") {
|
||||
this.recommendedMediatorsResponsesArray.push(message as RecommendedMediatorsResponse);
|
||||
this.recommendedMediatorsResponsesArrayEvent.next(message as RecommendedMediatorsResponse);
|
||||
}
|
||||
if(message.response_type === "statistics_output") {
|
||||
this.statisticsOutputResponseArray.push(message as StatisticsOutputResponse);
|
||||
this.statisticsOutputResponseArrayEvent.next(message as StatisticsOutputResponse);
|
||||
}
|
||||
}
|
||||
|
||||
public sendMessage(message: GenericRequest): Promise<ReturnResponse> {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (message.request_type === "user_input") {
|
||||
this.userInputArray.push(message as UserInputRequest);
|
||||
}
|
||||
const headers = new HttpHeaders().set("Content-Type", "application/json");
|
||||
|
||||
console.log(`request: `, JSON.stringify(message));
|
||||
|
||||
this.http.post<ReturnResponse>(this.address, JSON.stringify(message), { headers }).subscribe({
|
||||
next: (response) => {
|
||||
console.log(`response: `, response);
|
||||
resolve(response);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error(`backendService, sendMessage, error: `, error);
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private serializeToQueryParams(message: GenericRequest): HttpParams {
|
||||
let params = new HttpParams();
|
||||
// Use a type assertion here to let TypeScript know the real type of the keys
|
||||
(Object.keys(message) as Array<keyof GenericRequest>).forEach(key => {
|
||||
const value = message[key];
|
||||
if (value !== undefined) {
|
||||
// Assuming all values are either string or can be converted to string
|
||||
params = params.append(key, String(value));
|
||||
}
|
||||
});
|
||||
return params;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
27
arai-frontend/src/app/case-input/case-input.component.html
Normal file
27
arai-frontend/src/app/case-input/case-input.component.html
Normal file
@ -0,0 +1,27 @@
|
||||
<div class="page-container">
|
||||
<form [formGroup]="userInputForm" (ngSubmit)="onSubmit()" class="lawyering-form">
|
||||
<h1 class="center"> Oblicz koszta i czas sporu </h1>
|
||||
|
||||
<mat-form-field appearance="outline" class="custom-form-field">
|
||||
<mat-label>Opis Sprawy</mat-label>
|
||||
<textarea matInput formControlName="generic_input" class="text-area-input"></textarea>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="custom-form-field">
|
||||
<mat-label>Wartość Przedmiotu Sporu</mat-label>
|
||||
<input matInput type="number" formControlName="trial_value" class="numeric-input">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="custom-form-field">
|
||||
<mat-label>Lokacja</mat-label>
|
||||
<input matInput formControlName="location" class="text-input">
|
||||
</mat-form-field>
|
||||
|
||||
<div class="checkbox-group">
|
||||
<mat-checkbox formControlName="experts_called" class="custom-checkbox">Powołani Biegli</mat-checkbox>
|
||||
<mat-checkbox formControlName="witnesses_called" class="custom-checkbox">Powołani Świadkowie</mat-checkbox>
|
||||
</div>
|
||||
|
||||
<button mat-raised-button color="primary" type="submit" (click)="onSubmit()" class="submit-button">Wyślij</button>
|
||||
</form>
|
||||
</div>
|
||||
72
arai-frontend/src/app/case-input/case-input.component.scss
Normal file
72
arai-frontend/src/app/case-input/case-input.component.scss
Normal file
@ -0,0 +1,72 @@
|
||||
body, html {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.page-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.lawyering-form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px; // Same as fxLayoutGap
|
||||
width: 100%;
|
||||
max-width: 600px; // Adjust based on your design preferences
|
||||
padding: 20px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 8px;
|
||||
background-color: #f5f5f5;
|
||||
|
||||
.custom-form-field {
|
||||
width: 100%; // Ensures form fields take up full width of the form
|
||||
appearance: outline;
|
||||
|
||||
.text-area-input, .numeric-input, .text-input {
|
||||
width: 100%; // Ensures inputs take up full width of their form field
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox-group {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 10px; // For spacing between checkboxes
|
||||
}
|
||||
|
||||
.submit-button {
|
||||
align-self: flex-end; // Aligns the submit button to the end of the form
|
||||
background-color: #004d40;
|
||||
color: #ffffff;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.lawyering-form {
|
||||
max-width: 90%; /* Allows more margin on smaller devices */
|
||||
}
|
||||
|
||||
.submit-button {
|
||||
width: 100%; /* Makes the submit button full width on smaller screens */
|
||||
align-self: center; /* Center align if preferred */
|
||||
}
|
||||
|
||||
.checkbox-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px; // For spacing between checkboxes
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CaseInputComponent } from './case-input.component';
|
||||
|
||||
describe('CaseInputComponent', () => {
|
||||
let component: CaseInputComponent;
|
||||
let fixture: ComponentFixture<CaseInputComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [CaseInputComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(CaseInputComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
49
arai-frontend/src/app/case-input/case-input.component.ts
Normal file
49
arai-frontend/src/app/case-input/case-input.component.ts
Normal file
@ -0,0 +1,49 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatInputModule } from '@angular/material/input'
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox'
|
||||
import { MatButtonModule } from '@angular/material/button'
|
||||
import { BackendService } from '../backend.service';
|
||||
import { GenericRequest, ReturnResponse, UserInputRequest, userInput } from '../requests-responses';
|
||||
import { Router } from '@angular/router';
|
||||
import { KosztaService } from '../koszta.service';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-case-input',
|
||||
standalone: true,
|
||||
imports: [
|
||||
MatInputModule,
|
||||
MatCheckboxModule,
|
||||
ReactiveFormsModule,
|
||||
MatButtonModule
|
||||
],
|
||||
templateUrl: './case-input.component.html',
|
||||
styleUrl: './case-input.component.scss'
|
||||
})
|
||||
export class CaseInputComponent {
|
||||
userInputForm: FormGroup;
|
||||
userInput: userInput | null = null;
|
||||
|
||||
constructor(private fb: FormBuilder, private readonly backendService: BackendService, private readonly router: Router, private readonly kosztaService: KosztaService) {
|
||||
this.userInputForm = this.fb.group({
|
||||
generic_input: [''],
|
||||
trial_value: [],
|
||||
location: [''],
|
||||
experts_called: [false],
|
||||
witnesses_called: [false]
|
||||
});
|
||||
}
|
||||
|
||||
async onSubmit() {
|
||||
this.userInput = this.userInputForm.value;
|
||||
if(this.userInput !== null) {
|
||||
const result = await this.backendService.sendMessage(new UserInputRequest(this.userInput)) as ReturnResponse;
|
||||
this.kosztaService.czas = String(result.response_data.first.time_of_trial);
|
||||
this.kosztaService.koszta = String(result.response_data.first.cost_of_trial);
|
||||
this.router.navigate(['koszt']);
|
||||
} else {
|
||||
console.error(`caseInputComponent, onSubmit, userInput is null!`)
|
||||
}
|
||||
}
|
||||
}
|
||||
18
arai-frontend/src/app/cost-view/cost-view.component.html
Normal file
18
arai-frontend/src/app/cost-view/cost-view.component.html
Normal file
@ -0,0 +1,18 @@
|
||||
<div class="main">
|
||||
<div class="legal-costs">
|
||||
Przewidywalne <u> minimalne </u> koszta:
|
||||
@if(costData !== null) {
|
||||
<div class="cost-details">
|
||||
Koszta: <span class="cost">{{costData.cost_of_trial}}</span> zł <br>
|
||||
Czas: <span class="time">{{costData.time_of_trial }}</span> miesięcy
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
<h1 class="bait"> Chcesz znacznie zredukować koszta? </h1>
|
||||
<div class="center-button">
|
||||
<button mat-raised-button color="primary" class="find-mediator" type="submit" (click)="onSubmit()" class="submit-button">Znajdź Mediatora</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
51
arai-frontend/src/app/cost-view/cost-view.component.scss
Normal file
51
arai-frontend/src/app/cost-view/cost-view.component.scss
Normal file
@ -0,0 +1,51 @@
|
||||
.legal-costs {
|
||||
font-family: 'Times New Roman', serif;
|
||||
color: #2a2a2a;
|
||||
background-color: #f5f5f5;
|
||||
padding: 20px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
font-size: 16px;
|
||||
width: 300px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.main {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.legal-costs .cost-details {
|
||||
margin-top: 10px;
|
||||
padding: 10px;
|
||||
background-color: #fff;
|
||||
border-left: 5px solid #004085;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.legal-costs .cost-details span {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.legal-costs .cost-details .cost {
|
||||
color: #007bff;
|
||||
}
|
||||
|
||||
.legal-costs .cost-details .time {
|
||||
color: #28a745;
|
||||
}
|
||||
|
||||
.bait {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.find-mediator {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.center-button {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
23
arai-frontend/src/app/cost-view/cost-view.component.spec.ts
Normal file
23
arai-frontend/src/app/cost-view/cost-view.component.spec.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CostViewComponent } from './cost-view.component';
|
||||
|
||||
describe('CostViewComponent', () => {
|
||||
let component: CostViewComponent;
|
||||
let fixture: ComponentFixture<CostViewComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [CostViewComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(CostViewComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
59
arai-frontend/src/app/cost-view/cost-view.component.ts
Normal file
59
arai-frontend/src/app/cost-view/cost-view.component.ts
Normal file
@ -0,0 +1,59 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { StatisticsOutputInterface } from '../requests-responses';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { Router } from '@angular/router';
|
||||
import { KosztaService } from '../koszta.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-cost-view',
|
||||
standalone: true,
|
||||
imports: [DatePipe, MatButtonModule],
|
||||
templateUrl: './cost-view.component.html',
|
||||
styleUrl: './cost-view.component.scss'
|
||||
})
|
||||
export class CostViewComponent {
|
||||
@Input() costData: StatisticsOutputInterface | null = {
|
||||
cost_of_trial: 2137,
|
||||
time_of_trial: Date.UTC(0, 6, 0, 0, 0, 0, 0)
|
||||
};
|
||||
|
||||
constructor(private readonly router: Router, private readonly kosztaService: KosztaService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.costData = {
|
||||
cost_of_trial: Number(this.kosztaService.koszta),
|
||||
time_of_trial: Number(this.kosztaService.czas),
|
||||
}
|
||||
}
|
||||
|
||||
public calculateTimeDifference(utcDateNumber: number): string {
|
||||
const currentDate = new Date();
|
||||
const targetDate = new Date(utcDateNumber);
|
||||
const differenceInMilliseconds = targetDate.getTime() - currentDate.getTime();
|
||||
|
||||
// Convert milliseconds to days
|
||||
const differenceInDays = differenceInMilliseconds / (1000 * 60 * 60 * 24);
|
||||
|
||||
// Check if the difference is greater than or equal to 30 to approximate months
|
||||
if (differenceInDays >= 30) {
|
||||
const months = Math.floor(differenceInDays / 30);
|
||||
const years = Math.floor(differenceInDays/365);
|
||||
if(years > 0) {
|
||||
return `Twoja sprawa zajmie około ${years} lat`
|
||||
}
|
||||
if(months === 1) {
|
||||
return `Twoja sprawa zajmie około 1 miesiąc`;
|
||||
} else {
|
||||
return `Twoja sprawa zajmie około ${months} miesięcy`;
|
||||
}
|
||||
} else {
|
||||
return `Twoja sprawa zajmie około ${Math.ceil(differenceInDays)} dni`;
|
||||
}
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.router.navigate(["mediatorzy"]);
|
||||
}
|
||||
|
||||
}
|
||||
20
arai-frontend/src/app/email-input/email-input.component.html
Normal file
20
arai-frontend/src/app/email-input/email-input.component.html
Normal file
@ -0,0 +1,20 @@
|
||||
<h1 mat-dialog-title class="title">Wprowadź email drugiej strony</h1>
|
||||
<mat-dialog-content>
|
||||
<p class="title">Poinformujemy osobę o twojej chęci do podjęcia mediacji</p>
|
||||
<form class="example-form">
|
||||
<mat-form-field class="example-full-width">
|
||||
<mat-label>Email</mat-label>
|
||||
<input type="email" matInput
|
||||
placeholder="np. jankowalski@email.com">
|
||||
@if (emailFormControl.hasError('email') && !emailFormControl.hasError('required')) {
|
||||
<mat-error>Please enter a valid email address</mat-error>
|
||||
}
|
||||
@if (emailFormControl.hasError('required')) {
|
||||
<mat-error>Email is <strong>required</strong></mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
</form>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions>
|
||||
<button class="center" mat-raised-button [mat-dialog-close]="data" cdkFocusInitial>Wyslij</button>
|
||||
</mat-dialog-actions>
|
||||
@ -0,0 +1,7 @@
|
||||
.center {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.title {
|
||||
text-align: center;
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { EmailInputComponent } from './email-input.component';
|
||||
|
||||
describe('EmailInputComponent', () => {
|
||||
let component: EmailInputComponent;
|
||||
let fixture: ComponentFixture<EmailInputComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [EmailInputComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(EmailInputComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
25
arai-frontend/src/app/email-input/email-input.component.ts
Normal file
25
arai-frontend/src/app/email-input/email-input.component.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { FormControl, Validators } from '@angular/forms';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import {MAT_DIALOG_DATA, MatDialogModule, MatDialogRef} from '@angular/material/dialog'
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
|
||||
@Component({
|
||||
selector: 'app-email-input',
|
||||
standalone: true,
|
||||
imports: [MatDialogModule, MatInputModule, MatButtonModule],
|
||||
templateUrl: './email-input.component.html',
|
||||
styleUrl: './email-input.component.scss'
|
||||
})
|
||||
export class EmailInputComponent {
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<EmailInputComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) {}
|
||||
|
||||
emailFormControl = new FormControl('', [Validators.required, Validators.email]);
|
||||
|
||||
|
||||
onNoClick(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
}
|
||||
16
arai-frontend/src/app/koszta.service.spec.ts
Normal file
16
arai-frontend/src/app/koszta.service.spec.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { KosztaService } from './koszta.service';
|
||||
|
||||
describe('KosztaService', () => {
|
||||
let service: KosztaService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(KosztaService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
9
arai-frontend/src/app/koszta.service.ts
Normal file
9
arai-frontend/src/app/koszta.service.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class KosztaService {
|
||||
public koszta: string = "";
|
||||
public czas: string = "";
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
<div class="center">
|
||||
@for(mediator of mediatorzy; track mediator) {
|
||||
<mat-card class="example-card">
|
||||
<mat-card-header>
|
||||
<div mat-card-avatar class="example-header-image" [style.background-image]="'url(' + generatePersonInfo() + ')'"></div>
|
||||
<mat-card-title>{{ mediator.name }}</mat-card-title>
|
||||
<mat-card-subtitle>
|
||||
{{ mediator.specialization }}
|
||||
<div class="ratings-row">
|
||||
<div class="golden-star">
|
||||
{{ convertToStars(mediator.ai_rating) }}
|
||||
</div>
|
||||
Liczba opinii: {{ mediator.number_of_opinions }}
|
||||
</div>
|
||||
</mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<p>
|
||||
<mat-icon>location_on </mat-icon> {{ generateCity() }} {{ generateAddress() }} <br>
|
||||
<mat-icon> attach_money</mat-icon> Cena za godzinę: {{ generateCost() }} zł<br>
|
||||
@if(generateOnline()) { <p class="available"> Mediacja zdalna </p> }
|
||||
</p>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<button mat-raised-button (click)="umowSie()">UMÓW SIĘ</button>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
}
|
||||
</div>
|
||||
@ -0,0 +1,32 @@
|
||||
.example-card {
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
.example-header-image {
|
||||
background-size: cover;
|
||||
width: 40px; /* Example size, adjust as needed */
|
||||
height: 40px; /* Example size, adjust as needed */
|
||||
border-radius: 50%; /* Makes the image round */
|
||||
}
|
||||
|
||||
.golden-star {
|
||||
color: gold;
|
||||
}
|
||||
|
||||
.ratings-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.available {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.center {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MediatorsListComponent } from './mediators-list.component';
|
||||
|
||||
describe('MediatorsListComponent', () => {
|
||||
let component: MediatorsListComponent;
|
||||
let fixture: ComponentFixture<MediatorsListComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [MediatorsListComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(MediatorsListComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
102
arai-frontend/src/app/mediators-list/mediators-list.component.ts
Normal file
102
arai-frontend/src/app/mediators-list/mediators-list.component.ts
Normal file
@ -0,0 +1,102 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { MatTableModule } from '@angular/material/table'
|
||||
import { RecommendedMediatorsInterface } from '../requests-responses';
|
||||
import { MatCardModule } from '@angular/material/card'
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {MatIconModule } from '@angular/material/icon'
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { EmailInputComponent } from '../email-input/email-input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-mediators-list',
|
||||
standalone: true,
|
||||
imports: [MatTableModule, MatCardModule, MatButtonModule, MatIconModule],
|
||||
templateUrl: './mediators-list.component.html',
|
||||
styleUrl: './mediators-list.component.scss'
|
||||
})
|
||||
export class MediatorsListComponent {
|
||||
@Input() mediatorzy: RecommendedMediatorsInterface[] = [
|
||||
{
|
||||
"name": "Mateusz Szpyruk",
|
||||
"specialization": "Prawo podatkowe",
|
||||
"localization": "Katowice",
|
||||
"ai_rating": 99,
|
||||
"user_rating": 99,
|
||||
"number_of_opinions": 5
|
||||
},
|
||||
{
|
||||
"name": "Jan Kowalski",
|
||||
"specialization": "Prawo pracy",
|
||||
"localization": "Katowice",
|
||||
"ai_rating": 90,
|
||||
"user_rating": 99,
|
||||
"number_of_opinions": 5
|
||||
},
|
||||
{
|
||||
"name": "Jan Kowalski",
|
||||
"specialization": "Prawo pracy",
|
||||
"localization": "Katowice",
|
||||
"ai_rating": 76,
|
||||
"user_rating": 99,
|
||||
"number_of_opinions": 5
|
||||
}
|
||||
]
|
||||
|
||||
constructor(private readonly dialog: MatDialog) {}
|
||||
|
||||
generatePersonInfo() {
|
||||
const personInfo = {
|
||||
firstName: faker.name.firstName(),
|
||||
lastName: faker.name.lastName(),
|
||||
email: faker.internet.email(),
|
||||
avatar: faker.image.avatar() // Generating person image
|
||||
};
|
||||
console.log(`faker.image.avatar(): `, faker.image.avatar());
|
||||
const avatarUrl = personInfo.avatar;
|
||||
return avatarUrl;
|
||||
}
|
||||
|
||||
convertToStars(score: number): string {
|
||||
if (score < 0 || score > 100) {
|
||||
return 'Score must be between 0 and 100';
|
||||
}
|
||||
|
||||
// Calculate the number of full stars
|
||||
const fullStars = Math.floor(score / 20);
|
||||
// Determine if there should be a half star
|
||||
const halfStar = (score % 20) >= 10 ? 1 : 0;
|
||||
// Calculate the number of empty stars
|
||||
const emptyStars = 5 - fullStars - halfStar;
|
||||
|
||||
return '★'.repeat(fullStars) + '✩'.repeat(halfStar) + '☆'.repeat(emptyStars);
|
||||
}
|
||||
|
||||
generateCity() {
|
||||
return faker.location.city();
|
||||
}
|
||||
|
||||
generateAddress() {
|
||||
return faker.location.streetAddress();
|
||||
}
|
||||
|
||||
generateCost() {
|
||||
return faker.commerce.price();
|
||||
}
|
||||
|
||||
generateOnline() {
|
||||
return faker.datatype.boolean();
|
||||
}
|
||||
|
||||
umowSie() {
|
||||
const dialogRef = this.dialog.open(EmailInputComponent, {
|
||||
width: '250px',
|
||||
data: { /* Data passed to the modal */ }
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
console.log('The dialog was closed');
|
||||
// Optional: handle data returned from the modal
|
||||
});
|
||||
}
|
||||
}
|
||||
7
arai-frontend/src/app/requests-responses.spec.ts
Normal file
7
arai-frontend/src/app/requests-responses.spec.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { RequestsResponses } from './requests-responses';
|
||||
|
||||
describe('RequestsResponses', () => {
|
||||
it('should create an instance', () => {
|
||||
expect(new RequestsResponses()).toBeTruthy();
|
||||
});
|
||||
});
|
||||
92
arai-frontend/src/app/requests-responses.ts
Normal file
92
arai-frontend/src/app/requests-responses.ts
Normal file
@ -0,0 +1,92 @@
|
||||
export enum REQUESTS_TYPES {
|
||||
"user_input" = 0,
|
||||
"registering_mediator" = 1,
|
||||
}
|
||||
|
||||
export enum RESPONSE_TYPES {
|
||||
"statistics_output" = 0,
|
||||
"recommended_mediators" = 1
|
||||
}
|
||||
|
||||
export class GenericRequest {
|
||||
readonly "request_type": string;
|
||||
readonly "request_data": unknown;
|
||||
constructor(setType: string, setData: unknown) {
|
||||
this.request_type = setType;
|
||||
this.request_data = setData;
|
||||
}
|
||||
}
|
||||
|
||||
export interface userInput {
|
||||
"generic_input": string,
|
||||
"trial_cost": number,
|
||||
"location": string,
|
||||
"experts_called": boolean,
|
||||
"witnesses_called": boolean
|
||||
}
|
||||
|
||||
export class UserInputRequest extends GenericRequest {
|
||||
override "request_type" = "user_input";
|
||||
override "request_data": userInput
|
||||
|
||||
constructor(setRequest: userInput) {
|
||||
super("user_input", setRequest);
|
||||
this.request_data = setRequest;
|
||||
}
|
||||
}
|
||||
|
||||
export class GenericResponse {
|
||||
readonly "response_type": string;
|
||||
readonly "response_data": unknown;
|
||||
constructor(setType: string, setData: unknown) {
|
||||
this.response_type = setType;
|
||||
this.response_data = setData;
|
||||
}
|
||||
}
|
||||
|
||||
export interface RecommendedMediatorsInterface {
|
||||
"name": string,
|
||||
"specialization": string,
|
||||
"localization": string,
|
||||
"ai_rating": number,
|
||||
"user_rating": number,
|
||||
"number_of_opinions": number
|
||||
}
|
||||
|
||||
export class RecommendedMediatorsResponse extends GenericResponse {
|
||||
override "response_type" = "recommended_mediators";
|
||||
override "response_data": RecommendedMediatorsInterface;
|
||||
|
||||
constructor(setResponseData: RecommendedMediatorsInterface) {
|
||||
super("recommended_mediators", setResponseData);
|
||||
this.response_data = setResponseData;
|
||||
}
|
||||
}
|
||||
|
||||
interface response {
|
||||
first: {
|
||||
cost_of_trial: number,
|
||||
time_of_trial: number
|
||||
},
|
||||
second: RecommendedMediatorsInterface[];
|
||||
}
|
||||
|
||||
export class ReturnResponse {
|
||||
"response_type" = "recommended_mediators";
|
||||
"response_data": response
|
||||
}
|
||||
|
||||
export interface StatisticsOutputInterface {
|
||||
"cost_of_trial": number,
|
||||
"time_of_trial": number
|
||||
}
|
||||
|
||||
export class StatisticsOutputResponse extends GenericResponse {
|
||||
override "response_type" = "statistics_output";
|
||||
override "response_data": StatisticsOutputInterface;
|
||||
|
||||
constructor(setResponseData: StatisticsOutputInterface) {
|
||||
super("statistics_output", setResponseData);
|
||||
this.response_data = setResponseData;
|
||||
}
|
||||
}
|
||||
0
arai-frontend/src/assets/.gitkeep
Normal file
0
arai-frontend/src/assets/.gitkeep
Normal file
BIN
arai-frontend/src/favicon.ico
Normal file
BIN
arai-frontend/src/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
15
arai-frontend/src/index.html
Normal file
15
arai-frontend/src/index.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>AraiFrontend</title>
|
||||
<base href="/">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
</head>
|
||||
<body class="mat-typography">
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
||||
7
arai-frontend/src/main.server.ts
Normal file
7
arai-frontend/src/main.server.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { bootstrapApplication } from '@angular/platform-browser';
|
||||
import { AppComponent } from './app/app.component';
|
||||
import { config } from './app/app.config.server';
|
||||
|
||||
const bootstrap = () => bootstrapApplication(AppComponent, config);
|
||||
|
||||
export default bootstrap;
|
||||
6
arai-frontend/src/main.ts
Normal file
6
arai-frontend/src/main.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import { bootstrapApplication } from '@angular/platform-browser';
|
||||
import { appConfig } from './app/app.config';
|
||||
import { AppComponent } from './app/app.component';
|
||||
|
||||
bootstrapApplication(AppComponent, appConfig)
|
||||
.catch((err) => console.error(err));
|
||||
4
arai-frontend/src/styles.scss
Normal file
4
arai-frontend/src/styles.scss
Normal file
@ -0,0 +1,4 @@
|
||||
/* You can add global styles to this file, and also import other style files */
|
||||
|
||||
html, body { height: 100%; }
|
||||
body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
|
||||
18
arai-frontend/tsconfig.app.json
Normal file
18
arai-frontend/tsconfig.app.json
Normal file
@ -0,0 +1,18 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/app",
|
||||
"types": [
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"src/main.ts",
|
||||
"src/main.server.ts",
|
||||
"server.ts"
|
||||
],
|
||||
"include": [
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
||||
32
arai-frontend/tsconfig.json
Normal file
32
arai-frontend/tsconfig.json
Normal file
@ -0,0 +1,32 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist/out-tsc",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"noImplicitOverride": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"esModuleInterop": true,
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"experimentalDecorators": true,
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"target": "ES2022",
|
||||
"module": "ES2022",
|
||||
"useDefineForClassFields": false,
|
||||
"lib": [
|
||||
"ES2022",
|
||||
"dom"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableI18nLegacyMessageIdFormat": false,
|
||||
"strictInjectionParameters": true,
|
||||
"strictInputAccessModifiers": true,
|
||||
"strictTemplates": true
|
||||
}
|
||||
}
|
||||
14
arai-frontend/tsconfig.spec.json
Normal file
14
arai-frontend/tsconfig.spec.json
Normal file
@ -0,0 +1,14 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/spec",
|
||||
"types": [
|
||||
"jasmine"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
||||
16
simple-ws/package.json
Normal file
16
simple-ws/package.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "simple-ws",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "ws.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "node server.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"ws": "^8.16.0"
|
||||
}
|
||||
}
|
||||
25
simple-ws/pnpm-lock.yaml
Normal file
25
simple-ws/pnpm-lock.yaml
Normal file
@ -0,0 +1,25 @@
|
||||
lockfileVersion: '6.0'
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
dependencies:
|
||||
ws:
|
||||
specifier: ^8.16.0
|
||||
version: 8.16.0
|
||||
|
||||
packages:
|
||||
|
||||
/ws@8.16.0:
|
||||
resolution: {integrity: sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
peerDependencies:
|
||||
bufferutil: ^4.0.1
|
||||
utf-8-validate: '>=5.0.2'
|
||||
peerDependenciesMeta:
|
||||
bufferutil:
|
||||
optional: true
|
||||
utf-8-validate:
|
||||
optional: true
|
||||
dev: false
|
||||
24
simple-ws/ws.js
Normal file
24
simple-ws/ws.js
Normal file
@ -0,0 +1,24 @@
|
||||
const WebSocket = require('ws');
|
||||
const WebSocketServer = WebSocket.WebSocketServer;
|
||||
|
||||
// Initialize a WebSocket Server on port 8080
|
||||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
console.log('A new client connected');
|
||||
|
||||
// Send a message to the client
|
||||
ws.send('Welcome to the WebSocket server!');
|
||||
|
||||
// Listen for messages from the client
|
||||
ws.on('message', function message(data) {
|
||||
console.log(`Received message from client: ${data}`);
|
||||
});
|
||||
|
||||
// Handle client disconnection
|
||||
ws.on('close', () => {
|
||||
console.log('A client disconnected');
|
||||
});
|
||||
});
|
||||
|
||||
console.log('WebSocket server is running on ws://localhost:8080');
|
||||
627
statystyki/.gitignore
vendored
Normal file
627
statystyki/.gitignore
vendored
Normal file
@ -0,0 +1,627 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
#poetry.lock
|
||||
|
||||
# pdm
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||
#pdm.lock
|
||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||
# in version control.
|
||||
# https://pdm.fming.dev/#use-with-ide
|
||||
.pdm.toml
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
env/
|
||||
ENV/
|
||||
env.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
.DS_STORE
|
||||
|
||||
/dist/
|
||||
/bazel-out
|
||||
/integration/bazel/bazel-*
|
||||
*.log
|
||||
/node_modules/
|
||||
|
||||
# CircleCI temporary file for cache key computation.
|
||||
# See `save_month_to_file` in `.circleci/config.yml`.
|
||||
month.txt
|
||||
|
||||
# Include when developing application packages.
|
||||
pubspec.lock
|
||||
.c9
|
||||
.idea/
|
||||
.devcontainer/*
|
||||
!.devcontainer/README.md
|
||||
!.devcontainer/recommended-devcontainer.json
|
||||
!.devcontainer/recommended-Dockerfile
|
||||
.settings/
|
||||
.vscode/launch.json
|
||||
.vscode/settings.json
|
||||
.vscode/tasks.json
|
||||
*.swo
|
||||
*.swp
|
||||
modules/.settings
|
||||
modules/.vscode
|
||||
.vimrc
|
||||
.nvimrc
|
||||
|
||||
# Don't check in secret files
|
||||
*secret.js
|
||||
|
||||
# Ignore npm/yarn debug log
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
|
||||
# build-analytics
|
||||
.build-analytics
|
||||
|
||||
# rollup-test output
|
||||
/modules/rollup-test/dist/
|
||||
|
||||
# User specific bazel settings
|
||||
.bazelrc.user
|
||||
|
||||
# User specific ng-dev settings
|
||||
.ng-dev.user*
|
||||
|
||||
.notes.md
|
||||
baseline.json
|
||||
|
||||
# Ignore .history for the xyz.local-history VSCode extension
|
||||
.history
|
||||
|
||||
# Husky
|
||||
.husky/_
|
||||
aio/content/examples/.DS_Store
|
||||
|
||||
|
||||
# Ignore cache created with the Angular CLI.
|
||||
.angular/
|
||||
|
||||
node_modules/
|
||||
.node_modules/
|
||||
built/*
|
||||
tests/cases/rwc/*
|
||||
tests/cases/perf/*
|
||||
!tests/cases/webharness/compilerToString.js
|
||||
test-args.txt
|
||||
~*.docx
|
||||
\#*\#
|
||||
.\#*
|
||||
tests/baselines/local/*
|
||||
tests/baselines/local.old/*
|
||||
tests/services/baselines/local/*
|
||||
tests/baselines/prototyping/local/*
|
||||
tests/baselines/rwc/*
|
||||
tests/baselines/reference/projectOutput/*
|
||||
tests/baselines/local/projectOutput/*
|
||||
tests/baselines/reference/testresults.tap
|
||||
tests/services/baselines/prototyping/local/*
|
||||
tests/services/browser/typescriptServices.js
|
||||
src/harness/*.js
|
||||
src/compiler/diagnosticInformationMap.generated.ts
|
||||
src/compiler/diagnosticMessages.generated.json
|
||||
src/parser/diagnosticInformationMap.generated.ts
|
||||
src/parser/diagnosticMessages.generated.json
|
||||
rwc-report.html
|
||||
*.swp
|
||||
build.json
|
||||
*.actual
|
||||
tests/webTestServer.js
|
||||
tests/webTestServer.js.map
|
||||
tests/webhost/*.d.ts
|
||||
tests/webhost/webtsc.js
|
||||
tests/cases/**/*.js
|
||||
tests/cases/**/*.js.map
|
||||
*.config
|
||||
scripts/eslint/built/
|
||||
scripts/debug.bat
|
||||
scripts/run.bat
|
||||
scripts/**/*.js
|
||||
scripts/**/*.js.map
|
||||
coverage/
|
||||
internal/
|
||||
**/.DS_Store
|
||||
.settings
|
||||
**/.vs
|
||||
**/.vscode/*
|
||||
!**/.vscode/tasks.json
|
||||
!**/.vscode/settings.template.json
|
||||
!**/.vscode/launch.template.json
|
||||
!**/.vscode/extensions.json
|
||||
!tests/cases/projects/projectOption/**/node_modules
|
||||
!tests/cases/projects/NodeModulesSearch/**/*
|
||||
!tests/baselines/reference/project/nodeModules*/**/*
|
||||
.idea
|
||||
yarn.lock
|
||||
yarn-error.log
|
||||
.parallelperf.*
|
||||
tests/baselines/reference/dt
|
||||
.failed-tests
|
||||
TEST-results.xml
|
||||
package-lock.json
|
||||
.eslintcache
|
||||
*v8.log
|
||||
/lib/
|
||||
|
||||
# Editor temporary/working/backup files #
|
||||
#########################################
|
||||
.#*
|
||||
[#]*#
|
||||
*~
|
||||
*$
|
||||
*.bak
|
||||
.idea/
|
||||
*.kdev4
|
||||
*.org
|
||||
.project
|
||||
.pydevproject
|
||||
*.rej
|
||||
.settings/
|
||||
.spyproject/
|
||||
.*.sw[nop]
|
||||
.sw[nop]
|
||||
*.tmp
|
||||
*.vim
|
||||
tags
|
||||
.theia/
|
||||
.vscode/
|
||||
|
||||
# Compiled source #
|
||||
###################
|
||||
*.a
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.l[ao]
|
||||
*.o
|
||||
*.o.d
|
||||
*.py[ocd]
|
||||
*.so
|
||||
_configtest.c
|
||||
|
||||
# Packages #
|
||||
############
|
||||
# it's better to unpack these files and commit the raw source
|
||||
# git has its own built in compression methods
|
||||
*.7z
|
||||
*.bz2
|
||||
*.bzip2
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.tbz2
|
||||
*.tgz
|
||||
*.zip
|
||||
|
||||
# Python files #
|
||||
################
|
||||
# build directory
|
||||
build
|
||||
# sphinx build directory
|
||||
doc/_build
|
||||
# cython files
|
||||
cythonize.dat
|
||||
# sdist directory
|
||||
dist
|
||||
# Egg metadata
|
||||
*.egg-info
|
||||
# tox testing tool
|
||||
.tox
|
||||
# The shelf plugin uses this dir
|
||||
./.shelf
|
||||
MANIFEST
|
||||
# distutils configuration
|
||||
site.cfg
|
||||
setup.cfg
|
||||
# other temporary files
|
||||
.coverage
|
||||
.deps
|
||||
.libs
|
||||
.eggs
|
||||
pip-wheel-metadata
|
||||
|
||||
# Meson #
|
||||
#########
|
||||
.mesonpy-native-file.ini
|
||||
installdir/
|
||||
build-install/
|
||||
.mesonpy/
|
||||
|
||||
# doit
|
||||
######
|
||||
.doit.db.dat
|
||||
.doit.db.dir
|
||||
.doit.db.db
|
||||
.doit.db
|
||||
|
||||
# Logs and databases #
|
||||
######################
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
|
||||
# pytest cache #
|
||||
################
|
||||
.cache/
|
||||
.pytest_cache/
|
||||
|
||||
# mypy cache #
|
||||
##############
|
||||
.mypy_cache/
|
||||
|
||||
# linter #
|
||||
##########
|
||||
.ruff_cache/
|
||||
.pre-commit-workdir/
|
||||
|
||||
# Patches #
|
||||
###########
|
||||
*.patch
|
||||
*.diff
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
.directory
|
||||
.fseventsd
|
||||
.DS_Store*
|
||||
.gdb_history
|
||||
.VolumeIcon.icns
|
||||
ehthumbs.db
|
||||
Icon?
|
||||
Thumbs.db
|
||||
*.dSYM
|
||||
|
||||
# Documentation generated files #
|
||||
#################################
|
||||
doc/frontpage/build
|
||||
doc/source/reference/generated
|
||||
**/.ipynb_checkpoints
|
||||
|
||||
# Things specific to this project #
|
||||
###################################
|
||||
benchmarks/env
|
||||
benchmarks/results
|
||||
benchmarks/scipy
|
||||
benchmarks/html
|
||||
benchmarks/scipy-benchmarks
|
||||
.openblas
|
||||
scipy/_distributor_init_local.py
|
||||
scipy/__config__.py
|
||||
scipy/_lib/_ccallback_c.c
|
||||
scipy/_lib/messagestream.c
|
||||
scipy/_lib/src/messagestream_config.h
|
||||
scipy/_lib/_test_deprecation_call.c
|
||||
scipy/_lib/_test_deprecation_def.c
|
||||
scipy/_lib/_test_deprecation_def.h
|
||||
scipy/cluster/_vq.c
|
||||
scipy/cluster/_hierarchy.c
|
||||
scipy/cluster/_optimal_leaf_ordering.c
|
||||
scipy/fftpack/_fftpackmodule.c
|
||||
scipy/fftpack/convolvemodule.c
|
||||
scipy/fftpack/convolve.c
|
||||
scipy/fftpack/src/dct.c
|
||||
scipy/fftpack/src/dst.c
|
||||
scipy/integrate/_dopmodule.c
|
||||
scipy/integrate/_lsodamodule.c
|
||||
scipy/integrate/_vodemodule.c
|
||||
scipy/integrate/_dop-f2pywrappers.f
|
||||
scipy/integrate/_lsoda-f2pywrappers.f
|
||||
scipy/integrate/_vode-f2pywrappers.f
|
||||
scipy/interpolate/_rbfinterp_pythran.cpp
|
||||
scipy/interpolate/_ppoly.c
|
||||
scipy/interpolate/_rgi_cython.c
|
||||
scipy/interpolate/_bspl.c
|
||||
scipy/interpolate/interpnd.c
|
||||
scipy/interpolate/src/dfitpack-f2pywrappers.f
|
||||
scipy/interpolate/src/dfitpackmodule.c
|
||||
scipy/io/_test_fortranmodule.c
|
||||
scipy/io/matlab/_mio5_utils.c
|
||||
scipy/io/matlab/_mio_utils.c
|
||||
scipy/io/matlab/_streams.c
|
||||
scipy/lib/blas/cblas.pyf
|
||||
scipy/lib/blas/cblasmodule.c
|
||||
scipy/lib/blas/fblas-f2pywrappers.f
|
||||
scipy/lib/blas/fblas.pyf
|
||||
scipy/lib/blas/fblasmodule.c
|
||||
scipy/lib/blas/fblaswrap.f
|
||||
scipy/lib/lapack/clapack.pyf
|
||||
scipy/lib/lapack/clapackmodule.c
|
||||
scipy/lib/lapack/flapack.pyf
|
||||
scipy/lib/lapack/flapackmodule.c
|
||||
scipy/linalg/_cblasmodule.c
|
||||
scipy/linalg/_clapackmodule.c
|
||||
scipy/linalg/_fblas-f2pywrappers.f
|
||||
scipy/linalg/_fblasmodule.c
|
||||
scipy/linalg/_flapack-f2pywrappers.f
|
||||
scipy/linalg/_flapackmodule.c
|
||||
scipy/linalg/_interpolativemodule.c
|
||||
scipy/linalg/_solve_toeplitz.c
|
||||
scipy/linalg/_decomp_update.c
|
||||
scipy/linalg/_decomp_update.pyx
|
||||
scipy/linalg/_cythonized_array_utils.c
|
||||
scipy/linalg/_blas_subroutine_wrappers.f
|
||||
scipy/linalg/_blas_subroutines.h
|
||||
scipy/linalg/_lapack_subroutine_wrappers.f
|
||||
scipy/linalg/_lapack_subroutines.h
|
||||
scipy/linalg/cblas.pyf
|
||||
scipy/linalg/clapack.pyf
|
||||
scipy/linalg/cython_blas.c
|
||||
scipy/linalg/cython_lapack.c
|
||||
scipy/linalg/fblas.pyf
|
||||
scipy/linalg/flapack.pyf
|
||||
scipy/linalg/cython_blas.pxd
|
||||
scipy/linalg/cython_blas.pyx
|
||||
scipy/linalg/cython_lapack.pxd
|
||||
scipy/linalg/cython_lapack.pyx
|
||||
scipy/linalg/src/id_dist/src/*_subr_*.f
|
||||
scipy/linalg/_matfuncs_sqrtm_triu.c
|
||||
scipy/linalg/_matfuncs_sqrtm_triu.cpp
|
||||
scipy/linalg/_matfuncs_expm.c
|
||||
scipy/linalg/_matfuncs_expm.pyx
|
||||
scipy/ndimage/src/_ni_label.c
|
||||
scipy/ndimage/src/_cytest.c
|
||||
scipy/optimize/_bglu_dense.c
|
||||
scipy/optimize/cobyla/_cobylamodule.c
|
||||
scipy/optimize/_group_columns.cpp
|
||||
scipy/optimize/lbfgsb_src/_lbfgsbmodule.c
|
||||
scipy/optimize/lbfgsb_src/_lbfgsb-f2pywrappers.f
|
||||
scipy/optimize/minpack2/_minpack2module.c
|
||||
scipy/optimize/__nnls/__nnlsmodule.c
|
||||
scipy/optimize/slsqp/_slsqpmodule.c
|
||||
scipy/optimize/_lsq/givens_elimination.c
|
||||
scipy/optimize/_trlib/_trlib.c
|
||||
scipy/optimize/tnc/moduleTNC.c
|
||||
scipy/optimize/tnc/_moduleTNC.c
|
||||
scipy/signal/_peak_finding_utils.c
|
||||
scipy/signal/_spectral.c
|
||||
scipy/signal/_spectral.cpp
|
||||
scipy/signal/_max_len_seq_inner.c
|
||||
scipy/signal/_max_len_seq_inner.cpp
|
||||
scipy/signal/_sosfilt.c
|
||||
scipy/signal/_upfirdn_apply.c
|
||||
scipy/signal/_correlate_nd.c
|
||||
scipy/signal/_lfilter.c
|
||||
scipy/signal/_bspline_util.c
|
||||
scipy/sparse/_csparsetools.c
|
||||
scipy/sparse/_csparsetools.pyx
|
||||
scipy/sparse/csgraph/_min_spanning_tree.c
|
||||
scipy/sparse/csgraph/_shortest_path.c
|
||||
scipy/sparse/csgraph/_tools.c
|
||||
scipy/sparse/csgraph/_traversal.c
|
||||
scipy/sparse/csgraph/_flow.c
|
||||
scipy/sparse/csgraph/_matching.c
|
||||
scipy/sparse/csgraph/_reordering.c
|
||||
scipy/sparse/linalg/dsolve/umfpack/_umfpack.py
|
||||
scipy/sparse/linalg/dsolve/umfpack/_umfpack_wrap.c
|
||||
scipy/sparse/linalg/_eigen/arpack/_arpack-f2pywrappers.f
|
||||
scipy/sparse/linalg/_eigen/arpack/_arpackmodule.c
|
||||
scipy/sparse/linalg/_eigen/arpack/arpack.pyf
|
||||
scipy/sparse/linalg/_isolve/iterative/BiCGREVCOM.f
|
||||
scipy/sparse/linalg/_isolve/iterative/BiCGSTABREVCOM.f
|
||||
scipy/sparse/linalg/_isolve/iterative/CGREVCOM.f
|
||||
scipy/sparse/linalg/_isolve/iterative/CGSREVCOM.f
|
||||
scipy/sparse/linalg/_isolve/iterative/GMRESREVCOM.f
|
||||
scipy/sparse/linalg/_isolve/iterative/QMRREVCOM.f
|
||||
scipy/sparse/linalg/_isolve/iterative/STOPTEST2.f
|
||||
scipy/sparse/linalg/_isolve/iterative/_iterative.pyf
|
||||
scipy/sparse/linalg/_isolve/iterative/_iterativemodule.c
|
||||
scipy/sparse/linalg/_isolve/iterative/getbreak.f
|
||||
scipy/sparse/sparsetools/bsr_impl.h
|
||||
scipy/sparse/sparsetools/csc_impl.h
|
||||
scipy/sparse/sparsetools/csr_impl.h
|
||||
scipy/sparse/sparsetools/other_impl.h
|
||||
scipy/sparse/sparsetools/sparsetools_impl.h
|
||||
scipy/spatial/_ckdtree.cxx
|
||||
scipy/spatial/ckdtree.h
|
||||
scipy/spatial/_hausdorff.c
|
||||
scipy/spatial/_qhull.c
|
||||
scipy/spatial/_voronoi.c
|
||||
scipy/spatial/transform/_rotation.c
|
||||
scipy/special/_comb.c
|
||||
scipy/special/_ellip_harm_2.c
|
||||
scipy/special/_ellip_harm_2.h
|
||||
scipy/special/_logit.c
|
||||
scipy/special/_test_internal.c
|
||||
scipy/special/_ufuncs.c
|
||||
scipy/special/_ufuncs.h
|
||||
scipy/special/_ufuncs.pyx
|
||||
scipy/special/_ufuncs_cxx.cxx
|
||||
scipy/special/_ufuncs_cxx.h
|
||||
scipy/special/_ufuncs_cxx.pxd
|
||||
scipy/special/_ufuncs_cxx.pyx
|
||||
scipy/special/_ufuncs_cxx_defs.h
|
||||
scipy/special/_ufuncs_defs.h
|
||||
scipy/special/_ufuncs.pyi
|
||||
scipy/special/cython_special.c
|
||||
scipy/special/cython_special.h
|
||||
scipy/special/cython_special.pxd
|
||||
scipy/special/cython_special.pyx
|
||||
scipy/special/_specfunmodule.c
|
||||
scipy/special/tests/data/*.npz
|
||||
scipy/special/ellint_carlson_cpp_lite/Makefile
|
||||
scipy/special/ellint_carlson_cpp_lite/cellint.*
|
||||
scipy/special/ellint_carlson_cpp_lite/tests
|
||||
scipy/stats/_rank.c
|
||||
scipy/stats/_mvn-f2pywrappers.f
|
||||
scipy/stats/_mvnmodule.c
|
||||
scipy/stats/_statlibmodule.c
|
||||
scipy/stats/vonmises_cython.c
|
||||
scipy/stats/_stats.c
|
||||
scipy/stats/_levy_stable/levyst.c
|
||||
scipy/stats/_biasedurn.cxx
|
||||
scipy/stats/_biasedurn.pyx
|
||||
scipy/stats/biasedurn.cxx
|
||||
scipy/stats/_sobol.c
|
||||
scipy/stats/_qmc_cy.cxx
|
||||
scipy/stats/_hypotests_pythran.cpp
|
||||
scipy/stats/_unuran/unuran_wrapper.c
|
||||
scipy/stats/_rcont/rcont.c
|
||||
scipy/stats/_stats_pythran.cpp
|
||||
scipy/version.py
|
||||
scipy/special/_exprel.c
|
||||
scipy/optimize/_group_columns.c
|
||||
scipy/optimize/cython_optimize/_zeros.c
|
||||
scipy/optimize/cython_optimize/_zeros.pyx
|
||||
scipy/optimize/lbfgsb/_lbfgsbmodule.c
|
||||
scipy/optimize/_highs/cython/src/_highs_wrapper.cxx
|
||||
scipy/optimize/_highs/cython/src/_highs_constants.cxx
|
||||
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
!.vscode/*.code-snippets
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Built Visual Studio Code Extensions
|
||||
*.vsix
|
||||
1
statystyki/README.md
Normal file
1
statystyki/README.md
Normal file
@ -0,0 +1 @@
|
||||
# ARAI
|
||||
BIN
statystyki/dane.xlsx
Normal file
BIN
statystyki/dane.xlsx
Normal file
Binary file not shown.
95
statystyki/load_data.py
Normal file
95
statystyki/load_data.py
Normal file
@ -0,0 +1,95 @@
|
||||
import pandas as pd
|
||||
import argparse
|
||||
import warnings
|
||||
|
||||
warnings.filterwarnings('ignore')
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-t', '--typ')
|
||||
parser.add_argument('-k','--kwota')
|
||||
parser.add_argument('-b', '--biegly')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
TYP = args.typ
|
||||
KWOTA = int(args.kwota)
|
||||
BIEGLY = str(args.biegly)
|
||||
|
||||
def calc_stats(typ=TYP,KWOTA=KWOTA,BIEGLY = BIEGLY):
|
||||
mapka = {'1':'cywilnej','2':'górniczej','3':'gospodarczej','4':'prawa pracy & ubezpieczeń'}
|
||||
koszt_bieglego= 1789.42
|
||||
koszt = 0
|
||||
if KWOTA < 100000 and typ != '4':
|
||||
df = pd.read_excel('..\statystyki\dane.xlsx',sheet_name='rejon')
|
||||
mask = df['RODZAJ'] == int(typ)
|
||||
liczba_miesiecy = df[mask]['mean']
|
||||
procent = (1 - df[mask]['procent do 12 miesięcy']) * 100
|
||||
koszt_sadu = 0
|
||||
koszt_adwokata = 0
|
||||
if KWOTA <= 500:
|
||||
koszt_sadu = 30
|
||||
koszt_adwokata = 90
|
||||
elif KWOTA > 500 and KWOTA <= 1500:
|
||||
koszt_sadu = 100
|
||||
koszt_adwokata = 270
|
||||
elif KWOTA > 1500 and KWOTA <= 4000:
|
||||
koszt_sadu = 200
|
||||
elif KWOTA > 4000 and KWOTA <= 7500:
|
||||
koszt_sadu = 400
|
||||
elif KWOTA > 7500 and KWOTA <= 10000:
|
||||
koszt_sadu = 500
|
||||
elif KWOTA > 10000 and KWOTA <= 15000:
|
||||
koszt_sadu = 750
|
||||
elif KWOTA > 15000 and KWOTA <= 20000:
|
||||
koszt_sadu = 1000
|
||||
elif KWOTA > 20000:
|
||||
koszt_sadu = KWOTA * 0.05
|
||||
if koszt_sadu > 20000:
|
||||
koszt_sadu = 20000
|
||||
|
||||
if KWOTA > 1500 and KWOTA <= 5000:
|
||||
koszt_adwokata = 900
|
||||
elif KWOTA > 5000 and KWOTA <= 10000:
|
||||
koszt_adwokata = 1800
|
||||
elif KWOTA > 10000 and KWOTA <= 50000:
|
||||
koszt_adwokata = 3600
|
||||
elif KWOTA > 50000 and KWOTA <= 100000:
|
||||
koszt_adwokata = 5400
|
||||
|
||||
|
||||
if BIEGLY == 'True':
|
||||
koszt = koszt_sadu + koszt_adwokata + koszt_bieglego
|
||||
else:
|
||||
koszt = koszt_sadu + koszt_adwokata
|
||||
print(f"Średni czas trwania rozprawy typu {mapka[typ]} wynosi {round(liczba_miesiecy,0).to_string(index=False)} miesięcy, a {procent.to_string(index=False)}% spraw trwa dłuzej niz rok, jej minimalny koszt wyniesie {koszt}")
|
||||
|
||||
elif KWOTA > 100000:
|
||||
df = pd.read_excel('..\statystyki\dane.xlsx',sheet_name='okreg')
|
||||
mask = df['RODZAJ'] == int(typ)
|
||||
liczba_miesiecy = df[mask]['mean']
|
||||
procent = (1 - df[mask]['procent do 12 miesięcy']) * 100
|
||||
|
||||
if KWOTA <= 200000:
|
||||
koszt_adwokata = 5400
|
||||
elif KWOTA > 200000 and KWOTA <= 2000000:
|
||||
koszt_adwokata = 10800
|
||||
elif KWOTA > 2000000 and KWOTA <= 5000000:
|
||||
koszt_adwokata = 15000
|
||||
elif KWOTA > 500000:
|
||||
koszt_adwokata = 25000
|
||||
|
||||
koszt_sadu = KWOTA * 0.05
|
||||
if koszt_sadu > 20000:
|
||||
koszt_sadu = 20000
|
||||
|
||||
if BIEGLY == 'True':
|
||||
koszt = koszt_sadu + koszt_adwokata + koszt_bieglego
|
||||
else:
|
||||
koszt = koszt_sadu + koszt_adwokata
|
||||
|
||||
return_string = f"Średni czas trwania rozprawy typu {mapka[TYP]} wynosi {round(liczba_miesiecy,0).to_string(index=False)} miesięcy, a {procent.to_string(index=False)}% spraw trwa krócej niz rok, a jej minimalny koszt wynosi {koszt}"
|
||||
print(return_string)
|
||||
|
||||
return return_string
|
||||
|
||||
calc_stats()
|
||||
241
statystyki/venv/bin/Activate.ps1
Normal file
241
statystyki/venv/bin/Activate.ps1
Normal file
@ -0,0 +1,241 @@
|
||||
<#
|
||||
.Synopsis
|
||||
Activate a Python virtual environment for the current PowerShell session.
|
||||
|
||||
.Description
|
||||
Pushes the python executable for a virtual environment to the front of the
|
||||
$Env:PATH environment variable and sets the prompt to signify that you are
|
||||
in a Python virtual environment. Makes use of the command line switches as
|
||||
well as the `pyvenv.cfg` file values present in the virtual environment.
|
||||
|
||||
.Parameter VenvDir
|
||||
Path to the directory that contains the virtual environment to activate. The
|
||||
default value for this is the parent of the directory that the Activate.ps1
|
||||
script is located within.
|
||||
|
||||
.Parameter Prompt
|
||||
The prompt prefix to display when this virtual environment is activated. By
|
||||
default, this prompt is the name of the virtual environment folder (VenvDir)
|
||||
surrounded by parentheses and followed by a single space (ie. '(.venv) ').
|
||||
|
||||
.Example
|
||||
Activate.ps1
|
||||
Activates the Python virtual environment that contains the Activate.ps1 script.
|
||||
|
||||
.Example
|
||||
Activate.ps1 -Verbose
|
||||
Activates the Python virtual environment that contains the Activate.ps1 script,
|
||||
and shows extra information about the activation as it executes.
|
||||
|
||||
.Example
|
||||
Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv
|
||||
Activates the Python virtual environment located in the specified location.
|
||||
|
||||
.Example
|
||||
Activate.ps1 -Prompt "MyPython"
|
||||
Activates the Python virtual environment that contains the Activate.ps1 script,
|
||||
and prefixes the current prompt with the specified string (surrounded in
|
||||
parentheses) while the virtual environment is active.
|
||||
|
||||
.Notes
|
||||
On Windows, it may be required to enable this Activate.ps1 script by setting the
|
||||
execution policy for the user. You can do this by issuing the following PowerShell
|
||||
command:
|
||||
|
||||
PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||
|
||||
For more information on Execution Policies:
|
||||
https://go.microsoft.com/fwlink/?LinkID=135170
|
||||
|
||||
#>
|
||||
Param(
|
||||
[Parameter(Mandatory = $false)]
|
||||
[String]
|
||||
$VenvDir,
|
||||
[Parameter(Mandatory = $false)]
|
||||
[String]
|
||||
$Prompt
|
||||
)
|
||||
|
||||
<# Function declarations --------------------------------------------------- #>
|
||||
|
||||
<#
|
||||
.Synopsis
|
||||
Remove all shell session elements added by the Activate script, including the
|
||||
addition of the virtual environment's Python executable from the beginning of
|
||||
the PATH variable.
|
||||
|
||||
.Parameter NonDestructive
|
||||
If present, do not remove this function from the global namespace for the
|
||||
session.
|
||||
|
||||
#>
|
||||
function global:deactivate ([switch]$NonDestructive) {
|
||||
# Revert to original values
|
||||
|
||||
# The prior prompt:
|
||||
if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) {
|
||||
Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt
|
||||
Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT
|
||||
}
|
||||
|
||||
# The prior PYTHONHOME:
|
||||
if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) {
|
||||
Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME
|
||||
Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME
|
||||
}
|
||||
|
||||
# The prior PATH:
|
||||
if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) {
|
||||
Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH
|
||||
Remove-Item -Path Env:_OLD_VIRTUAL_PATH
|
||||
}
|
||||
|
||||
# Just remove the VIRTUAL_ENV altogether:
|
||||
if (Test-Path -Path Env:VIRTUAL_ENV) {
|
||||
Remove-Item -Path env:VIRTUAL_ENV
|
||||
}
|
||||
|
||||
# Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
|
||||
if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
|
||||
Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
|
||||
}
|
||||
|
||||
# Leave deactivate function in the global namespace if requested:
|
||||
if (-not $NonDestructive) {
|
||||
Remove-Item -Path function:deactivate
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.Description
|
||||
Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the
|
||||
given folder, and returns them in a map.
|
||||
|
||||
For each line in the pyvenv.cfg file, if that line can be parsed into exactly
|
||||
two strings separated by `=` (with any amount of whitespace surrounding the =)
|
||||
then it is considered a `key = value` line. The left hand string is the key,
|
||||
the right hand is the value.
|
||||
|
||||
If the value starts with a `'` or a `"` then the first and last character is
|
||||
stripped from the value before being captured.
|
||||
|
||||
.Parameter ConfigDir
|
||||
Path to the directory that contains the `pyvenv.cfg` file.
|
||||
#>
|
||||
function Get-PyVenvConfig(
|
||||
[String]
|
||||
$ConfigDir
|
||||
) {
|
||||
Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
|
||||
|
||||
# Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue).
|
||||
$pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
|
||||
|
||||
# An empty map will be returned if no config file is found.
|
||||
$pyvenvConfig = @{ }
|
||||
|
||||
if ($pyvenvConfigPath) {
|
||||
|
||||
Write-Verbose "File exists, parse `key = value` lines"
|
||||
$pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
|
||||
|
||||
$pyvenvConfigContent | ForEach-Object {
|
||||
$keyval = $PSItem -split "\s*=\s*", 2
|
||||
if ($keyval[0] -and $keyval[1]) {
|
||||
$val = $keyval[1]
|
||||
|
||||
# Remove extraneous quotations around a string value.
|
||||
if ("'""".Contains($val.Substring(0, 1))) {
|
||||
$val = $val.Substring(1, $val.Length - 2)
|
||||
}
|
||||
|
||||
$pyvenvConfig[$keyval[0]] = $val
|
||||
Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
|
||||
}
|
||||
}
|
||||
}
|
||||
return $pyvenvConfig
|
||||
}
|
||||
|
||||
|
||||
<# Begin Activate script --------------------------------------------------- #>
|
||||
|
||||
# Determine the containing directory of this script
|
||||
$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
||||
$VenvExecDir = Get-Item -Path $VenvExecPath
|
||||
|
||||
Write-Verbose "Activation script is located in path: '$VenvExecPath'"
|
||||
Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
|
||||
Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
|
||||
|
||||
# Set values required in priority: CmdLine, ConfigFile, Default
|
||||
# First, get the location of the virtual environment, it might not be
|
||||
# VenvExecDir if specified on the command line.
|
||||
if ($VenvDir) {
|
||||
Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
|
||||
}
|
||||
else {
|
||||
Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."
|
||||
$VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
|
||||
Write-Verbose "VenvDir=$VenvDir"
|
||||
}
|
||||
|
||||
# Next, read the `pyvenv.cfg` file to determine any required value such
|
||||
# as `prompt`.
|
||||
$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
|
||||
|
||||
# Next, set the prompt from the command line, or the config file, or
|
||||
# just use the name of the virtual environment folder.
|
||||
if ($Prompt) {
|
||||
Write-Verbose "Prompt specified as argument, using '$Prompt'"
|
||||
}
|
||||
else {
|
||||
Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"
|
||||
if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
|
||||
Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
|
||||
$Prompt = $pyvenvCfg['prompt'];
|
||||
}
|
||||
else {
|
||||
Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)"
|
||||
Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
|
||||
$Prompt = Split-Path -Path $venvDir -Leaf
|
||||
}
|
||||
}
|
||||
|
||||
Write-Verbose "Prompt = '$Prompt'"
|
||||
Write-Verbose "VenvDir='$VenvDir'"
|
||||
|
||||
# Deactivate any currently active virtual environment, but leave the
|
||||
# deactivate function in place.
|
||||
deactivate -nondestructive
|
||||
|
||||
# Now set the environment variable VIRTUAL_ENV, used by many tools to determine
|
||||
# that there is an activated venv.
|
||||
$env:VIRTUAL_ENV = $VenvDir
|
||||
|
||||
if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) {
|
||||
|
||||
Write-Verbose "Setting prompt to '$Prompt'"
|
||||
|
||||
# Set the prompt to include the env name
|
||||
# Make sure _OLD_VIRTUAL_PROMPT is global
|
||||
function global:_OLD_VIRTUAL_PROMPT { "" }
|
||||
Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT
|
||||
New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
|
||||
|
||||
function global:prompt {
|
||||
Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
|
||||
_OLD_VIRTUAL_PROMPT
|
||||
}
|
||||
}
|
||||
|
||||
# Clear PYTHONHOME
|
||||
if (Test-Path -Path Env:PYTHONHOME) {
|
||||
Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME
|
||||
Remove-Item -Path Env:PYTHONHOME
|
||||
}
|
||||
|
||||
# Add the venv to the PATH
|
||||
Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
|
||||
$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH"
|
||||
66
statystyki/venv/bin/activate
Normal file
66
statystyki/venv/bin/activate
Normal file
@ -0,0 +1,66 @@
|
||||
# This file must be used with "source bin/activate" *from bash*
|
||||
# you cannot run it directly
|
||||
|
||||
deactivate () {
|
||||
# reset old environment variables
|
||||
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
|
||||
PATH="${_OLD_VIRTUAL_PATH:-}"
|
||||
export PATH
|
||||
unset _OLD_VIRTUAL_PATH
|
||||
fi
|
||||
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
|
||||
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
|
||||
export PYTHONHOME
|
||||
unset _OLD_VIRTUAL_PYTHONHOME
|
||||
fi
|
||||
|
||||
# This should detect bash and zsh, which have a hash command that must
|
||||
# be called to get it to forget past commands. Without forgetting
|
||||
# past commands the $PATH changes we made may not be respected
|
||||
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
|
||||
hash -r 2> /dev/null
|
||||
fi
|
||||
|
||||
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
|
||||
PS1="${_OLD_VIRTUAL_PS1:-}"
|
||||
export PS1
|
||||
unset _OLD_VIRTUAL_PS1
|
||||
fi
|
||||
|
||||
unset VIRTUAL_ENV
|
||||
if [ ! "${1:-}" = "nondestructive" ] ; then
|
||||
# Self destruct!
|
||||
unset -f deactivate
|
||||
fi
|
||||
}
|
||||
|
||||
# unset irrelevant variables
|
||||
deactivate nondestructive
|
||||
|
||||
VIRTUAL_ENV="/Users/jakubjarzembowski/Desktop/hackathon/ARAI/venv"
|
||||
export VIRTUAL_ENV
|
||||
|
||||
_OLD_VIRTUAL_PATH="$PATH"
|
||||
PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||
export PATH
|
||||
|
||||
# unset PYTHONHOME if set
|
||||
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
|
||||
# could use `if (set -u; : $PYTHONHOME) ;` in bash
|
||||
if [ -n "${PYTHONHOME:-}" ] ; then
|
||||
_OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
|
||||
unset PYTHONHOME
|
||||
fi
|
||||
|
||||
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
|
||||
_OLD_VIRTUAL_PS1="${PS1:-}"
|
||||
PS1="(venv) ${PS1:-}"
|
||||
export PS1
|
||||
fi
|
||||
|
||||
# This should detect bash and zsh, which have a hash command that must
|
||||
# be called to get it to forget past commands. Without forgetting
|
||||
# past commands the $PATH changes we made may not be respected
|
||||
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
|
||||
hash -r 2> /dev/null
|
||||
fi
|
||||
25
statystyki/venv/bin/activate.csh
Normal file
25
statystyki/venv/bin/activate.csh
Normal file
@ -0,0 +1,25 @@
|
||||
# This file must be used with "source bin/activate.csh" *from csh*.
|
||||
# You cannot run it directly.
|
||||
# Created by Davide Di Blasi <davidedb@gmail.com>.
|
||||
# Ported to Python 3.3 venv by Andrew Svetlov <andrew.svetlov@gmail.com>
|
||||
|
||||
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate'
|
||||
|
||||
# Unset irrelevant variables.
|
||||
deactivate nondestructive
|
||||
|
||||
setenv VIRTUAL_ENV "/Users/jakubjarzembowski/Desktop/hackathon/ARAI/venv"
|
||||
|
||||
set _OLD_VIRTUAL_PATH="$PATH"
|
||||
setenv PATH "$VIRTUAL_ENV/bin:$PATH"
|
||||
|
||||
|
||||
set _OLD_VIRTUAL_PROMPT="$prompt"
|
||||
|
||||
if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then
|
||||
set prompt = "(venv) $prompt"
|
||||
endif
|
||||
|
||||
alias pydoc python -m pydoc
|
||||
|
||||
rehash
|
||||
64
statystyki/venv/bin/activate.fish
Normal file
64
statystyki/venv/bin/activate.fish
Normal file
@ -0,0 +1,64 @@
|
||||
# This file must be used with "source <venv>/bin/activate.fish" *from fish*
|
||||
# (https://fishshell.com/); you cannot run it directly.
|
||||
|
||||
function deactivate -d "Exit virtual environment and return to normal shell environment"
|
||||
# reset old environment variables
|
||||
if test -n "$_OLD_VIRTUAL_PATH"
|
||||
set -gx PATH $_OLD_VIRTUAL_PATH
|
||||
set -e _OLD_VIRTUAL_PATH
|
||||
end
|
||||
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
|
||||
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME
|
||||
end
|
||||
|
||||
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
|
||||
functions -e fish_prompt
|
||||
set -e _OLD_FISH_PROMPT_OVERRIDE
|
||||
functions -c _old_fish_prompt fish_prompt
|
||||
functions -e _old_fish_prompt
|
||||
end
|
||||
|
||||
set -e VIRTUAL_ENV
|
||||
if test "$argv[1]" != "nondestructive"
|
||||
# Self-destruct!
|
||||
functions -e deactivate
|
||||
end
|
||||
end
|
||||
|
||||
# Unset irrelevant variables.
|
||||
deactivate nondestructive
|
||||
|
||||
set -gx VIRTUAL_ENV "/Users/jakubjarzembowski/Desktop/hackathon/ARAI/venv"
|
||||
|
||||
set -gx _OLD_VIRTUAL_PATH $PATH
|
||||
set -gx PATH "$VIRTUAL_ENV/bin" $PATH
|
||||
|
||||
# Unset PYTHONHOME if set.
|
||||
if set -q PYTHONHOME
|
||||
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
|
||||
set -e PYTHONHOME
|
||||
end
|
||||
|
||||
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
|
||||
# fish uses a function instead of an env var to generate the prompt.
|
||||
|
||||
# Save the current fish_prompt function as the function _old_fish_prompt.
|
||||
functions -c fish_prompt _old_fish_prompt
|
||||
|
||||
# With the original prompt function renamed, we can override with our own.
|
||||
function fish_prompt
|
||||
# Save the return status of the last command.
|
||||
set -l old_status $status
|
||||
|
||||
# Output the venv prompt; color taken from the blue of the Python logo.
|
||||
printf "%s%s%s" (set_color 4B8BBE) "(venv) " (set_color normal)
|
||||
|
||||
# Restore the return status of the previous command.
|
||||
echo "exit $old_status" | .
|
||||
# Output the original/"old" prompt.
|
||||
_old_fish_prompt
|
||||
end
|
||||
|
||||
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
|
||||
end
|
||||
8
statystyki/venv/bin/f2py
Executable file
8
statystyki/venv/bin/f2py
Executable file
@ -0,0 +1,8 @@
|
||||
#!/Users/jakubjarzembowski/Desktop/hackathon/ARAI/venv/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from numpy.f2py.f2py2e import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
statystyki/venv/bin/normalizer
Executable file
8
statystyki/venv/bin/normalizer
Executable file
@ -0,0 +1,8 @@
|
||||
#!/Users/jakubjarzembowski/Desktop/hackathon/ARAI/venv/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from charset_normalizer.cli import cli_detect
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(cli_detect())
|
||||
8
statystyki/venv/bin/pip
Executable file
8
statystyki/venv/bin/pip
Executable file
@ -0,0 +1,8 @@
|
||||
#!/Users/jakubjarzembowski/Desktop/hackathon/ARAI/venv/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pip._internal.cli.main import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
statystyki/venv/bin/pip3
Executable file
8
statystyki/venv/bin/pip3
Executable file
@ -0,0 +1,8 @@
|
||||
#!/Users/jakubjarzembowski/Desktop/hackathon/ARAI/venv/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pip._internal.cli.main import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
statystyki/venv/bin/pip3.9
Executable file
8
statystyki/venv/bin/pip3.9
Executable file
@ -0,0 +1,8 @@
|
||||
#!/Users/jakubjarzembowski/Desktop/hackathon/ARAI/venv/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pip._internal.cli.main import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
1
statystyki/venv/bin/python
Symbolic link
1
statystyki/venv/bin/python
Symbolic link
@ -0,0 +1 @@
|
||||
/Users/jakubjarzembowski/opt/anaconda3/bin/python
|
||||
1
statystyki/venv/bin/python3
Symbolic link
1
statystyki/venv/bin/python3
Symbolic link
@ -0,0 +1 @@
|
||||
python
|
||||
1
statystyki/venv/bin/python3.9
Symbolic link
1
statystyki/venv/bin/python3.9
Symbolic link
@ -0,0 +1 @@
|
||||
python
|
||||
3
statystyki/venv/pyvenv.cfg
Normal file
3
statystyki/venv/pyvenv.cfg
Normal file
@ -0,0 +1,3 @@
|
||||
home = /Users/jakubjarzembowski/opt/anaconda3/bin
|
||||
include-system-site-packages = false
|
||||
version = 3.9.13
|
||||
Loading…
Reference in New Issue
Block a user