Skip to content

FormData

synapseclient.models.mixins.FormData dataclass

Represents a FormData object in Synapse.

Source code in synapseclient/models/mixins/form.py
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
@dataclass
class FormData:
    """
    Represents a FormData object in Synapse.
    """

    form_data_id: Optional[str] = None
    """The system issued identifier that uniquely identifies this object."""

    etag: Optional[str] = None
    """Will change whenever there is a change to this data or its status."""

    group_id: Optional[str] = None
    """The identifier of the group that manages this data. Required."""

    name: Optional[str] = None
    """User provided name for this submission. Required."""

    created_by: Optional[str] = None
    """Id of the user that created this object."""

    created_on: Optional[str] = None
    """The date this object was originally created."""

    modified_on: Optional[str] = None
    """The date this object was last modified."""

    data_file_handle_id: Optional[str] = None
    """The identifier of the data FileHandle for this object."""

    submission_status: Optional[FormSubmissionStatus] = None
    """The status of a submitted FormData object."""

    def fill_from_dict(self, synapse_response: dict[str, Any]) -> "FormData":
        """
        Converts a response from the REST API into this dataclass.

        Arguments:
            synapse_response: The response dictionary from the Synapse REST API.

        Returns:
            This FormData object with populated fields.
        """
        self.form_data_id = synapse_response.get("formDataId", None)
        self.etag = synapse_response.get("etag", None)
        self.group_id = synapse_response.get("groupId", None)
        self.name = synapse_response.get("name", None)
        self.created_by = synapse_response.get("createdBy", None)
        self.created_on = synapse_response.get("createdOn", None)
        self.modified_on = synapse_response.get("modifiedOn", None)
        self.data_file_handle_id = synapse_response.get("dataFileHandleId", None)

        if (
            "submissionStatus" in synapse_response
            and synapse_response["submissionStatus"] is not None
        ):
            self.submission_status = FormSubmissionStatus().fill_from_dict(
                synapse_response["submissionStatus"]
            )

        return self

Attributes

form_data_id class-attribute instance-attribute

form_data_id: Optional[str] = None

The system issued identifier that uniquely identifies this object.

etag class-attribute instance-attribute

etag: Optional[str] = None

Will change whenever there is a change to this data or its status.

group_id class-attribute instance-attribute

group_id: Optional[str] = None

The identifier of the group that manages this data. Required.

name class-attribute instance-attribute

name: Optional[str] = None

User provided name for this submission. Required.

created_by class-attribute instance-attribute

created_by: Optional[str] = None

Id of the user that created this object.

created_on class-attribute instance-attribute

created_on: Optional[str] = None

The date this object was originally created.

modified_on class-attribute instance-attribute

modified_on: Optional[str] = None

The date this object was last modified.

data_file_handle_id class-attribute instance-attribute

data_file_handle_id: Optional[str] = None

The identifier of the data FileHandle for this object.

submission_status class-attribute instance-attribute

submission_status: Optional[FormSubmissionStatus] = None

The status of a submitted FormData object.