Skip to content
Snippets Groups Projects
Commit 4340e76e authored by Yorgo EL MOUBAYED's avatar Yorgo EL MOUBAYED
Browse files

Deleted src/dataproc/__pycache__/__init__.cpython-38.pyc,...

Deleted src/dataproc/__pycache__/__init__.cpython-38.pyc, src/dataproc/__pycache__/admin.cpython-38.pyc, src/dataproc/__pycache__/apps.cpython-38.pyc, src/dataproc/__pycache__/models.cpython-38.pyc, src/dataproc/api/__init__.py, src/dataproc/api/serializers.py, src/dataproc/api/urls.py, src/dataproc/api/views.py, src/dataproc/migrations/models/report.py, src/dataproc/migrations/models/rsf.py, src/dataproc/migrations/__init__.py, src/dataproc/tests/__init.py__, src/dataproc/tests/test_forms.py, src/dataproc/tests/test_models.py, src/dataproc/tests/test_urls.py, src/dataproc/tests/test_views.py, src/dataproc/__init__.py, src/dataproc/admin.py, src/dataproc/apps.py, src/dataproc/models.py, src/dataproc/settings.py, src/dataproc/views.py, src/myservice/__pycache__/__init__.cpython-38.pyc, src/myservice/__pycache__/settings.cpython-38.pyc, src/myservice/__pycache__/urls.cpython-38.pyc, src/myservice/__init__.py, src/myservice/asgi.py, src/myservice/settings.py, src/myservice/urls.py, src/myservice/wsgi.py, src/manage.py files
parent 5d55bbe6
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 450 deletions
File deleted
File deleted
File deleted
File deleted
from django.contrib import admin
# Register your models here.
from rest_framework import serializers
from dataproc.models import Contruct
class ContructSerializer(serializers.ModelSerializer):
class Meta:
model = Contruct
fields = ['title', 'created_at', 'updated_at',]
\ No newline at end of file
from django.urls import path
from dataproc.api.views import(
api_detail_construct_view,
api_update_construct_view,
api_delete_construct_view,
api_create_construct_view,
)
app_name = 'dataproc'
urlpatterns = [
path('<slug>/', api_detail_construct_view, name="detail"),
path('<slug>/update', api_update_construct_view, name="update"),
path('<slug>/delete', api_delete_construct_view, name="delete"),
path('create', api_create_construct_view, name="create"),
]
\ No newline at end of file
from rest_framework import status
from rest_framework.response import Response
from rest_framework.decorators import api_view
from dataproc.models import Construct
from dataproc.api.serializers import ConstructSerializer
SUCCESS = 'success'
ERROR = 'error'
DELETE_SUCCESS = 'deleted'
UPDATE_SUCCESS = 'updated'
CREATE_SUCCESS = 'created'
@api_view(['GET', ])
def api_detail_construct_view(request, slug):
try:
construct = Construct.objects.get(slug=slug)
except Construct.DoesNotExist:
return Response(status=status.HTTP_404_NOT_FOUND)
if request.method == 'GET':
serializer = ConstructSerializer(blog_post)
return Response(serializer.data)
@api_view(['PUT',])
def api_update_construct_view(request, slug):
try:
construct = Construct.objects.get(slug=slug)
except Construct.DoesNotExist:
return Response(status=status.HTTP_404_NOT_FOUND)
if request.method == 'PUT':
serializer = ConstructSerializer(construct, data=request.data)
data = {}
if serializer.is_valid():
serializer.save()
data['SUCCESS'] = UPDATE_SUCCESS
return Response(data=data)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
@api_view(['DELETE',])
def api_delete_blog_view(request, slug):
try:
construct = Construct.objects.get(slug=slug)
except Construct.DoesNotExist:
return Response(status=status.HTTP_404_NOT_FOUND)
if request.method == 'DELETE':
operation = construct.delete()
data = {}
if operation:
data['SUCCESS'] = DELETE_SUCCESS
return Response(data=data)
@api_view(['POST'])
def api_create_construct_view(request):
construct = Construct()
if request.method == 'POST':
serializer = ConstructSerializer(construct, data=request.data)
data = {}
if serializer.is_valid():
serializer.save()
return Response(serializer.data, status=status.HTTP_201_CREATED)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
\ No newline at end of file
from django.apps import AppConfig
class apiConfig(AppConfig):
name = 'api'
from django.db import models, StatisticalReport
from neomodel import StructuredNode, StringProperty, IntegerProperty,UniqueIdProperty, RelationshipTo, DateTimeProperty, BooleanProperty
class Report(StructuredNode):
report_path=StringProperty()
report_source=StringProperty()
report_size=StringProperty()
# Relationships
is_statisticalreport=RelationshipTo(StatisticalReport, 'IS')
\ No newline at end of file
from django.db import models, report, DPStep, MTZfile, ScalepackFile, Reference, Construct
from neomodel import StructuredNode, StringProperty, IntegerProperty,UniqueIdProperty, RelationshipTo, DateTimeProperty, BooleanProperty
class RefelctionStructureFactors(StructuredNode):
rsf_source=StringProperty()
rsf_filesize=StringProperty()
rsf_filepath=StringProperty()
# Relationships
input_as_ref=RelationshipTo(DPStep, 'INPUT_AS_REFERENCE')
input_of=RelationshipTo(DPStep, 'INPUT')
generates_mtz=RelationshipTo(MTZfile, 'GENERATES')
generates_scalepack=RelationshipTo(ScalepackFile, 'GENERATES')
labelled=RelationshipTo(Reference, 'LABELLED')
belongs=RelationshipTo(Construct, 'BELONGS')
\ No newline at end of file
# from django.db import models
# from neomodel import StructuredNode, StringProperty, IntegerProperty,UniqueIdProperty, RelationshipTo, DateTimeProperty, BooleanProperty
# class City(StructuredNode):
# code = StringProperty(unique_index=True, required=True)
# name = StringProperty(index=True, default="city")
from django.db import models
from django.utils.text import slugify
from django.conf import settings
class Contruct(models.Model):
title = models.CharField(max_length=50, null=False, blank=True)
created_at = models.DateTimeField(auto_now_add=True, verbose_name="created at")
updated_at = models.DateTimeField(auto_now=True, verbose_name="updated at")
slug = models.SlugField(blank=True, unique=True)
def __str__(self):
return self.title
#####################################
# Nodes and properties of the model #
#####################################
# class LigandsFitting(StructuredNode):
# uid=UniqueIdProperty()
# dp_step_name = StringProperty()
# created_at=DateTimeProperty()
# updated_at=DateTimeProperty()
# pipedream_id=IntegerProperty()
# score=IntegerProperty()
# fitting_success=BooleanProperty()
# class Refinement(StructuredNode):
# uid=UniqueIdProperty()
# dp_step_name=StringProperty()
# created_at=DateTimeProperty()
# updated_at=DateTimeProperty()
# class PostRefinement(StructuredNode):
# uid=UniqueIdProperty()
# dp_step_name=StringProperty()
# pipedream_id=IntegerProperty()
# created_at=DateTimeProperty()
# updated_at=DateTimeProperty()
# class ReductionScaling(StructuredNode):
# uid=UniqueIdProperty()
# dp_step_name=StringProperty()
# created_at=DateTimeProperty()
# updated_at=DateTimeProperty()
# class autoPROC(StructuredNode):
# uid=UniqueIdProperty()
# tool_name=StringProperty()
# class Buster(StructuredNode):
# uid=UniqueIdProperty()
# tool_name=StringProperty()
# class Rhofit(StructuredNode):
# uid=UniqueIdProperty()
# tool_name=StringProperty()
# class StatisticalReport(StructuredNode):
# uid=UniqueIdProperty()
# report_name=StringProperty()
# class ComputingHost(StructuredNode):
# ch_softwares=StringProperty()
# ch_softwares_number=IntegerProperty()
# class StorageHost(StructuredNode):
# sh_files=StringProperty()
# sh_files_number=IntegerProperty()
# class Report(StructuredNode):
# report_path=StringProperty()
# report_source=StringProperty()
# report_size=StringProperty()
# # Relationships
# is_statisticalreport=RelationshipTo(StatisticalReport, 'IS')
# class RefelctionStructureFactors(StructuredNode):
# rsf_source=StringProperty()
# rsf_filesize=StringProperty()
# rsf_filepath=StringProperty()
# # Relationships
# input_as_ref=RelationshipTo(DPStep, 'INPUT_AS_REFERENCE')
# input_of=RelationshipTo(DPStep, 'INPUT')
# generates_mtz=RelationshipTo(MTZfile, 'GENERATES')
# generates_scalepack=RelationshipTo(ScalepackFile, 'GENERATES')
# labelled=RelationshipTo(Reference, 'LABELLED')
# belongs=RelationshipTo(Construct, 'BELONGS')
# class DPStep(StructuredNode):
# # Relationships
# is_fitting=RelationshipTo(LigandsFitting, 'IS')
# is_refinement=RelationshipTo(Refinement, 'IS')
# is_postrefinement=RelationshipTo(PostRefinement, 'IS')
# is_reductionscaling=RelationshipTo(ReductionScaling, 'IS')
# with_tool_1=RelationshipTo(autoPROC, 'WITH')
# with_tool_2=RelationshipTo(Rhofit, 'WITH')
# with_tool_3=RelationshipTo(Buster, 'WITH')
# genereates_report=RelationshipTo(Report, 'GENERATES')
# # generates_coordinates=RelationshipTo(Coordinates, 'GENERATES')
# generates_rsf=RelationshipTo(RefelctionStructureFactors, 'GENERATES')
# class Coordinates(StructuredNode):
# coordinates_source=StringProperty(unique_index=True, required=True)
# coordinates_filesize=StringProperty(unique_index=True, required=True)
# coordinates_filepath=StringProperty(unique_index=True, required=True)
# # Relationships
# input_as_ref=RelationshipTo(DPStep, 'INPUT_AS_REFERENCE')
# input_of=RelationshipTo(DPStep, 'INPUT')
# has_pdb=RelationshipTo(PDBFile, 'HAS')
# has_mmcif=RelationshipTo(mmCIFFile, 'HAS')
# belongs=RelationshipTo(Construct, 'BELONGS')
# labelled=RelationshipTo(Reference, 'LABELLED')
# class DataCollection (StructuredNode):
# collection_type=StringProperty()
# collection_size=StringProperty()
# # Relationships
# genereates_dataset=RelationshipTo(Datatset, 'GENERATES')
# class Datatset(StructuredNode):
# dataset_file_no=IntegerProperty()
# dataset_size=StringProperty()
# # Relationships
# input_of=RelationshipTo(DPStep, 'INPUT')
# stored=RelationshipTo(StorageHost, 'STORED')
# belongs=RelationshipTo(Construct, 'BELONGS')
# class mmCIFFile(StructuredNode):
# uid=UniqueIdProperty()
# coordinates_filetype=StringProperty(unique_index=True, required=True)
# class PDBFile(StructuredNode):
# uid=UniqueIdProperty()
# coordinates_filetype=StringProperty(unique_index=True, required=True)
# class MTZfile(StructuredNode):
# uid=UniqueIdProperty()
# rsf_filetype = StringProperty(unique_index=True, required=True)
# class ScalepackFile(StructuredNode):
# uid=UniqueIdProperty()
# rsf_filetype = StringProperty(unique_index=True, required=True)
# class Reference(StructuredNode):
# uid=UniqueIdProperty()
# class OCF(StructuredNode):
# # Relationships
# has_rsf=RelationshipTo(RefelctionStructureFactors, 'HAS')
# has_coordinates=RelationshipTo(Coordinates, 'HAS')
# class Construct(StructuredNode):
# # Relationships
# has_ocf=RelationshipTo(OCF, 'HAS')
# has_storage_host=RelationshipTo(StorageHost, 'HAS')
# has_computing_host=RelationshipTo(ComputingHost, 'HAS')
# class Ligand(StructuredNode):
# # Relationships
# associated=RelationshipTo(Datatset, 'ASSOCIATED')
"""
Django settings for newapi project.
Generated by 'django-admin startproject' using Django 3.1.6.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathlib import Path
import os
from decouple import config
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '=013nqbp3o8hr9e*it$b1um^%ke*uxqvt5qnp=xe6@^20a)d!b'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
#django apps
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_neomodel'
'rest_framework'
#My apps
'dataproc',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'newapi.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'newapi.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
NEOMODEL_NEO4J_BOLT_URL = os.environ.get('NEO4J_BOLT_URL','bolt://neo4j:neo4@localhost:7687')
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
from django.test import SimpleTestCase
from django.urls import reverse, resolve
class TestUrls(SimpleTestCase):
def {test_url}(self):
url = reverse('{url_route}')
self.assertEquals(resolve(url).func, )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment