initial commit

master
michael 2022-11-23 17:22:15 +08:00
commit d4d248ee17
35 changed files with 4845 additions and 0 deletions

164
backend/.gitignore vendored Normal file
View File

@ -0,0 +1,164 @@
.vscode/
.env
*.swp
# 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
.venv
env/
venv/
ENV/
env.bak/
venv.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/

21
backend/Pipfile Normal file
View File

@ -0,0 +1,21 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
fastapi = "*"
numpy = "*"
opencv-python = "*"
plotly = "==5.11.0"
numba = "*"
python-dotenv = "*"
antlr4-python3-runtime = "==4.7.2"
latex2sympy2 = "==1.8.3"
sympy = "==1.11.1"
hypercorn = "*"
[dev-packages]
[requires]
python_version = "3.10"

351
backend/Pipfile.lock generated Normal file
View File

@ -0,0 +1,351 @@
{
"_meta": {
"hash": {
"sha256": "a4ce66a507bc85d87321c713e8160fb94fde0828e5a214fec2a0d6bb12c86a09"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.10"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"antlr4-python3-runtime": {
"hashes": [
"sha256:168cdcec8fb9152e84a87ca6fd261b3d54c8f6358f42ab3b813b14a7193bb50b"
],
"index": "pypi",
"version": "==4.7.2"
},
"anyio": {
"hashes": [
"sha256:25ea0d673ae30af41a0c442f81cf3b38c7e79fdc7b60335a4c14e05eb0947421",
"sha256:fbbe32bd270d2a2ef3ed1c5d45041250284e31fc0a4df4a5a6071842051a51e3"
],
"markers": "python_full_version >= '3.6.2'",
"version": "==3.6.2"
},
"fastapi": {
"hashes": [
"sha256:07032e53df9a57165047b4f38731c38bdcc3be5493220471015e2b4b51b486a4",
"sha256:254453a2e22f64e2a1b4e1d8baf67d239e55b6c8165c079d25746a5220c81bb4"
],
"index": "pypi",
"version": "==0.87.0"
},
"h11": {
"hashes": [
"sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d",
"sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"
],
"markers": "python_version >= '3.7'",
"version": "==0.14.0"
},
"h2": {
"hashes": [
"sha256:03a46bcf682256c95b5fd9e9a99c1323584c3eec6440d379b9903d709476bc6d",
"sha256:a83aca08fbe7aacb79fec788c9c0bac936343560ed9ec18b82a13a12c28d2abb"
],
"markers": "python_full_version >= '3.6.1'",
"version": "==4.1.0"
},
"hpack": {
"hashes": [
"sha256:84a076fad3dc9a9f8063ccb8041ef100867b1878b25ef0ee63847a5d53818a6c",
"sha256:fc41de0c63e687ebffde81187a948221294896f6bdc0ae2312708df339430095"
],
"markers": "python_full_version >= '3.6.1'",
"version": "==4.0.0"
},
"hypercorn": {
"hashes": [
"sha256:4a87a0b7bbe9dc75fab06dbe4b301b9b90416e9866c23a377df21a969d6ab8dd",
"sha256:7c491d5184f28ee960dcdc14ab45d14633ca79d72ddd13cf4fcb4cb854d679ab"
],
"index": "pypi",
"version": "==0.14.3"
},
"hyperframe": {
"hashes": [
"sha256:0ec6bafd80d8ad2195c4f03aacba3a8265e57bc4cff261e802bf39970ed02a15",
"sha256:ae510046231dc8e9ecb1a6586f63d2347bf4c8905914aa84ba585ae85f28a914"
],
"markers": "python_full_version >= '3.6.1'",
"version": "==6.0.1"
},
"idna": {
"hashes": [
"sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4",
"sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"
],
"markers": "python_version >= '3.5'",
"version": "==3.4"
},
"latex2sympy2": {
"hashes": [
"sha256:fdcdaa0e1e1a4719d090de092b4df9f4139a695b0f65fac637768df1b08a5b1c"
],
"index": "pypi",
"version": "==1.8.3"
},
"llvmlite": {
"hashes": [
"sha256:03aee0ccd81735696474dc4f8b6be60774892a2929d6c05d093d17392c237f32",
"sha256:1578f5000fdce513712e99543c50e93758a954297575610f48cb1fd71b27c08a",
"sha256:16f56eb1eec3cda3a5c526bc3f63594fc24e0c8d219375afeb336f289764c6c7",
"sha256:1ec3d70b3e507515936e475d9811305f52d049281eaa6c8273448a61c9b5b7e2",
"sha256:22d36591cd5d02038912321d9ab8e4668e53ae2211da5523f454e992b5e13c36",
"sha256:3803f11ad5f6f6c3d2b545a303d68d9fabb1d50e06a8d6418e6fcd2d0df00959",
"sha256:39dc2160aed36e989610fc403487f11b8764b6650017ff367e45384dff88ffbf",
"sha256:3fc14e757bc07a919221f0cbaacb512704ce5774d7fcada793f1996d6bc75f2a",
"sha256:4c6ebace910410daf0bebda09c1859504fc2f33d122e9a971c4c349c89cca630",
"sha256:50aea09a2b933dab7c9df92361b1844ad3145bfb8dd2deb9cd8b8917d59306fb",
"sha256:60f8dd1e76f47b3dbdee4b38d9189f3e020d22a173c00f930b52131001d801f9",
"sha256:62c0ea22e0b9dffb020601bb65cb11dd967a095a488be73f07d8867f4e327ca5",
"sha256:6546bed4e02a1c3d53a22a0bced254b3b6894693318b16c16c8e43e29d6befb6",
"sha256:6717c7a6e93c9d2c3d07c07113ec80ae24af45cde536b34363d4bcd9188091d9",
"sha256:7ebf1eb9badc2a397d4f6a6c8717447c81ac011db00064a00408bc83c923c0e4",
"sha256:9ffc84ade195abd4abcf0bd3b827b9140ae9ef90999429b9ea84d5df69c9058c",
"sha256:a3f331a323d0f0ada6b10d60182ef06c20a2f01be21699999d204c5750ffd0b4",
"sha256:b1a0bbdb274fb683f993198775b957d29a6f07b45d184c571ef2a721ce4388cf",
"sha256:b43abd7c82e805261c425d50335be9a6c4f84264e34d6d6e475207300005d572",
"sha256:c0f158e4708dda6367d21cf15afc58de4ebce979c7a1aa2f6b977aae737e2a54",
"sha256:d0bfd18c324549c0fec2c5dc610fd024689de6f27c6cc67e4e24a07541d6e49b",
"sha256:ddab526c5a2c4ccb8c9ec4821fcea7606933dc53f510e2a6eebb45a418d3488a",
"sha256:e172c73fccf7d6db4bd6f7de963dedded900d1a5c6778733241d878ba613980e",
"sha256:e2c00ff204afa721b0bb9835b5bf1ba7fba210eefcec5552a9e05a63219ba0dc",
"sha256:e31f4b799d530255aaf0566e3da2df5bfc35d3cd9d6d5a3dcc251663656c27b1",
"sha256:e4f212c018db951da3e1dc25c2651abc688221934739721f2dad5ff1dd5f90e7",
"sha256:fa9b26939ae553bf30a9f5c4c754db0fb2d2677327f2511e674aa2f5df941789",
"sha256:fb62fc7016b592435d3e3a8f680e3ea8897c3c9e62e6e6cc58011e7a4801439e"
],
"markers": "python_version >= '3.7'",
"version": "==0.39.1"
},
"mpmath": {
"hashes": [
"sha256:604bc21bd22d2322a177c73bdb573994ef76e62edd595d17e00aff24b0667e5c",
"sha256:79ffb45cf9f4b101a807595bcb3e72e0396202e0b1d25d689134b48c4216a81a"
],
"version": "==1.2.1"
},
"numba": {
"hashes": [
"sha256:0240f9026b015e336069329839208ebd70ec34ae5bfbf402e4fcc8e06197528e",
"sha256:03634579d10a6129181129de293dd6b5eaabee86881369d24d63f8fe352dd6cb",
"sha256:03fe94cd31e96185cce2fae005334a8cc712fc2ba7756e52dff8c9400718173f",
"sha256:0611e6d3eebe4cb903f1a836ffdb2bda8d18482bcd0a0dcc56e79e2aa3fefef5",
"sha256:0da583c532cd72feefd8e551435747e0e0fbb3c0530357e6845fcc11e38d6aea",
"sha256:14dbbabf6ffcd96ee2ac827389afa59a70ffa9f089576500434c34abf9b054a4",
"sha256:32d9fef412c81483d7efe0ceb6cf4d3310fde8b624a9cecca00f790573ac96ee",
"sha256:3a993349b90569518739009d8f4b523dfedd7e0049e6838c0e17435c3e70dcc4",
"sha256:3cb1a07a082a61df80a468f232e452d818f5ae254b40c26390054e4e868556e0",
"sha256:42f9e1be942b215df7e6cc9948cf9c15bb8170acc8286c063a9e57994ef82fd1",
"sha256:4373da9757049db7c90591e9ec55a2e97b2b36ba7ae3bf9c956a513374077470",
"sha256:4e08e203b163ace08bad500b0c16f6092b1eb34fd1fce4feaf31a67a3a5ecf3b",
"sha256:553da2ce74e8862e18a72a209ed3b6d2924403bdd0fb341fa891c6455545ba7c",
"sha256:720886b852a2d62619ae3900fe71f1852c62db4f287d0c275a60219e1643fc04",
"sha256:85dbaed7a05ff96492b69a8900c5ba605551afb9b27774f7f10511095451137c",
"sha256:8a95ca9cc77ea4571081f6594e08bd272b66060634b8324e99cd1843020364f9",
"sha256:91f021145a8081f881996818474ef737800bcc613ffb1e618a655725a0f9e246",
"sha256:9f62672145f8669ec08762895fe85f4cf0ead08ce3164667f2b94b2f62ab23c3",
"sha256:a12ef323c0f2101529d455cfde7f4135eaa147bad17afe10b48634f796d96abd",
"sha256:c602d015478b7958408d788ba00a50272649c5186ea8baa6cf71d4a1c761bba1",
"sha256:c75e8a5f810ce80a0cfad6e74ee94f9fde9b40c81312949bf356b7304ef20740",
"sha256:d0ae9270a7a5cc0ede63cd234b4ff1ce166c7a749b91dbbf45e0000c56d3eade",
"sha256:d69ad934e13c15684e7887100a8f5f0f61d7a8e57e0fd29d9993210089a5b531",
"sha256:dbcc847bac2d225265d054993a7f910fda66e73d6662fe7156452cac0325b073",
"sha256:e64d338b504c9394a4a34942df4627e1e6cb07396ee3b49fe7b8d6420aa5104f",
"sha256:f4cfc3a19d1e26448032049c79fc60331b104f694cf570a9e94f4e2c9d0932bb",
"sha256:fbfb45e7b297749029cb28694abf437a78695a100e7c2033983d69f0ba2698d4",
"sha256:fcdf84ba3ed8124eb7234adfbb8792f311991cbf8aed1cad4b1b1a7ee08380c1"
],
"index": "pypi",
"version": "==0.56.4"
},
"numpy": {
"hashes": [
"sha256:01dd17cbb340bf0fc23981e52e1d18a9d4050792e8fb8363cecbf066a84b827d",
"sha256:06005a2ef6014e9956c09ba07654f9837d9e26696a0470e42beedadb78c11b07",
"sha256:09b7847f7e83ca37c6e627682f145856de331049013853f344f37b0c9690e3df",
"sha256:0aaee12d8883552fadfc41e96b4c82ee7d794949e2a7c3b3a7201e968c7ecab9",
"sha256:0cbe9848fad08baf71de1a39e12d1b6310f1d5b2d0ea4de051058e6e1076852d",
"sha256:1b1766d6f397c18153d40015ddfc79ddb715cabadc04d2d228d4e5a8bc4ded1a",
"sha256:33161613d2269025873025b33e879825ec7b1d831317e68f4f2f0f84ed14c719",
"sha256:5039f55555e1eab31124a5768898c9e22c25a65c1e0037f4d7c495a45778c9f2",
"sha256:522e26bbf6377e4d76403826ed689c295b0b238f46c28a7251ab94716da0b280",
"sha256:56e454c7833e94ec9769fa0f86e6ff8e42ee38ce0ce1fa4cbb747ea7e06d56aa",
"sha256:58f545efd1108e647604a1b5aa809591ccd2540f468a880bedb97247e72db387",
"sha256:5e05b1c973a9f858c74367553e236f287e749465f773328c8ef31abe18f691e1",
"sha256:7903ba8ab592b82014713c491f6c5d3a1cde5b4a3bf116404e08f5b52f6daf43",
"sha256:8969bfd28e85c81f3f94eb4a66bc2cf1dbdc5c18efc320af34bffc54d6b1e38f",
"sha256:92c8c1e89a1f5028a4c6d9e3ccbe311b6ba53694811269b992c0b224269e2398",
"sha256:9c88793f78fca17da0145455f0d7826bcb9f37da4764af27ac945488116efe63",
"sha256:a7ac231a08bb37f852849bbb387a20a57574a97cfc7b6cabb488a4fc8be176de",
"sha256:abdde9f795cf292fb9651ed48185503a2ff29be87770c3b8e2a14b0cd7aa16f8",
"sha256:af1da88f6bc3d2338ebbf0e22fe487821ea4d8e89053e25fa59d1d79786e7481",
"sha256:b2a9ab7c279c91974f756c84c365a669a887efa287365a8e2c418f8b3ba73fb0",
"sha256:bf837dc63ba5c06dc8797c398db1e223a466c7ece27a1f7b5232ba3466aafe3d",
"sha256:ca51fcfcc5f9354c45f400059e88bc09215fb71a48d3768fb80e357f3b457e1e",
"sha256:ce571367b6dfe60af04e04a1834ca2dc5f46004ac1cc756fb95319f64c095a96",
"sha256:d208a0f8729f3fb790ed18a003f3a57895b989b40ea4dce4717e9cf4af62c6bb",
"sha256:dbee87b469018961d1ad79b1a5d50c0ae850000b639bcb1b694e9981083243b6",
"sha256:e9f4c4e51567b616be64e05d517c79a8a22f3606499941d97bb76f2ca59f982d",
"sha256:f063b69b090c9d918f9df0a12116029e274daf0181df392839661c4c7ec9018a",
"sha256:f9a909a8bae284d46bbfdefbdd4a262ba19d3bc9921b1e76126b1d21c3c34135"
],
"index": "pypi",
"version": "==1.23.5"
},
"opencv-python": {
"hashes": [
"sha256:0dc82a3d8630c099d2f3ac1b1aabee164e8188db54a786abb7a4e27eba309440",
"sha256:5af8ba35a4fcb8913ffb86e92403e9a656a4bff4a645d196987468f0f8947875",
"sha256:6e32af22e3202748bd233ed8f538741876191863882eba44e332d1a34993165b",
"sha256:c5bfae41ad4031e66bb10ec4a0a2ffd3e514d092652781e8b1ac98d1b59f1158",
"sha256:dbdc84a9b4ea2cbae33861652d25093944b9959279200b7ae0badd32439f74de",
"sha256:e6e448b62afc95c5b58f97e87ef84699e6607fe5c58730a03301c52496005cae",
"sha256:f482e78de6e7b0b060ff994ffd859bddc3f7f382bb2019ef157b0ea8ca8712f5"
],
"index": "pypi",
"version": "==4.6.0.66"
},
"plotly": {
"hashes": [
"sha256:4efef479c2ec1d86dcdac8405b6ca70ca65649a77408e39a7e84a1ea2db6c787",
"sha256:52fd74b08aa4fd5a55b9d3034a30dbb746e572d7ed84897422f927fdf687ea5f"
],
"index": "pypi",
"version": "==5.11.0"
},
"priority": {
"hashes": [
"sha256:6f8eefce5f3ad59baf2c080a664037bb4725cd0a790d53d59ab4059288faf6aa",
"sha256:c965d54f1b8d0d0b19479db3924c7c36cf672dbf2aec92d43fbdaf4492ba18c0"
],
"markers": "python_full_version >= '3.6.1'",
"version": "==2.0.0"
},
"pydantic": {
"hashes": [
"sha256:05e00dbebbe810b33c7a7362f231893183bcc4251f3f2ff991c31d5c08240c42",
"sha256:06094d18dd5e6f2bbf93efa54991c3240964bb663b87729ac340eb5014310624",
"sha256:0b959f4d8211fc964772b595ebb25f7652da3f22322c007b6fed26846a40685e",
"sha256:19b3b9ccf97af2b7519c42032441a891a5e05c68368f40865a90eb88833c2559",
"sha256:1b6ee725bd6e83ec78b1aa32c5b1fa67a3a65badddde3976bca5fe4568f27709",
"sha256:1ee433e274268a4b0c8fde7ad9d58ecba12b069a033ecc4645bb6303c062d2e9",
"sha256:216f3bcbf19c726b1cc22b099dd409aa371f55c08800bcea4c44c8f74b73478d",
"sha256:2d0567e60eb01bccda3a4df01df677adf6b437958d35c12a3ac3e0f078b0ee52",
"sha256:2e05aed07fa02231dbf03d0adb1be1d79cabb09025dd45aa094aa8b4e7b9dcda",
"sha256:352aedb1d71b8b0736c6d56ad2bd34c6982720644b0624462059ab29bd6e5912",
"sha256:355639d9afc76bcb9b0c3000ddcd08472ae75318a6eb67a15866b87e2efa168c",
"sha256:37c90345ec7dd2f1bcef82ce49b6235b40f282b94d3eec47e801baf864d15525",
"sha256:4b8795290deaae348c4eba0cebb196e1c6b98bdbe7f50b2d0d9a4a99716342fe",
"sha256:5760e164b807a48a8f25f8aa1a6d857e6ce62e7ec83ea5d5c5a802eac81bad41",
"sha256:6eb843dcc411b6a2237a694f5e1d649fc66c6064d02b204a7e9d194dff81eb4b",
"sha256:7b5ba54d026c2bd2cb769d3468885f23f43710f651688e91f5fb1edcf0ee9283",
"sha256:7c2abc4393dea97a4ccbb4ec7d8658d4e22c4765b7b9b9445588f16c71ad9965",
"sha256:81a7b66c3f499108b448f3f004801fcd7d7165fb4200acb03f1c2402da73ce4c",
"sha256:91b8e218852ef6007c2b98cd861601c6a09f1aa32bbbb74fab5b1c33d4a1e410",
"sha256:9300fcbebf85f6339a02c6994b2eb3ff1b9c8c14f502058b5bf349d42447dcf5",
"sha256:9cabf4a7f05a776e7793e72793cd92cc865ea0e83a819f9ae4ecccb1b8aa6116",
"sha256:a1f5a63a6dfe19d719b1b6e6106561869d2efaca6167f84f5ab9347887d78b98",
"sha256:a4c805731c33a8db4b6ace45ce440c4ef5336e712508b4d9e1aafa617dc9907f",
"sha256:ae544c47bec47a86bc7d350f965d8b15540e27e5aa4f55170ac6a75e5f73b644",
"sha256:b97890e56a694486f772d36efd2ba31612739bc6f3caeee50e9e7e3ebd2fdd13",
"sha256:bb6ad4489af1bac6955d38ebcb95079a836af31e4c4f74aba1ca05bb9f6027bd",
"sha256:bedf309630209e78582ffacda64a21f96f3ed2e51fbf3962d4d488e503420254",
"sha256:c1ba1afb396148bbc70e9eaa8c06c1716fdddabaf86e7027c5988bae2a829ab6",
"sha256:c33602f93bfb67779f9c507e4d69451664524389546bacfe1bee13cae6dc7488",
"sha256:c4aac8e7103bf598373208f6299fa9a5cfd1fc571f2d40bf1dd1955a63d6eeb5",
"sha256:c6f981882aea41e021f72779ce2a4e87267458cc4d39ea990729e21ef18f0f8c",
"sha256:cc78cc83110d2f275ec1970e7a831f4e371ee92405332ebfe9860a715f8336e1",
"sha256:d49f3db871575e0426b12e2f32fdb25e579dea16486a26e5a0474af87cb1ab0a",
"sha256:dd3f9a40c16daf323cf913593083698caee97df2804aa36c4b3175d5ac1b92a2",
"sha256:e0bedafe4bc165ad0a56ac0bd7695df25c50f76961da29c050712596cf092d6d",
"sha256:e9069e1b01525a96e6ff49e25876d90d5a563bc31c658289a8772ae186552236"
],
"markers": "python_version >= '3.7'",
"version": "==1.10.2"
},
"python-dotenv": {
"hashes": [
"sha256:1684eb44636dd462b66c3ee016599815514527ad99965de77f43e0944634a7e5",
"sha256:b77d08274639e3d34145dfa6c7008e66df0f04b7be7a75fd0d5292c191d79045"
],
"index": "pypi",
"version": "==0.21.0"
},
"setuptools": {
"hashes": [
"sha256:6211d2f5eddad8757bd0484923ca7c0a6302ebc4ab32ea5e94357176e0ca0840",
"sha256:d1eebf881c6114e51df1664bc2c9133d022f78d12d5f4f665b9191f084e2862d"
],
"markers": "python_version >= '3.7'",
"version": "==65.6.0"
},
"sniffio": {
"hashes": [
"sha256:e60305c5e5d314f5389259b7f22aaa33d8f7dee49763119234af3755c55b9101",
"sha256:eecefdce1e5bbfb7ad2eeaabf7c1eeb404d7757c379bd1f7e5cce9d8bf425384"
],
"markers": "python_version >= '3.7'",
"version": "==1.3.0"
},
"starlette": {
"hashes": [
"sha256:0efc058261bbcddeca93cad577efd36d0c8a317e44376bcfc0e097a2b3dc24a7",
"sha256:b1b52305ee8f7cfc48cde383496f7c11ab897cd7112b33d998b1317dc8ef9027"
],
"markers": "python_version >= '3.7'",
"version": "==0.21.0"
},
"sympy": {
"hashes": [
"sha256:938f984ee2b1e8eae8a07b884c8b7a1146010040fccddc6539c54f401c8f6fcf",
"sha256:e32380dce63cb7c0108ed525570092fd45168bdae2faa17e528221ef72e88658"
],
"index": "pypi",
"version": "==1.11.1"
},
"tenacity": {
"hashes": [
"sha256:35525cd47f82830069f0d6b73f7eb83bc5b73ee2fff0437952cedf98b27653ac",
"sha256:e48c437fdf9340f5666b92cd7990e96bc5fc955e1298baf4a907e3972067a445"
],
"markers": "python_version >= '3.6'",
"version": "==8.1.0"
},
"toml": {
"hashes": [
"sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b",
"sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"
],
"markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==0.10.2"
},
"typing-extensions": {
"hashes": [
"sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa",
"sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e"
],
"markers": "python_version >= '3.7'",
"version": "==4.4.0"
},
"wsproto": {
"hashes": [
"sha256:ad565f26ecb92588a3e43bc3d96164de84cd9902482b130d0ddbaa9664a85065",
"sha256:b9acddd652b585d75b20477888c56642fdade28bdfd3579aa24a4d2c037dd736"
],
"markers": "python_version >= '3.7'",
"version": "==1.2.0"
}
},
"develop": {}
}

24
backend/main.py Normal file
View File

@ -0,0 +1,24 @@
from fastapi import FastAPI
from os import getenv
import cv2 as cv
from tools import math_transform
app = FastAPI(
openapi_url="/resources/openapi.json",
docs_url="/resources/docs"
) if getenv("ENV") == 'dev' else FastAPI()
@app.post("/image/math-transform")
def math_image_transform_grayscale(image_b64: str, latex: str):
img = cv.imdecode(image_b64)
transformed = img.copy()
func = math_transform.generate_func(latex)
for i in range(len(img)):
for j in range(len(img[i])):
transformed[i][j] = func(inputs)
return {
"transformed_b64": transformed
}

View File

@ -0,0 +1,14 @@
from latex2sympy2 import latex2sympy
def generate_func(latex_input: str) -> function:
latex_clean = latex_input.replace('\ ', '')
res: str
try:
res = latex2sympy(latex_clean)
except Exception as e:
print(e)
def func(input: dict):
return eval(res)

13
frontend/.eslintignore Normal file
View File

@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock

20
frontend/.eslintrc.cjs Normal file
View File

@ -0,0 +1,20 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
plugins: ['svelte3', '@typescript-eslint'],
ignorePatterns: ['*.cjs'],
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
settings: {
'svelte3/typescript': () => require('typescript')
},
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020
},
env: {
browser: true,
es2017: true,
node: true
}
};

