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.

authors : FIX THIS file_selection : dict

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.

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_type : str path : str directory_id : int size : int checksum : str experiments_count : int activities_count : int entities_count : int entity_states_count : int previous_versions_count : int directory : mcapi.File

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.

id : int uuid : str globus_endpoint_id : str globus_url : str globus_path : str state : str last_globus_transfer_id_completed : str latest_globus_transfer_completed_date : str project_id : int owner_id : int transfer_request_id : in created_at : str updated_at : str

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.

url : str

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.

activities : list of mcapi.Activity workflows : list of mcapi.Workflow experiments : list of mcapi.Experiment activities : list of mcapi.Activity entities : list of mcapi.Entity members : list of mcapi.User admins : list of mcapi.User root_dir : mcapi.File

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.

title : str url : str type : str “datasets” || “communities” item : mcapi.Dataset or mcapi.Community depending on what type is set to

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_id : str institution : str version : str last_updated_at : str first_deployed_at : str contact : str description : str name : str uuid : str

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.

id : int name : str slug : str created_at : str updated_at : str

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.

id : int uuid : str name : str email : str description : str affiliation : str created_at : str updated_at : str

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.