Skip to content

Commit

Permalink
Add tensormap-server
Browse files Browse the repository at this point in the history
  • Loading branch information
ivantha committed Mar 21, 2022
1 parent dca9a8e commit 2b8f504
Show file tree
Hide file tree
Showing 44 changed files with 155 additions and 333 deletions.
5 changes: 5 additions & 0 deletions tensormap-server/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
secret_key = 'Your secret key'
db_name = 'database name'
db_host = 'host ip address'
db_user = 'database username'
db_password = 'database user password'
290 changes: 13 additions & 277 deletions tensormap-server/.gitignore
Original file line number Diff line number Diff line change
@@ -1,206 +1,13 @@
# Jetbrains
.idea

# Created by https://www.gitignore.io/api/linux,macos,python,windows,pycharm,visualstudiocode
# Edit at https://www.gitignore.io/?templates=linux,macos,python,windows,pycharm,visualstudiocode

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### PyCharm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

# JetBrains templates
**___jb_tmp___

### PyCharm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/sonarlint

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# Python
__pycache__
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
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
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/
# Virtual environment
venv
venv_windows

# Jupyter Notebook
.ipynb_checkpoints
Expand All @@ -209,84 +16,13 @@ target/
profile_default/
ipython_config.py

# pyenv
.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

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py
# MacOS
.DS_Store

# Environments
# Environment
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
myenv/
# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

### VisualStudioCode ###
.vscode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

### VisualStudioCode Patch ###
# Ignore all local history of files
.history

### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk
data/*.csv

# End of https://www.gitignore.io/api/linux,macos,python,windows,pycharm,visualstudiocode
templates/generated-code/*.py
templates/json-model/*.json
File renamed without changes.
7 changes: 4 additions & 3 deletions tensormap-server-revamp/app.py → tensormap-server/app.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from dotenv import load_dotenv
from flask import Flask
from setup.urls import MainURLRegister
from flask_cors import CORS

from setup.settings import SettingUp
from setup.urls import MainURLRegister
from shared.services.config import get_configs
from shared.utils import get_socket_ref
from flask_cors import CORS
from dotenv import load_dotenv

load_dotenv()
configs = get_configs()
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from shared.utils import get_db_ref


db = get_db_ref()


Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from endpoints.DataProcess.models import DataProcess
from endpoints.DataUpload.models import DataFile
from shared.utils import save_one_record, delete_one_record
from shared.request.response import generic_response
from shared.constants import *
from shared.request.response import generic_response
from shared.utils import save_one_record, delete_one_record


def add_target_service(incoming):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from flask_restful import reqparse

from shared.constants import *


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from flask_restful import Resource
from endpoints.DataProcess.validators import target_add_post_validator

from endpoints.DataProcess.services import add_target_service, get_all_targets_service, delete_one_target_by_id_service, \
get_one_target_by_id_service
from endpoints.DataProcess.validators import target_add_post_validator


class ProcessAddNGet(Resource):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import os

import pandas as pd
from flask import request
from werkzeug.utils import secure_filename
from shared.services.config import get_configs
from shared.request.response import generic_response

from endpoints.DataUpload.models import DataFile
from shared.utils import save_one_record, delete_one_record
import os
import pandas as pd
from shared.constants import *
from shared.request.response import generic_response
from shared.services.config import get_configs
from shared.utils import save_one_record, delete_one_record

configs = get_configs()
upload_folder = configs['api']['upload']['folder']


def add_file_service():

# Extract the file and save it in the ./data folder
file = request.files["data"]
filename = secure_filename(file.filename)
Expand All @@ -39,7 +40,6 @@ def get_all_files_service():


def delete_one_file_by_id_service(file_id):

# Check file exists in DB and check the file in ./data directory if exist, file deleted
if DataFile.query.filter_by(id=file_id).count() > 0:
file = DataFile.query.filter_by(id=file_id).first()
Expand Down
Loading

0 comments on commit 2b8f504

Please sign in to comment.