10
frontend/.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

1
frontend/.npmrc Normal file
View File

@ -0,0 +1 @@
engine-strict=true

13
frontend/.prettierignore Normal file
View File

@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock

9
frontend/.prettierrc Normal file
View File

@ -0,0 +1,9 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}

38
frontend/README.md Normal file
View File

@ -0,0 +1,38 @@
# create-svelte
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
## Creating a project
If you're seeing this, you've probably already done this step. Congrats!
```bash
# create a new project in the current directory
npm create svelte@latest
# create a new project in my-app
npm create svelte@latest my-app
```
## Developing
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
```bash
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
```
## Building
To create a production version of your app:
```bash
npm run build
```
You can preview the production build with `npm run preview`.
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.

1
frontend/example.env Normal file
View File

@ -0,0 +1 @@
VITE_BACKEND_URL=http://localhost:8000

42
frontend/package.json Normal file
View File

@ -0,0 +1,42 @@
{
"name": "datadonkey-frontend-proto",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test": "playwright test",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write ."
},
"devDependencies": {
"@playwright/test": "1.25.0",
"@sveltejs/adapter-auto": "next",
"@sveltejs/kit": "next",
"@typescript-eslint/eslint-plugin": "^5.27.0",
"@typescript-eslint/parser": "^5.27.0",
"carbon-components-svelte": "^0.70.12",
"carbon-preprocess-svelte": "^0.9.1",
"eslint": "^8.16.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-svelte3": "^4.0.0",
"prettier": "^2.6.2",
"prettier-plugin-svelte": "^2.7.0",
"sass": "^1.56.1",
"svelte": "^3.44.0",
"svelte-check": "^2.7.1",
"svelte-preprocess": "^4.10.6",
"tslib": "^2.3.1",
"typescript": "^4.7.4",
"vite": "^3.1.0"
},
"type": "module",
"dependencies": {
"@carbon/charts-svelte": "^1.6.1",
"carbon-icons-svelte": "^11.4.0",
"svelte-mathquill": "^0.4.1"
}
}

