Skip to content
Snippets Groups Projects
Commit 630aa8f0 authored by root's avatar root
Browse files

Update model properties

parent d1636931
No related branches found
No related tags found
No related merge requests found
Showing
with 68 additions and 77 deletions
File added
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
from neomodel import StructuredNode, StringProperty, IntegerProperty,UniqueIdProperty, RelationshipTo
from uuid import uuid4
class ComputingHost(StructuredNode):
ip=StringProperty()
uuid=StringProperty(unique_index=True, default=uuid4)
hostname=StringProperty()
friendlyname=StringProperty()
workingdirectory=StringProperty()
@property
def serialize(self):
"""
Serializer for node properties
"""
return {
'node_properties': {
'ip': self.name,
'uuid': self.uuid,
'hostname': self.sh_files,
'friendlyname': self.sh_files_number,
'workingdirectory': self.workingdirectory,
},
}
\ No newline at end of file
# Import libraries
from neomodel import StructuredNode, StringProperty, IntegerProperty,UniqueIdProperty, RelationshipTo
from uuid import uuid4
# Import models
from api.models.ocf_model import OCF
from api.models.storagehost_model import StorageHost
from api.models.computinghost_model import ComputingHost
from api.models.computationhost_model import ComputationHost
from api.models.user_model import User
class Construct(StructuredNode):
"""
Defines node properties and relationships
Provides data serializer
"""
# Properties
uuid=StringProperty(unique_index=True, default=uuid4)
userUuid=StringProperty(unique_index=True, default=uuid4)
name=StringProperty()
# Relationships
has_ocf=RelationshipTo(OCF, 'HAS')
has_storage_host=RelationshipTo(StorageHost, 'HAS')
has_computing_host=RelationshipTo(ComputingHost, 'HAS')
has_computation_host=RelationshipTo(ComputationHost, 'HAS')
has_user=RelationshipTo(User, 'HAS')
@property
......@@ -22,6 +31,7 @@ class Construct(StructuredNode):
return {
'node_properties': {
'uuid': self.uuid,
'userUuid': self.userUuid,
'name': self.name,
},
}
......@@ -38,8 +48,8 @@ class Construct(StructuredNode):
# 'nodes_related': self.serialize_relationships(self.storagehost.all()),
# },
# {
# 'nodes_type': 'ComputingHost',
# 'nodes_related': self.serialize_relationships(self.computinghost.all()),
# 'nodes_type': 'ComputationHost',
# 'nodes_related': self.serialize_relationships(self.computationhost.all()),
# },
# {
# 'nodes_type': 'User',
......
# Import libraries
from neomodel import StructuredNode, StringProperty, IntegerProperty,UniqueIdProperty, RelationshipTo
from uuid import uuid4
# Import models
from api.models.dataset_model import Dataset
class DataCollection(StructuredNode):
"""
Defines node properties and relationships
Provides data serializer
"""
# Properties
uuid=StringProperty(unique_index=True, default=uuid4)
imagesnumber=IntegerProperty()
flux=IntegerProperty()
imagesNumber=IntegerProperty()
flux=StringProperty()
resolution=StringProperty()
wavelength=IntegerProperty()
transmission=IntegerProperty()
exposuretime=IntegerProperty()
detectordistance=IntegerProperty()
beamlinename=StringProperty()
exposureTime=IntegerProperty()
detectorDistance=IntegerProperty()
beamlineName=StringProperty()
# Relationships
generates=RelationshipTo(Dataset, 'GENERATES')
......@@ -27,13 +36,13 @@ class DataCollection(StructuredNode):
return {
'node_properties': {
"uuid": self.uuid,
"imagesNumber": self.imagesnumber,
"imagesNumber": self.imagesNumber,
"flux": self.flux,
"resolution": self.resolution,
"wavelength": self.wavelength,
"transmission": self.transmission,
"exposureTime": self.exposuretime,
"detectorDistance": self.detectordistance ,
"beamlineName": self.beamlinename,
"exposureTime": self.exposureTime,
"detectorDistance": self.detectorDistance ,
"beamlineName": self.beamlineName,
},
}
\ No newline at end of file
......@@ -5,22 +5,18 @@ from api.models.dpstep_model import DPStep
from api.models.storagehost_model import StorageHost
from api.models.construct_model import Construct
class Dataset(StructuredNode):
# Properties
uuid=StringProperty(unique_index=True, default=uuid4)
name=StringProperty()
# dataset_file_no=IntegerProperty()
# dataset_size=StringProperty()
filetemplatename=StringProperty()
useruuid=StringProperty()
crystaluuid=StringProperty()
currentpath=StringProperty()
generationpath=StringProperty()
blstartingdate=DateTimeProperty()
beamlinename=StringProperty()
facilityname=StringProperty()
fileTemplateName=StringProperty()
userUuid=StringProperty()
crystalUuid=StringProperty()
currentPath=StringProperty(max_length=500)
generationPath=StringProperty(max_length=500)
blStartingDate=StringProperty()
beamlineName=StringProperty()
facilityName=StringProperty()
# Relationships
input_of=RelationshipTo(DPStep, 'INPUT')
......@@ -37,17 +33,14 @@ class Dataset(StructuredNode):
return {
'node_properties': {
'uuid': self.uuid,
'name': self.name,
'filetemplatename': self.filetemplatename,
'useruuid': self.useruuid,
'crystaluuid': self.crystaluuid,
'currentpath': self.currentpath,
'generationpath': self.generationpath,
'blstartingdate': self.blstartingdate,
'beamlinename': self.beamlinename,
'facilityname': self.facilityname,
# 'dataset_file_no': self.dataset_file_no,
# 'dataset_size': self.dataset_size,
'fileTemplateName': self.fileTemplateName,
'userUuid': self.userUuid,
'crystalUuid': self.crystalUuid,
'currentPath': self.currentPath,
'generationPath': self.generationPath,
'blStartingDate': self.blStartingDate,
'beamlineName': self.beamlineName,
'facilityName': self.facilityName,
},
}
# Import libraries
from neomodel import StructuredNode, StringProperty, IntegerProperty,UniqueIdProperty, RelationshipTo
from uuid import uuid4
# Improt models
from api.models.reflectionstructurefactors_model import RefelctionStructureFactors
from api.models.coordinates_model import Coordinates
class OCF(StructuredNode):
"""
Defines node properties and relationships
Provides data serializer
"""
# Properties
uuid=StringProperty(unique_index=True, default=uuid4)
name=StringProperty()
pipedreamcommand=StringProperty()
priority=StringProperty()
useruuid=StringProperty()
userUuid=StringProperty(unique_index=True, default=uuid4)
pipedreamCommand=StringProperty()
priority=IntegerProperty()
# Relationships
has_rsf=RelationshipTo(RefelctionStructureFactors, 'HAS')
......@@ -27,9 +34,9 @@ class OCF(StructuredNode):
return {
'node_properties': {
'uuid': self.uuid,
'userUuid': self.userUuid,
'name': self.name,
'pipedreamCommand': self.pipedreamcommand,
'pipedreamCommand': self.pipedreamCommand,
'priority': self.priority,
'useruuid': self.useruuid,
},
}
\ No newline at end of file
......@@ -4,9 +4,9 @@ from uuid import uuid4
class StorageHost(StructuredNode):
ip=StringProperty()
uuid=StringProperty(unique_index=True, default=uuid4)
hostname=StringProperty()
friendlyname=StringProperty()
workingdirectory=StringProperty()
hostName=StringProperty()
friendlyName=StringProperty()
workingDirectory=StringProperty()
@property
def serialize(self):
......@@ -17,10 +17,10 @@ class StorageHost(StructuredNode):
return {
'node_properties': {
'ip': self.name,
'ip': self.ip,
'uuid': self.uuid,
'hostname': self.sh_files,
'friendlyname': self.sh_files_number,
'workingdirectory': self.workingdirectory,
'hostName': self.hostName,
'friendlyName': self.friendlyName,
'workingDirectory': self.workingDirectory,
},
}
\ No newline at end of file
......@@ -5,14 +5,12 @@ class User(StructuredNode):
# Properties
uuid=StringProperty(unique_index=True, default=uuid4)
name=StringProperty()
@property
def serialize(self):
return {
'node_properties': {
'uuid': self.uuid,
'name': self.name,
'uuid': self.uuid
},
}
......
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