Skip to content
Snippets Groups Projects
datacollection_model.py 1 KiB
Newer Older
from neomodel import StructuredNode, StringProperty, IntegerProperty,UniqueIdProperty, RelationshipTo
root's avatar
root committed
from uuid import uuid4
root's avatar
root committed
from api.models.dataset_model import Dataset
root's avatar
root committed
class DataCollection(StructuredNode):
	uuid=StringProperty(unique_index=True, default=uuid4)
root's avatar
root committed
	imagesnumber=IntegerProperty()
	flux=IntegerProperty()
	resolution=StringProperty()
	wavelength=IntegerProperty()
	transmission=IntegerProperty()
	exposuretime=IntegerProperty()
	detectordistance=IntegerProperty()
	beamlinename=StringProperty()
root's avatar
root committed
	# Relationships
	generates=RelationshipTo(Dataset, 'GENERATES')
root's avatar
root committed
	@property
	def serialize(self):
root's avatar
root committed
		"""
		Serializer for node properties
		"""
		
		return {
			'node_properties': {
root's avatar
root committed
				"uuid": self.uuid,
				"imagesNumber": self.imagesnumber,
				"flux": self.flux,
				"resolution": self.resolution,
				"wavelength": self.wavelength,
				"transmission": self.transmission,
				"exposureTime": self.exposuretime,
				"detectorDistance": self.detectordistance ,
				"beamlineName": self.beamlinename,
root's avatar
root committed
			},
		}