metadata_registration_api.api package¶
Submodules¶
metadata_registration_api.api.api_ctrl_voc module¶
-
class
metadata_registration_api.api.api_ctrl_voc.ApiControlledVocabulary(api=None, *args, **kwargs)¶ Bases:
flask_restx.resource.Resource-
delete(id, user=None)¶ Delete an entry given its unique identifier
-
get(id)¶ Fetch an entry given its unique identifier
-
methods= {'DELETE', 'GET', 'PUT'}¶
-
put(id, user=None)¶ Update an entry given its unique identifier
-
metadata_registration_api.api.api_form module¶
-
class
metadata_registration_api.api.api_form.ApiForm(api=None, *args, **kwargs)¶ Bases:
flask_restx.resource.Resource-
delete(id, user=None)¶ Delete an entry given its unique identifier
-
get(id)¶ Fetch an entry given its unique identifier
-
methods= {'DELETE', 'GET', 'PUT'}¶
-
put(id, user=None)¶ Update an entry given its unique identifier
-
-
class
metadata_registration_api.api.api_form.ArgsField(default=None, attribute=None, title=None, description=None, required=None, readonly=None, example=None, mask=None, **kwargs)¶ Bases:
flask_restx.fields.RawCustom field for args field. If the value contains a DataObject, it is modeled with the objects model
-
format(value)¶ Formats a field’s value. No-op by default - field classes that modify how the value of existing object keys should be presented should override this and apply the appropriate formatting.
- Parameters
value – The value to format
- Raises
MarshallingError – In case of formatting problem
Ex:
class TitleCase(Raw): def format(self, value): return unicode(value).title()
-
-
class
metadata_registration_api.api.api_form.SubformAddField(default=None, attribute=None, title=None, description=None, required=None, readonly=None, example=None, mask=None, **kwargs)¶ Bases:
flask_restx.fields.RawCustom field for subforms
-
format(value)¶ Formats a field’s value. No-op by default - field classes that modify how the value of existing object keys should be presented should override this and apply the appropriate formatting.
- Parameters
value – The value to format
- Raises
MarshallingError – In case of formatting problem
Ex:
class TitleCase(Raw): def format(self, value): return unicode(value).title()
-
-
class
metadata_registration_api.api.api_form.SubformField(default=None, attribute=None, title=None, description=None, required=None, readonly=None, example=None, mask=None, **kwargs)¶ Bases:
flask_restx.fields.RawCustom field for subforms
-
format(value)¶ Formats a field’s value. No-op by default - field classes that modify how the value of existing object keys should be presented should override this and apply the appropriate formatting.
- Parameters
value – The value to format
- Raises
MarshallingError – In case of formatting problem
Ex:
class TitleCase(Raw): def format(self, value): return unicode(value).title()
-
metadata_registration_api.api.api_props module¶
-
class
metadata_registration_api.api.api_props.ApiProperties(api=None, *args, **kwargs)¶ Bases:
flask_restx.resource.Resource-
delete(user=None)¶ Deprecates all entries
-
get()¶ Fetch a list with all entries
-
get_parser= <flask_restx.reqparse.RequestParser object>¶
-
methods= {'DELETE', 'GET', 'POST'}¶
-
post(user=None)¶ Add a new entry
The name has to be unique and is internally used as a variable name. The passed string is preprocessed before it is inserted into the database. Preprocessing: All characters are converted to lower case, the leading and trailing white spaces are removed, and intermediate white spaces are replaced with underscores (“_”).
Do not pass a unique identifier since it is generated internally.
synonyms (optional)
deprecated (default=False)
If a data type other than “cv” is added, the controlled_vocabullary is not considered.
-
-
class
metadata_registration_api.api.api_props.ApiProperty(api=None, *args, **kwargs)¶ Bases:
flask_restx.resource.Resource-
delete(id, user=None)¶ Deprecates an entry given its unique identifier
-
get(id)¶ Fetch an entry given its unique identifier
-
methods= {'DELETE', 'GET', 'PUT'}¶
-
put(id, user=None)¶ Update entry given its unique identifier
-
-
metadata_registration_api.api.api_props.validate_controlled_vocabulary(entry)¶
metadata_registration_api.api.api_study module¶
-
class
metadata_registration_api.api.api_study.ApiStudy(api=None, *args, **kwargs)¶ Bases:
flask_restx.resource.Resource-
delete(id, user=None)¶ Delete an entry given its unique identifier
-
get(id)¶ Fetch an entry given its unique identifier
-
methods= {'DELETE', 'GET', 'PUT'}¶
-
put(id, user=None)¶ Update an entry given its unique identifier
-
-
metadata_registration_api.api.api_study.validate_against_form(form_cls, form_name, entries)¶
metadata_registration_api.api.api_user module¶
-
class
metadata_registration_api.api.api_user.ApiUser(api=None, *args, **kwargs)¶ Bases:
flask_restx.resource.Resource-
delete(id, user=None)¶ Delete an entry given its unique identifier
-
get(id)¶ Fetch an entry given its unique identifier
-
methods= {'DELETE', 'GET', 'PUT'}¶
-
put(id, user=None)¶ Update an entry given its unique identifier
-
-
class
metadata_registration_api.api.api_user.Login(api=None, *args, **kwargs)¶ Bases:
flask_restx.resource.Resource-
methods= {'POST'}¶
-
post()¶ Fetch an access token to perform requests which require elevated privileges
Upon successful login, you receive an access token. Pass the token as value of ‘x-access-token’ in the header of every request that requires elevated privileges. The token is only valid for a certain time interval.
-
metadata_registration_api.api.api_utils module¶
-
class
metadata_registration_api.api.api_utils.ChangeLog(action: str, user_id: str, timestamp: datetime.datetime, manual_user: Union[str, NoneType] = None)¶ Bases:
object-
manual_user= None¶
-
to_dict()¶
-
-
class
metadata_registration_api.api.api_utils.MetaInformation(state: str, change_log=None)¶ Bases:
object-
add_log(log: metadata_registration_api.api.api_utils.ChangeLog)¶
-
to_json()¶
-
-
class
metadata_registration_api.api.api_utils.StudyEntry(value, identifier=None, name=None)¶ Bases:
objectHelper class to convert between the input and form format
The input format consists of a property id and a value. The form format consists of a name and a value. This class converts between the two formats.
The value supports several formats. It can contain a value or a list of entries.
- entry: {
prop: 123 value: abc
}
- entry: {
prop: 123 value: [{prop: 123, value: abc}, {prop: 123, value: abc}]
}
- entry: {
prop: 123 value: [{prop: 123, value: [{}, …]}, {prop: 123, value: [{}, …]}]
}
-
form_format()¶ Convert to a dictionary in form format
-
input_format()¶
-
set_id_by_name(map)¶ Set the identifier of the entry based on the name given in the map
-
set_name_by_id(map)¶ Set the name of the entry based on the identifier given in the map
-
metadata_registration_api.api.api_utils.json_entry_to_obj(entry_data, key_name, value_name)¶
-
metadata_registration_api.api.api_utils.json_input_to_form_format(json_data, mapper, key_name='property', value_name='value')¶ Convert json input format into form format.
The conversation is achieved through an object.
- Parameters
json_data –
mapper – dict with id as key and name as value
key_name –
value_name –
- Returns
dict with name as key and value in value