materials_commons.api.models module

class materials_commons.api.models.Activity(data={})[source]

Bases: materials_commons.api.models.Common

An activity represents a step that operates on one or more Entities. For example an Entity maybe have been heat treated. In that case an Activity representing the heat treatment step could be associated with the Entity. An activity may also have files associated with it. These may represent files produced by that activity. For example the images produced from running an SEM. All the files from the SEM will be associated with the activity. A subset of these files may be represented with an Entity that the SEM operated on.

entities: list of mcapi.Entity

The list of entities associated with this activity.

files: list of mcapi.File

The list of files associated with this activity.

static from_list(data)[source]
static from_list_attr(data, attr='activities')[source]
class materials_commons.api.models.Common(data)[source]

Bases: object

Base class for most models. Contains common attributes shared across most model objects.

idint

The id of the object.

uuidstr

The uuid of the object.

namestr

Name of model object.

descriptionstr

Description of the model instance, for example a description of a project.

summarystr

A short description suitable for display in a table.

owner_idint

The id of the owner of the model instance.

ownermcapi.Owner

The full owner model associated with the owner_id.

created_atstr

Formatted string datetime when the object was created. String format is “%Y-%m-%dT%H:%M:%S.%fZ”.

updated_atstr

Formatted string datetime when the object was last updated. String format is “%Y-%m-%dT%H:%M:%S.%fZ”.

project_idint

The project_id is an optional field that exists only if the underlying model has a project_id field. The project_id is the id of the project the object is associated with.

pretty_print()

Prints to stdout a formatted version of the object. This will recursively print sub-objects as well as iterate over lists of objects maintaining proper indenting. Private attributes are ignored.

pretty_print()[source]
class materials_commons.api.models.Community(data={})[source]

Bases: materials_commons.api.models.Common

Community represents a Materials Commons Community of Practice. A Community of Practice is place to gather similar published datasets together. In addition it contains links and files that are specific to a community. For example it may contain a link to a forum associated with the community, or a file with suggested naming conventions.

publicbool

A flag that is true if this community is public and viewable by anyone.

fileslist of mcapi.File

Files associated with the community.

links: list of mcapi.Link

Links associated with the community.

datasets: list of mcapi.Dataset

List of published datasets associated with the community.

static from_list(data)[source]
static from_list_attr(data, attr='communities')[source]
class materials_commons.api.models.Dataset(data={})[source]

Bases: materials_commons.api.models.Common

A dataset represents a collection of files, activities and entities, along with other meta data such as authors, papers, etc… that is meant to be shared as a whole. A dataset can be published, in which case the dataset is available to the public, and its associated files can be downloaded.

licensestr

The license (if any) associated with the dataset.

license_urlstr

The url of the license associated with the dataset. Currently licenses all come from Open Data Commons.

doistr

The DOI associated with the dataset.

authorsstr

A semi-colon separated string of the authors for the dataset.

file_selectiondict

The file_selection is a selection of files and directories to include/exclude in a dataset when it is published. The file_selection has the following fields (each field is a list): include_files, exclude_files, include_dirs, exclude_dirs.

zipfile_sizeint

If a zipfile was built for this dataset then this is the size of the zipfile in bytes.

zipfile_namestr

If a zipfile was build for this dataset then this is the name of the zipfile.

workflowslist of mcapi.Workflow

The list of workflows associated with the dataset.

experimentslist of mcapi.Experiment

The list of experiments associated with the dataset.

activities: list of mcapi.Activity

The list of activities included with the dataset.

entities: list of mcapi.Entity

The list of entities included with the dataset.

fileslist of mcapi.File

The list of files included with the dataset.

globus_pathstr

The globus path for using globus to access the dataset files.

globus_endpoint_idstr

The globus endpoint the dataset files are stored on.

workflows_countint

Count of workflows included with dataset.

activities_countint

Count of activities included with dataset.

entities_countint

Count of entities included with dataset.

comments_countint

Count of comments associated with dataset.

published_atstr

The date the dataset was published on.

tagslist of mcapi.Tag

The tags associated with the dataset.

root_dirmcapi.File

The root directory (/) for published datasets. Unpublished datasets do not have a root directory.

static from_list(data)[source]
static from_list_attr(data, attr='datasets')[source]
class materials_commons.api.models.Entity(data={})[source]

Bases: materials_commons.api.models.Common

An entity represent a virtual or physical specimen, sample or object. An entity is what is being measured or transformed. An example of an entity would be a sheet of metal that is be tested. That sheet might be heated (Activity), cut (Activity) then viewed on a SEM (Activity).

activities: list of mcapi.Activity

The list of activities associated with this entity.

files: list of mcapi.File

The list of files associated with this entity.

static from_list(data)[source]
static from_list_attr(data, attr='entities')[source]
class materials_commons.api.models.Experiment(data={})[source]

Bases: materials_commons.api.models.Common

An experiment is a container for entities, activities, and files.

workflowslist of mcapi.Workflow

The list of workflows used in the experiment.

activitieslist of mcapi.Activity

The list of activities used in the experiment.

entitieslist of mcapi.Entity

The list of entities used in the experiment.

fileslist of mcapi.File

The list of files used in the experiment.

static from_list(data)[source]
static from_list_attr(data, attr='experiments')[source]
class materials_commons.api.models.File(data={})[source]

Bases: materials_commons.api.models.Common

A file is an uploaded file associated with a project in Materials Commons.

mime_typestr

The mime_type. If File is a directory then mime_type will be set to ‘directory’.

pathstr

The path. This is set for directories and derived for files by checking if the directory is included, and if so updating the file path to be the directory path + the file name.

directory_idint

