diff --git a/Backend_correct/app.py b/Backend_correct/app.py index 246ffcf..4e4b68b 100644 --- a/Backend_correct/app.py +++ b/Backend_correct/app.py @@ -1,5 +1,9 @@ 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) @@ -11,13 +15,15 @@ def recommended_mediators(): data = request.get_json() input = data.get('request_data', {}) - # print(input.get("location")) + + {liczba_miesiecy, koszt} = calc_stats("2", 25000, True) + print(result) top_5 = { "response_type": "recommended_mediators", "response_data": [{ - "cost_of_trial": 5000, - "time_of_trial": 70 + "cost_of_trial": koszt, + "time_of_trial": liczba_miesiecy }, [{ "name": "Mateusz Szpyruk", "specialization": "Prawo podatkowe", @@ -42,8 +48,85 @@ def recommended_mediators(): }]] } - 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}") + + elif kwota > 100000: + df = pd.read_excel(danePath,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 {liczba_miesiecy, koszt} if __name__ == '__main__': app.run(debug=True) \ No newline at end of file diff --git a/Backend_correct/dane.xlsx b/Backend_correct/dane.xlsx new file mode 100644 index 0000000..709d9f7 Binary files /dev/null and b/Backend_correct/dane.xlsx differ diff --git a/statystyki/.gitignore b/statystyki/.gitignore new file mode 100644 index 0000000..68c5efd --- /dev/null +++ b/statystyki/.gitignore @@ -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 diff --git a/statystyki/README.md b/statystyki/README.md new file mode 100644 index 0000000..6da873e --- /dev/null +++ b/statystyki/README.md @@ -0,0 +1 @@ +# ARAI diff --git a/statystyki/dane.xlsx b/statystyki/dane.xlsx new file mode 100644 index 0000000..709d9f7 Binary files /dev/null and b/statystyki/dane.xlsx differ diff --git a/statystyki/load_data.py b/statystyki/load_data.py new file mode 100644 index 0000000..3225d26 --- /dev/null +++ b/statystyki/load_data.py @@ -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() \ No newline at end of file diff --git a/statystyki/venv/bin/Activate.ps1 b/statystyki/venv/bin/Activate.ps1 new file mode 100644 index 0000000..9d3646a --- /dev/null +++ b/statystyki/venv/bin/Activate.ps1 @@ -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" diff --git a/statystyki/venv/bin/activate b/statystyki/venv/bin/activate new file mode 100644 index 0000000..3792034 --- /dev/null +++ b/statystyki/venv/bin/activate @@ -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 diff --git a/statystyki/venv/bin/activate.csh b/statystyki/venv/bin/activate.csh new file mode 100644 index 0000000..1c9d251 --- /dev/null +++ b/statystyki/venv/bin/activate.csh @@ -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 . +# Ported to Python 3.3 venv by Andrew Svetlov + +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 diff --git a/statystyki/venv/bin/activate.fish b/statystyki/venv/bin/activate.fish new file mode 100644 index 0000000..8ab7a8b --- /dev/null +++ b/statystyki/venv/bin/activate.fish @@ -0,0 +1,64 @@ +# This file must be used with "source /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 diff --git a/statystyki/venv/bin/f2py b/statystyki/venv/bin/f2py new file mode 100755 index 0000000..8d95283 --- /dev/null +++ b/statystyki/venv/bin/f2py @@ -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()) diff --git a/statystyki/venv/bin/normalizer b/statystyki/venv/bin/normalizer new file mode 100755 index 0000000..1578333 --- /dev/null +++ b/statystyki/venv/bin/normalizer @@ -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()) diff --git a/statystyki/venv/bin/pip b/statystyki/venv/bin/pip new file mode 100755 index 0000000..424b04a --- /dev/null +++ b/statystyki/venv/bin/pip @@ -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()) diff --git a/statystyki/venv/bin/pip3 b/statystyki/venv/bin/pip3 new file mode 100755 index 0000000..424b04a --- /dev/null +++ b/statystyki/venv/bin/pip3 @@ -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()) diff --git a/statystyki/venv/bin/pip3.9 b/statystyki/venv/bin/pip3.9 new file mode 100755 index 0000000..424b04a --- /dev/null +++ b/statystyki/venv/bin/pip3.9 @@ -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()) diff --git a/statystyki/venv/bin/python b/statystyki/venv/bin/python new file mode 120000 index 0000000..9745953 --- /dev/null +++ b/statystyki/venv/bin/python @@ -0,0 +1 @@ +/Users/jakubjarzembowski/opt/anaconda3/bin/python \ No newline at end of file diff --git a/statystyki/venv/bin/python3 b/statystyki/venv/bin/python3 new file mode 120000 index 0000000..d8654aa --- /dev/null +++ b/statystyki/venv/bin/python3 @@ -0,0 +1 @@ +python \ No newline at end of file diff --git a/statystyki/venv/bin/python3.9 b/statystyki/venv/bin/python3.9 new file mode 120000 index 0000000..d8654aa --- /dev/null +++ b/statystyki/venv/bin/python3.9 @@ -0,0 +1 @@ +python \ No newline at end of file diff --git a/statystyki/venv/pyvenv.cfg b/statystyki/venv/pyvenv.cfg new file mode 100644 index 0000000..4c8d6f8 --- /dev/null +++ b/statystyki/venv/pyvenv.cfg @@ -0,0 +1,3 @@ +home = /Users/jakubjarzembowski/opt/anaconda3/bin +include-system-site-packages = false +version = 3.9.13