class Mission(RelatedEntity): model_name = 'designsafe.project.field_recon.mission' title = fields.CharField('Title', max_length=1024) date_start = fields.CharField('Date Start', max_length=1024, default='') date_end = fields.CharField('Date End', max_length=1024, default='') location = fields.CharField('Site Location', max_length=1024) latitude = fields.CharField('Location Latitude', max_length=1024) longitude = fields.CharField('Location Longitude', max_length=1024) elevation = fields.CharField('Location Elevation', max_length=1024) authors = fields.ListField('Authors') description = fields.CharField('Description', max_length=1024, default='') project = fields.RelatedObjectField(FieldReconProject)
class SocialScience(RelatedEntity): model_name = 'designsafe.project.field_recon.social_science' title = fields.CharField('Title', max_length=1024) unit = fields.CharField('Unit of Analysis', max_length=1024) modes = fields.ListField('Modes of Collection') sample_approach = fields.ListField('Sampling Approaches') sample_size = fields.CharField('Sampling Size', max_length=1024) date_start = fields.CharField('Date Start', max_length=1024, default='') date_end = fields.CharField('Date End', max_length=1024, default='') data_collectors = fields.ListField('Data Collectors') location = fields.CharField('Site Location', max_length=1024) latitude = fields.CharField('Location Latitude', max_length=1024) longitude = fields.CharField('Location Longitude', max_length=1024) equipment = fields.ListField('Equipment', list_cls=Equipment) restriction = fields.CharField('Restriction', max_length=1024) referenced_data = fields.ListField('Reference Data', list_cls=ReferencedData) description = fields.CharField('Description', max_length=1024, default='') project = fields.RelatedObjectField(FieldReconProject) missions = fields.RelatedObjectField(Mission) files = fields.RelatedObjectField(FileModel, multiple=True) file_tags = fields.ListField('File Tags', list_cls=DataTag)
class Experiment(RelatedEntity): model_name = 'designsafe.project.experiment' experiment_type = fields.CharField('Experiment Type', max_length=255, default='other') experiment_type_other = fields.CharField('Experiment Type Other', max_length=255, default='') description = fields.CharField('Description', max_length=1024, default='') title = fields.CharField('Title', max_length=1024) experimental_facility = fields.CharField('Experimental Facility', max_length=1024) experimental_facility_other = fields.CharField('Experimental Facility Other', max_length=1024) equipment_type = fields.CharField('Equipment Type') equipment_type_other = fields.CharField('Equipment Type Other') procedure_start = fields.CharField('Procedure Start', max_length=1024, default='') procedure_end = fields.CharField('Procedure End', max_length=1024, default='') authors = fields.ListField('Authors') project = fields.RelatedObjectField(ExperimentalProject) dois = fields.ListField('Dois') def to_datacite_json(self): """Serialize object to datacite JSON.""" attributes = super(Experiment, self).to_datacite_json() attributes["subjects"] = attributes.get("subjects", []) + [ {"subject": self.experimental_facility.title(), } ] attributes["contributors"] = attributes.get("contributors", []) + [ { "contributorType": "HostingInstitution", "nameType": "Organizational", "name": self.experimental_facility, } ] attributes['types']['resourceType'] = "Experiment/{experiment_type}".format( experiment_type=self.experiment_type.title() ) return attributes def to_dataset_json(self): """Serialize object to dataset JSON.""" attributes = super(Experiment, self).to_dataset_json() attributes["subjects"] = attributes.get("subjects", []) + [ {"subject": self.experimental_facility.title(), } ] attributes["contributors"] = attributes.get("contributors", []) + [ { "contributorType": "HostingInstitution", "nameType": "Organizational", "name": self.experimental_facility, } ] attributes['types']['resourceType'] = "Experiment/{experiment_type}".format( experiment_type=self.experiment_type.title() ) return attributes
class HybridSimulation(RelatedEntity): model_name = 'designsafe.project.hybrid_simulation' title = fields.CharField('Title', max_length=1024) simulation_type = fields.CharField('Simulation Type', max_length=1024) simulation_type_other = fields.CharField( 'Simulation Type Other', max_length=1024 ) description = fields.CharField( 'Description', max_length=1024, default='' ) authors = fields.ListField('Authors') project = fields.RelatedObjectField(HybridSimulationProject)
class Event(RelatedEntity): model_name = 'designsafe.project.event' event_type = fields.CharField('Event Type', max_length=255, default='other') title = fields.CharField('Title', max_length=1024) description = fields.CharField('Description', max_length=1024, default='') analysis = fields.RelatedObjectField(Analysis) project = fields.RelatedObjectField(ExperimentalProject) experiments = fields.RelatedObjectField(Experiment) model_configs = fields.RelatedObjectField(ModelConfig) sensor_lists = fields.RelatedObjectField(SensorList) files = fields.RelatedObjectField(FileModel, multiple=True) file_tags = fields.ListField('File Tags', list_cls=DataTag)
class Experiment(RelatedEntity): model_name = 'designsafe.project.experiment' experiment_type = fields.CharField('Experiment Type', max_length=255, default='other') experiment_type_other = fields.CharField('Experiment Type Other', max_length=255, default='') description = fields.CharField('Description', max_length=1024, default='') title = fields.CharField('Title', max_length=1024) experimental_facility = fields.CharField('Experimental Facility', max_length=1024) experimental_facility_other = fields.CharField( 'Experimental Facility Other', max_length=1024) equipment_type = fields.CharField('Equipment Type') equipment_type_other = fields.CharField('Equipment Type Other') authors = fields.ListField('Authors') project = fields.RelatedObjectField(ExperimentalProject)
class Mission(RelatedEntity): model_name = 'designsafe.project.field_recon.mission' title = fields.CharField('Title', max_length=1024) date_start = fields.CharField('Date Start', max_length=1024, default='') date_end = fields.CharField('Date End', max_length=1024, default='') location = fields.CharField('Site Location', max_length=1024) latitude = fields.CharField('Location Latitude', max_length=1024) longitude = fields.CharField('Location Longitude', max_length=1024) elevation = fields.CharField('Location Elevation', max_length=1024) authors = fields.ListField('Authors') description = fields.CharField('Description', max_length=1024, default='') project = fields.RelatedObjectField(FieldReconProject) dois = fields.ListField('Dois') def to_datacite_json(self): """Serialize object to datacite JSON.""" attributes = super(Mission, self).to_datacite_json() attributes['types']['resourceType'] = "Mission/{location}".format( location=self.location.title()) return attributes
class HybridSimulation(RelatedEntity): model_name = 'designsafe.project.hybrid_simulation' title = fields.CharField('Title', max_length=1024) simulation_type = fields.CharField('Simulation Type', max_length=1024) simulation_type_other = fields.CharField('Simulation Type Other', max_length=1024) description = fields.CharField('Description', max_length=1024, default='') authors = fields.ListField('Authors') project = fields.RelatedObjectField(HybridSimulationProject) dois = fields.ListField('Dois') def to_datacite_json(self): """Serialize object to datacite JSON.""" attributes = super(HybridSimulation, self).to_datacite_json() if self.simulation_type_other: attributes['types'][ 'resourceType'] = "Simulation/{simulation_type}".format( simulation_type=self.simulation_type_other.title()) else: attributes['types'][ 'resourceType'] = "Simulation/{simulation_type}".format( simulation_type=self.simulation_type.title()) return attributes
class FileModel(MetadataModel): model_name = 'designsafe.file' keywords = fields.ListField('Keywords') project_UUID = fields.RelatedObjectField(HybridSimulationProject, default=[])
class DataTag(MetadataModel): _is_nested = True file = fields.RelatedObjectField(FileModel, default=[]) desc = fields.CharField('Description', max_length=512, default='')
class FileModel(MetadataModel): model_name = 'designsafe.file' keywords = fields.ListField('Keywords') project_UUID = fields.RelatedObjectField(ExperimentalProject, default=[])