How to use the rwslib.builders.modm.LastUpdateMixin function in rwslib

To help you get started, we’ve selected a few rwslib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mdsol / rwslib / rwslib / builders / admindata.py View on Github external
"""
        super(MetaDataVersionRef, self).__init__()
        self.study_oid = study_oid
        self.metadata_version_oid = metadata_version_oid
        self.effective_date = effective_date

    def build(self, builder):
        """Build XML by appending to builder"""
        params = dict(StudyOID=self.study_oid,
                      MetaDataVersionOID=self.metadata_version_oid,
                      EffectiveDate=dt_to_iso8601(self.effective_date))
        builder.start("MetaDataVersionRef", params)
        builder.end("MetaDataVersionRef")


class Location(ODMElement, LastUpdateMixin):
    """
    A physical location -- typically a clinical research site or a sponsor's office.
    """
    def __init__(self, oid, name,
                 location_type=None,
                 metadata_versions=None):
        """
        :param str oid: OID for the Location, referenced in :class:`LocationRef`
        :param str name: Name for the Location
        :param rwslib.builder_constants.LocationType location_type: Type for this Location
        :param list(MetaDataVersionRef) metadata_versions: The :class:`MetaDataVersionRef` for this Location
        """
        super(Location, self).__init__()
        self.oid = oid
        self.name = name
        self._location_type = None
github mdsol / rwslib / rwslib / builders / clinicaldata.py View on Github external
# -*- coding: utf-8 -*-

from rwslib.builders.common import ODMElement, TransactionalElement, bool_to_yes_no, dt_to_iso8601, VALID_ID_CHARS
from rwslib.builders.modm import LastUpdateMixin, MilestoneMixin
from rwslib.builders.metadata import MeasurementUnitRef
from rwslib.builders.constants import ProtocolDeviationStatus, QueryStatusType

from collections import OrderedDict
from datetime import datetime
import re


class ClinicalData(ODMElement, LastUpdateMixin):
    """Models the ODM ClinicalData object"""

    def __init__(self, projectname, environment, metadata_version_oid="1",
                 annotations=None):
        """
        :param projectname: Name of Project in Medidata Rave
        :param environment: Rave Study Enviroment
        :param metadata_version_oid: MetadataVersion OID
        """
        super(ClinicalData, self).__init__()
        self.projectname = projectname
        self.environment = environment
        self.metadata_version_oid = metadata_version_oid
        #: collection of :class:`SubjectData` for the ClinicalData Element
        self.subject_data = []
        self.annotations = annotations
github mdsol / rwslib / rwslib / builders / clinicaldata.py View on Github external
def __init__(self, oid):
        """
        :param str oid: OID for referenced :class:`Location`
        """
        self.oid = oid

    def build(self, builder):
        """
        Build XML by appending to builder
        """
        builder.start("LocationRef", dict(LocationOID=str(self.oid)))
        builder.end("LocationRef")


class SiteRef(ODMElement, LastUpdateMixin):
    """
    Reference to a :class:`Location`
    The default value is `SiteName`, and the value `SiteUUID` implies that the `LocationOID`
    .. note:: The `mdsol:LocationOIDType` attribute should be used to indicate the type of `LocationOID`
    """

    def __init__(self, oid):
        """
        :param str oid: OID for referenced :class:`Location`
        """
        self.oid = oid

    def build(self, builder):
        """
        Build XML by appending to builder
        """
github mdsol / rwslib / rwslib / builders / modm.py View on Github external
def mixin_params(self, params):
        """
        Add the mdsol:LastUpdateTime attribute
        :return: 
        """
        super(LastUpdateMixin, self).mixin_params(params)
        if self.last_update_time is not None:
            params.update({"mdsol:LastUpdateTime": self.last_update_time.isoformat()})