View File

@ -0,0 +1,10 @@
import type { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
webServer: {
command: 'yarn build && yarn preview',
port: 4173
}
};
export default config;

9
frontend/src/app.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
// and what to do when importing types
declare namespace App {
// interface Locals {}
// interface PageData {}
// interface Error {}
// interface Platform {}
}

12
frontend/src/app.html Normal file
View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width" />
%sveltekit.head%
</head>
<body>
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>

28
frontend/src/app.sass Normal file
View File

@ -0,0 +1,28 @@
.row-centered
display: flex
flex-direction: row
align-items: center
.title-row
@extend .row-centered
justify-items: left
gap: 0px 1rem
.tile-row
@extend .row-centered
justify-items: left
gap: 0px 1rem
.tile-col
display: flex
flex-direction: column
align-items: left
.mathquill
width: 40rem
height: 6rem
font-size: 24px
.image-math-legend-table
width: 40rem
height: 13.5rem

View File

@ -0,0 +1,24 @@
<script lang="ts">
import { FileUploader, FileUploaderButton, Modal } from "carbon-components-svelte";
export let type: "image" | "data" = "image";
export let files: File[] = [];
</script>
<FileUploader
multiple={false}
buttonLabel="Upload file"
status="complete"
accept={(() => {
switch (type) {
case "image": {
return [".jpg", ".jpeg", ".png", ".tiff"]
}
case "data": {
return [".csv", ".xlsx"]
}
}
})()}
bind:files
/>

