Introduction
This service provides a project-based information store so that all other microservices can refer to it. Among other things, it determines which ports should be used when publishing data.
Explanation of the term research project
Due to the very high frequency of the term project in computer science and related services, we had to choose a different term within the RDS system to simplify communication between users and/or developers. That’s why we chose the term research project to refer to projects within the RDS system, which can be loosely translated into English as Research, so that we can always distinguish which project is meant in the dialog: either the research project in the RDS system or the project of an associated service. It also increases readability and clarifies the meaning of terms within this documentation and the RDS implementation enormously.
For example, it is clear which ID is involved if the API endpoint requires a research-id (rds internal project identifier) or a project-id (service-specific project identifier). Which project-id it is depends on the context, e.g. the port of the Zenodo service often requires a project-id, which is assigned specifically for Zenodo.
ER Diagram
The internal information model is presented in the following as a UML diagram, but should please be understood as an ER diagram.
classDiagram
class Port {
- String portName
- Bool fileStorage
- Bool metadataStorage
- Dict customProperty
}
class Project {
+ String user
+ Port portIn
+ Port portOut
}
class ProjectService {
+ Project projects
}
ProjectService "1" -- "0..n" Project : has
Project "1" -- "0..n" Port : has
OpenAPI v3
lib.Port
Port
Port(self,
portName,
fileStorage=False,
metadata=False,
customProperties: list = None)
setProperty
Port.setProperty(portType, value)
Returns True, if portType was found and set to value. Otherwise false.
portType has to be a string, value has to be boolean.
lib.Project
Project
Project(self,
user,
status=<Status.CREATED: 1>,
portIn=None,
portOut=None)
addPort
Project.addPort(port, portList)
Adds port (type Port
) to given portList.
removePort
Project.removePort(port, portList)
Remove port from portList.
Port can be int
as index or an object with type Port
.
nextStatus
Project.nextStatus()
Set the next status and returns the new value. It returns the same value, if you already at the last state.
setDone
Project.setDone()
Set the status of this project to done. If already done or deleted, then return False. Otherwise True.
lib.ProjectService
ProjectService
ProjectService(self, rc=None, use_in_memory_on_failure=True)
addProject
ProjectService.addProject(userOrProject, portIn=None, portOut=None)
If parameter `userOrProject is an project object, this method adds the given project to the storage.
If parameter userOrProject
is a string, it first creates an project object for you.
As a convenient parameter, you can set portIn and portOut also, which are used as parameters in project initialization.
getProject
ProjectService.getProject(user='',
researchIndex: int = None,
researchId: int = None)
This method returns all projects, if no parameters were set.
If the parameter user
is set, it returns all projects, which belongs to the user.
If the researchIndex
is set, it returns the corresponding project.
Beware: You start counting at Zero!
If you set the parameter user
and researchIndex
, it returns the project relative to all user specific projects.
Raises ValueError if parameter user
or researchIndex
are wrong types and IndexError, when you try to access lists and index is to big.
removeProject
ProjectService.removeProject(user: str = None,
researchIndex: int = None,
researchId: int = None)
This method removes the projects for given user.
If researchIndex was given, only the corresponding researchIndex will be removed (no user required, but it is faster). Returns True if it is successful or raise an exception if user or researchIndex not found. Else returns false.
getDict
ProjectService.getDict()
Returns a dict of all projects with a new attribute “id”, which symbolize the project researchIndex in the system.
removeUser
ProjectService.removeUser(user: str)
Removes user and all projects.
Args: user (str): The username, which should be removed.
Status
Status(cls, value, names=None, *, module, qualname, type, start)
The order represents the workflow through the states. So the successor of each status is the next in line.
CREATED
DELETED
DONE
WORK
NotFoundIDError
NotFoundIDError(self, user, id, msg=None)
NotFoundUserError
NotFoundUserError(self, user, id, msg=None)