The id of the directory the file is in.

sizeint

The size of the file. Set to zero for directories.

checksumstr

The checksum of the file. None for directories.

experiments_countint

The number of experiments the file is in. None if file is for a published dataset or a directory.

activities_countint

The number of activities that include the file. None if a directory.

entities_countint

The number of entities that include the file. None if a directory.

entity_states_countint

The number of entity states that include the file. None if a directory.

previous_versions_countint

Number of previous file versions. None if a directory.

directorymcapi.File

The directory object for the file. If the file is the root directory then this will be set to None.

static from_list(data)[source]
static from_list_attr(data, attr='files')[source]
class materials_commons.api.models.GlobusDownload(data={})[source]

Bases: materials_commons.api.models.Common

static from_list(data)[source]
static from_list_attr(data, attr='globus_uploads')[source]
class materials_commons.api.models.GlobusTransfer(data={})[source]

Bases: object

A GlobusTransfer represents a started globus transfer, whether its an upload or a download.

idint

The id of the object.

uuidstr

The uuid of the object.

globus_endpoint_idstr

The globus endpoint id.

globus_urlstr

The url for the globus endpoint.

globus_pathstr

The globus path.

statestr

The state of the connection. One of ‘open’ (in use) or ‘closed’ (being cleaned up).

last_globus_transfer_id_completedstr

Currently not used.

latest_globus_transfer_completed_datestr

Currently not used.

project_idint

The id of the project this transfer is associated with.

owner_idint

The id of the user who started the transfer.

transfer_request_idid

The id of the transfer request associated with this globus transfer.

created_atstr

Formatted string datetime when the object was created. String format is “%Y-%m-%dT%H:%M:%S.%fZ”.

updated_atstr

Formatted string datetime when the object was last updated. String format is “%Y-%m-%dT%H:%M:%S.%fZ”.

static from_list(data)[source]
static from_list_attr(data, attr='globus_transfers')[source]
pretty_print()[source]
class materials_commons.api.models.GlobusUpload(data={})[source]

Bases: materials_commons.api.models.Common

static from_list(data)[source]
static from_list_attr(data, attr='globus_uploads')[source]

Bases: materials_commons.api.models.Common

A Link represents a URL.

urlstr

The url for the link.

static from_list(data)[source]
static from_list_attr(data, attr='links')[source]
class materials_commons.api.models.Project(data={})[source]

Bases: materials_commons.api.models.Common

A project is the top level object that stores files and meta data about your research project.

workflowslist of mcapi.Workflow

Workflows in the project.

experimentslist of mcapi.Experiment

Experiments in the project.

activitieslist of mcapi.Activity

Activities in the project.

entitieslist of mcapi.Entity

Entities in the project.

memberslist of mcapi.User

Project members.

adminslist of mcapi.User

Project administrators

root_dirmcapi.File

The root directory (/) of the project.

static from_list(data)[source]
static from_list_attr(data, attr='projects')[source]
class materials_commons.api.models.Searchable(data={})[source]

Bases: object

A searchable represents the results of a search.

titlestr

The title of the object (often the name).

urlstr

The url of the object.

typestr

The type of the object as a string - “datasets” || “communities”

itemmcapi.Dataset or mcapi.Community

Depending on what type field is set to the item will be one of the above types.

static from_list(data)[source]
pretty_print()[source]
class materials_commons.api.models.Server(data={})[source]

Bases: object

A Server contains information about the Materials Commons server hosting the API.

globus_endpoint_idstr

The globus endpoint id for the server.

institutionstr

The institution running this server instance.

versionstr

Current version of the site.

last_updated_atstr

The date the server was last updated.

first_deployed_atstr

The date the server was first deployed.

contactstr

Contact email for the server.

descriptionstr

A description of the server.

namestr

The name for this server instance.

uuidstr

A UUID that global identifies this server instance.

pretty_print()[source]
class materials_commons.api.models.Tag(data={})[source]

Bases: object

A tag is an attribute that can be added to different objects in the system. Currently only datasets support tags.

idint

The id of the tag object.

namestr

The name of the tag.

slugstr

The name as a slug.

created_atstr

Formatted string datetime when the object was created. String format is “%Y-%m-%dT%H:%M:%S.%fZ”.

updated_atstr

Formatted string datetime when the object was last updated. String format is “%Y-%m-%dT%H:%M:%S.%fZ”.

static from_list(data)[source]
static from_list_attr(data, attr='tags')[source]
pretty_print()[source]
class materials_commons.api.models.User(data={})[source]

Bases: object

A User represents a user account on Materials Commons.

idint

The id of the object.

uuidstr

The uuid of the object.

namestr

The users name.

emailstr

The users email address.

descriptionstr

The description the user entered about themselves.

affiliationstr

The affiliation the user entered.

created_atstr

Formatted string datetime when the object was created. String format is “%Y-%m-%dT%H:%M:%S.%fZ”.

updated_atstr

Formatted string datetime when the object was last updated. String format is “%Y-%m-%dT%H:%M:%S.%fZ”.

static from_list(data)[source]
static from_list_attr(data, attr='users')[source]
pretty_print()[source]
class materials_commons.api.models.Workflow(data={})[source]

Bases: materials_commons.api.models.Common

A workflow is a graphical and textual representation a user created for an experimental workflow.

static from_list(data)[source]
static from_list_attr(data, attr='workflows')[source]
materials_commons.api.models.from_list(cls, data)[source]
materials_commons.api.models.pretty_print(clas, indent=0)[source]

Prints to stdout a formatted version of the object. This will recursively print sub-objects as well as iterate over lists of objects maintaining proper indenting. Private attributes are ignored.