View File

@ -0,0 +1,5 @@
export const mathInputConfig = {
autoCommands: 'pi theta sqrt sum',
autoOperatorNames: 'sin cons tan arcsin arccos',
maxDepth: 4,
}

29
frontend/src/lib/nav.ts Normal file
View File

@ -0,0 +1,29 @@
export type NavItem = {
name: string,
urlPath: string,
};
export interface NavItemList {
[details: string]: NavItem[]
}
const navItems: NavItemList = {
imaging: [
{
name: "Mathematical Transform",
urlPath: "math-transform"
},
{
name: "Pixel Intensity Heatmap",
urlPath: "heatmap"
},
{
name: "Smooth Image (Convolutional)",
urlPath: "smooth-conv"
}
],
data: [
]
};
export default navItems;

View File

@ -0,0 +1,67 @@
<script lang="ts">
import "carbon-components-svelte/css/white.css";
import "../app.sass";
import { MathQuillSetup } from 'svelte-mathquill';
import { Content, Header, HeaderAction, HeaderNav, HeaderNavItem, HeaderPanelDivider, HeaderPanelLink, HeaderPanelLinks, HeaderUtilities, Modal, SideNav, SideNavItems, SideNavLink, SideNavMenu, SideNavMenuItem, SkipToContent } from "carbon-components-svelte";
import { InformationFilled } from "carbon-icons-svelte";
import { goto } from "$app/navigation";
import { page } from "$app/stores";
import navItems from "$lib/nav";
let sidenavOpen = false;
</script>
<MathQuillSetup/>
<Header company="DataDonkey" platformName="Lab Tools" bind:isSideNavOpen={sidenavOpen} expandedByDefault={true}>
<svelte:fragment slot="skip-to-content">
<SkipToContent />
</svelte:fragment>
<HeaderNav>
<HeaderNavItem isSelected={$page.url.pathname == "/"} href="/" text="Home"/>
<HeaderNavItem isSelected={
$page.url.pathname == '/imaging' || /^\/imaging\/.*$/.test($page.url.pathname)
} href="/imaging" text="Imaging"/>
<HeaderNavItem isSelected={
$page.url.pathname == '/data' || /^\/data\/.*$/.test($page.url.pathname)
} href="/data" text="Data Analysis"/>
</HeaderNav>
<HeaderUtilities>
<HeaderAction icon={InformationFilled} closeIcon={InformationFilled} text="About">
<HeaderPanelDivider>Information Links</HeaderPanelDivider>
<HeaderPanelLinks>
<HeaderPanelLink href="https://datadonkey.xyz" target="_blank">DataDonkey Homepage</HeaderPanelLink>
<HeaderPanelLink href="https://git.turtlebasket.ml/datadonkey-com" target="_blank">DataDonkey Git Repos</HeaderPanelLink>
<HeaderPanelLink href="https://git.turtlebasket.ml/datadonkey-com/proto" target="_blank">Lab Tools Source Code</HeaderPanelLink>
</HeaderPanelLinks>
</HeaderAction>
</HeaderUtilities>
</Header>
{#if $page.url.pathname != "/"}
<SideNav bind:isOpen={sidenavOpen}>
<SideNavItems>
{#each Object.keys(navItems) as navType}
{#if $page.url.pathname == `/${navType}` || (new RegExp(`^\/${navType}\/.*$`)).test($page.url.pathname)}
{#each navItems[navType].sort((a, b) => {
if (a.name > b.name) {
return 1
}
else {
return -1
}
}) as navItem}
<SideNavLink text={`${navItem.name}`} href={`/imaging/${navItem.urlPath}`} isSelected={
$page.url.pathname == `/imaging/${navItem.urlPath}`
}/>
{/each}
{/if}
{/each}
</SideNavItems>
</SideNav>
{/if}
<Content>
<slot/>
</Content>

View File

@ -0,0 +1,66 @@
<script>
import { goto } from "$app/navigation";
import { ClickableTile, Column, Grid, Row} from "carbon-components-svelte";
import { Fire, FunctionMath, WatsonHealthSmoothing } from "carbon-icons-svelte";
</script>
<h1>Lab Tools</h1>
<br>
<p>A collection of useful utilities for image & data processing work.
Built with ❤️ by DataDonkey, and fully open-source.</p>
<br>
<br>
<h3>Popular Workflows</h3>
<br>
<Grid noGutter padding={true}>
<Row>
<Column>
<ClickableTile href="/imaging/math-transform">
<div class="tile-row">
<FunctionMath size={32}/>
<div class="tile-col">
<h4>Mathematical Transform</h4>
<p>Transforms an image using a LaTeX-formatted math formula.</p>
</div>
</div>
</ClickableTile>
</Column>
<Column>
<ClickableTile href="/imaging/heatmap">
<div class="tile-row">
<Fire size={32}/>
<div class="tile-col">
<h4>Heatmap</h4>
<p>Generates a heatmap of pixel intensities.</p>
</div>
</div>
</ClickableTile>
</Column>
</Row>
<Row>
<Column>
<ClickableTile href="/imaging/smooth-conv">
<div class="tile-row">
<WatsonHealthSmoothing size={32}/>
<div class="tile-col">
<h4>Convolutional Smooth</h4>
<p>Applies a smoothing kernel to an image.</p>
</div>
</div>
</ClickableTile>
</Column>
<Column>
<ClickableTile href="/imaging/heatmap">
<div class="tile-row">
<Fire size={32}/>
<div class="tile-col">
<h4>Heatmap</h4>
<p>Generates a heatmap of pixel intensities.</p>
</div>
</div>
</ClickableTile>
</Column>
</Row>
</Grid>

View File

@ -0,0 +1,4 @@
<h1>Data Analysis</h1>
<br>
<p>To get started, select an analysis workflow from the sidebar.</p>
<br>

View File

@ -0,0 +1,4 @@
<h1>Imaging</h1>
<br>
<p>To get started, select an imaging tool from the sidebar.</p>
<br>

View File

@ -0,0 +1,11 @@
<script>
import { Fire } from "carbon-icons-svelte";
</script>
<div class="title-row">
<Fire size={32}/>
<h1>Pixel Intensity Heatmap</h1>
</div>
<br>
<p>Generates a heatmap based on pixel intensities.</p>
<br>

View File

@ -0,0 +1,78 @@
<script lang="ts">
import { Button, Checkbox, FileUploaderButton, FormLabel, Select, SelectItem, SelectItemGroup, StructuredList, StructuredListBody, StructuredListCell, StructuredListHead, StructuredListRow } from "carbon-components-svelte";
import { Checkmark, FunctionMath, Group, Label, Save } from "carbon-icons-svelte";
import SelectFileSingle from "src/components/SelectFileSingle.svelte";
import { MathQuill } from "svelte-mathquill";
// inputs
let files: File[] = [];
let latex: string = "";
// options
let autoMinMax = true;
let heatmapOutput = true;
// state
let loading = false;
let finished = false;
</script>
<div class="title-row">
<FunctionMath size={32}/>
<h1>Mathematical Transform</h1>
</div>
<br>
<p>Applies a mathematical operation to every pixel in the image.</p>
<br>
<SelectFileSingle
type="image"
bind:files
/>
<br>
<FormLabel>Enter Transform Formula:</FormLabel><br>
<MathQuill bind:latex class="mathquill"/>
<br><br>
<!-- Legend -->
<div class="image-math-legend-table">
<StructuredList condensed>
<StructuredListHead>
<StructuredListRow head>
<StructuredListCell head>Variable</StructuredListCell>
<StructuredListCell head>Value</StructuredListCell>
<StructuredListCell head>Description</StructuredListCell>
</StructuredListRow>
</StructuredListHead>
<StructuredListBody>
<StructuredListRow>
<StructuredListCell><strong>R</strong></StructuredListCell>
<StructuredListCell>0 to 255</StructuredListCell>
<StructuredListCell>Pixel Red Intensity</StructuredListCell>
</StructuredListRow>
<StructuredListRow>
<StructuredListCell><strong>G</strong></StructuredListCell>
<StructuredListCell>0 to 255</StructuredListCell>
<StructuredListCell>Pixel Green Intensity</StructuredListCell>
</StructuredListRow>
<StructuredListRow>
<StructuredListCell><strong>B</strong></StructuredListCell>
<StructuredListCell>0 to 255</StructuredListCell>
<StructuredListCell>Pixel Blue Intensity</StructuredListCell>
</StructuredListRow>
<StructuredListRow>
<StructuredListCell><strong>A</strong></StructuredListCell>
<StructuredListCell>0 to 255</StructuredListCell>
<StructuredListCell>Pixel Alpha Intensity (optional)</StructuredListCell>
</StructuredListRow>
</StructuredListBody>
</StructuredList>
</div>
<Checkbox labelText="Automatically calculate intensity maxima & minima" bind:checked={autoMinMax}/>
<Checkbox labelText="Ouptut a heatmap" bind:checked={heatmapOutput}/>
<br>
<Button on:click={() => {}} icon={Checkmark}>Apply Transformation</Button>
<Button on:click={() => {}} icon={Save} kind="secondary" disabled={!finished}>Save Output</Button>

View File

@ -0,0 +1,12 @@
<script>
import { WatsonHealthSmoothing } from "carbon-icons-svelte";
</script>
<div class="title-row">
<WatsonHealthSmoothing size={32}/>
<h1>Convolutional Smoothing</h1>
</div>
<br>
<p>Applies a convolutional smoothing kernel of a customizable radius.</p>
<br>

BIN
frontend/static/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

28
frontend/svelte.config.js Normal file
View File

@ -0,0 +1,28 @@
import adapter from '@sveltejs/adapter-auto';
import { optimizeImports } from 'carbon-preprocess-svelte';
import preprocess from 'svelte-preprocess';
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://github.com/sveltejs/svelte-preprocess
// for more information about preprocessors
preprocess: [
preprocess(),
optimizeImports()
],
kit: {
adapter: adapter(),
alias: {
"src": "./src",
"/src": "./src",
"$components": "./src/components"
}
// prerender: {
// enabled: false
// }
},
};
export default config;

6
frontend/tests/test.ts Normal file
View File

@ -0,0 +1,6 @@
import { expect, test } from '@playwright/test';
test('index page has expected h1', async ({ page }) => {
await page.goto('/');
expect(await page.textContent('h1')).toBe('Welcome to SvelteKit');
});

17
frontend/tsconfig.json Normal file
View File

@ -0,0 +1,17 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}

18
frontend/vite.config.ts Normal file
View File

@ -0,0 +1,18 @@
import { sveltekit } from '@sveltejs/kit/vite';
import type { UserConfig } from 'vite';
const config: UserConfig = {
plugins: [sveltekit()],
ssr: {
noExternal: ['@carbon/charts', 'carbon-components'],
},
resolve: {
alias: {
"src": "./src",
"/src": "./src",
"$lib": "./src/lib",
}
}
};
export default config;

1874
frontend/yarn-error.log Normal file

File diff suppressed because it is too large Load Diff

1822
frontend/yarn.lock Normal file

File diff suppressed because it is too large Load Diff