class GroupSpaceIndex(base.ATCTContent):
    '''A group space'''
    implements(IGroupSpaceIndex)
    schema = GroupSpaceIndexSchema
    portal_type = 'Group Space Index'
    chair = atapi.ATReferenceFieldProperty('chair')
    coChair = atapi.ATReferenceFieldProperty('coChair')
    description = atapi.ATFieldProperty('description')
    members = atapi.ATReferenceFieldProperty('members')
    title = atapi.ATFieldProperty('title')
Beispiel #2
0
class BiomarkerPanel(Biomarker):
    '''Biomarker panel.'''
    implements(IBiomarkerPanel)
    schema = BiomarkerPanelSchema
    portal_type = 'Biomarker Panel'
    members = atapi.ATReferenceFieldProperty('members')
    qaState = atapi.ATFieldProperty('qaState')
class BiomarkerBodySystem(ATFolder, KnowledgeObject):
    '''Biomarker body system.'''
    implements(IBiomarkerBodySystem)
    schema             = BiomarkerBodySystemSchema
    portal_type        = 'Biomarker Body System'
    bodySystem         = atapi.ATReferenceFieldProperty('bodySystem')
    phase              = atapi.ATFieldProperty('phase')
    protocols          = atapi.ATReferenceFieldProperty('protocols')
    publications       = atapi.ATReferenceFieldProperty('publications')
    qaState            = atapi.ATFieldProperty('qaState')
    resources          = atapi.ATReferenceFieldProperty('resources')
    datasets           = atapi.ATReferenceFieldProperty('datasets')
    description        = atapi.ATFieldProperty('description')
    performanceComment = atapi.ATFieldProperty('performanceComment')
    cliaCertification  = atapi.ATFieldProperty('cliaCertification')
    fdaCertification   = atapi.ATFieldProperty('fdaCertification')
Beispiel #4
0
class TokenRoleMailerAdapter(FormMailerAdapter):
    """Token role mailer adapter"""
    implements(ITokenRoleMailerAdapter)

    meta_type = "TokenRoleMailerAdapter"
    content_icon = 'mailaction.gif'
    schema = TokenRoleMailerAdapterSchema

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')

    security = ClassSecurityInfo()

    # -*- Your ATSchema to Python Property Bridges Here ... -*-
    private_doc = atapi.ATReferenceFieldProperty('private_doc')

    minutes = atapi.ATFieldProperty('minutes')

    security.declarePrivate('onSuccess')

    def onSuccess(self, fields, REQUEST=None):
        """
           e-mails data.
        """

        REQUEST['form.widgets.token_id'] = self.generate_token()
        super(TokenRoleMailerAdapter, self).onSuccess(fields, REQUEST)

    security.declarePrivate('_dreplace')

    def _dreplace(self, s):
        form = getattr(self.REQUEST, 'form', {})
        if form and self.REQUEST.get('form.widgets.token_id'):
            form['TOKEN_URL'] = self.REQUEST.get('form.widgets.token_id')
        return dollarReplace.DollarVarReplacer(form).sub(s)

    def generate_token(self):
        """ Generate a new token """
        minutes = self.getMinutes()
        token_roles = ['Reader']
        private_doc = self.getPrivate_doc()
        if private_doc:
            token_id = make_uuid(private_doc.getId())
            token_end = datetime.datetime.now() + datetime.timedelta(
                minutes=minutes)

            private_doc.REQUEST.set('form.widgets.token_id', token_id)
            ITokenInfoSchema(private_doc).token_id = token_id
            ITokenInfoSchema(private_doc).token_end = token_end
            ITokenInfoSchema(private_doc).token_roles = token_roles
            return "%s?token=%s" % (private_doc.absolute_url(), token_id)

    def startupDirectoryMethod(self):
        return "/".join(self.getPhysicalPath()[:-2])
class Group(base.ATCTContent):
    """Let you have several persons together"""
    implements(IGroup)

    portal_type = "Group"
    schema = GroupSchema

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')
    # -*- Your ATSchema to Python Property Bridges Here ... -*-
    persons = atapi.ATReferenceFieldProperty('persons')
Beispiel #6
0
class HomeBox(folder.ATFolder):
    """Description of the Example Type"""
    implements(IHomeBox)

    meta_type = "HomeBox"
    schema = HomeBoxSchema

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')

    text = atapi.ATFieldProperty('text')
    style = atapi.ATFieldProperty('style')
    resource = atapi.ATReferenceFieldProperty('resource')
    appearance = atapi.ATFieldProperty('appearance')
    width = atapi.ATFieldProperty('width')
    height = atapi.ATFieldProperty('height')
    showControls = atapi.ATFieldProperty('showControls')
Beispiel #7
0
class BodySystemStudy(ATFolder, KnowledgeObject):
    '''Body system study.'''
    implements(IBodySystemStudy)
    schema = BodySystemStudySchema
    portal_type = 'Body System Study'
    protocol = atapi.ATReferenceFieldProperty('protocol')
    protocols = atapi.ATReferenceFieldProperty('protocols')
    publications = atapi.ATReferenceFieldProperty('publications')
    resources = atapi.ATReferenceFieldProperty('resources')
    datasets = atapi.ATReferenceFieldProperty('datasets')
    study = atapi.ATReferenceFieldProperty('study')
    decisionRule = atapi.ATFieldProperty('decisionRule')
Beispiel #8
0
class SCALDS(base.ATCTContent):
    """Interface to the SCALDS Model."""
    implements(ISCALDS, IModel)

    meta_type = "SCALDS"
    schema = SCALDSSchema
    security = ClassSecurityInfo()

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')

    # -*- Your ATSchema to Python Property Bridges Here ... -*-
    template = atapi.ATReferenceFieldProperty('template')

    scenario = atapi.ATReferenceFieldProperty('scenario')

    vmt = atapi.ATReferenceFieldProperty('vmt')

    water = atapi.ATReferenceFieldProperty('water')

    end_time = atapi.ATFieldProperty('end_time')

    start_time = atapi.ATFieldProperty('start_time')

    runstatus = atapi.ATFieldProperty('runstatus')

    security.declarePublic('requeue')

    def requeue(self):
        """simple method to requeue the scenario"""
        self.runstatus = 'queued'
        self.reindexObject([
            'runstatus',
        ])
        return "requeue"

    security.declarePublic('end_run')

    def end_run(self):
        """Mark the run as complete, set the end time, and set default
        page to summary.  

        NEEDS WORK -- should set the endtime field, should set the
        default page to the summary doc, should pass an arg that
        selects 'complete' or 'terminated'.
        """
        self.runstatus = 'complete'
        self.reindexObject([
            'runstatus',
        ])

        #self.setDefaultPage(obj)
        return

    security.declarePublic('getConfig')

    def getConfig(self):
        """Returns the cconfiguration necessary for running the model"""
        #import pdb; pdb.set_trace()

        model = Element('model')
        tree = SubElement(model, 'scenario')
        SubElement(tree, 'id').text = self.id
        SubElement(tree, 'title').text = self.title
        SubElement(tree, 'repository').text = \
            'http://svn.leamgroup.com/desktop/ccrpc_scalds/trunk'
        SubElement(tree, 'cmdline').text = \
            'python startup -c config.xml'

        el = SubElement(tree, 'template')
        SubElement(el, 'title').text = self.getTemplate().title
        SubElement(el, 'download').text = self.getTemplate().absolute_url() + \
                '/at_download/file'

        el = SubElement(tree, 'scenario')
        SubElement(el, 'title').text = self.getScenario().title
        SubElement(el, 'url').text = self.getScenario().absolute_url()
        SubElement(el, 'config').text = self.getScenario().absolute_url() + \
                '/getConfig'

        el = SubElement(tree, 'vmt')
        SubElement(el, 'title').text = self.getVmt().title
        SubElement(el, 'download').text = self.getVmt().absolute_url() + \
                '/at_download/simImage'

        el = SubElement(tree, 'water')
        SubElement(el, 'title').text = self.getWater().title
        SubElement(el, 'download').text = self.getWater().absolute_url() + \
                '/at_download/simImage'

        self.REQUEST.RESPONSE.setHeader('Content-Type',
                                        'application/xml; charset=UTF-8')
        self.REQUEST.RESPONSE.setHeader(
            'Content-Disposition', 'attachment; filename="%s.xml"' % self.id)
        return tostring(model, encoding='UTF-8')
class SmartLink(ATLink):
    """A link to an internal or external resource."""
    interface.implements(ISmartLink, IImageContent)

    meta_type = "ATLink"
    schema = LinkSchema

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')
    internalLink = atapi.ATReferenceFieldProperty('internalLink')

    security = ClassSecurityInfo()

    security.declareProtected(permissions.View, 'size')

    def size(self):
        """Get size of the content
        """
        return self.get_size()

    security.declareProtected(permissions.View, 'get_size')

    def get_size(self):
        """ZMI / Plone get size method
        Size is given from the sum of the two image field
        """
        size = 0
        f = self.getField('image')
        if f is not None:
            size += f.get_size(self)
        f = self.getField('favicon')
        if f is not None:
            size += f.get_size(self)
        return size

    security.declareProtected(permissions.View, 'tag')

    def tag(self, **kwargs):
        """Generate image tag using the api of the ImageField
        """
        if 'title' not in kwargs:
            kwargs['title'] = self.getImageCaption()
        return self.getField('image').tag(self, **kwargs)

    def __bobo_traverse__(self, REQUEST, name):
        """Transparent access to image scales
        """
        if name.startswith('image'):
            field = self.getField('image')
            image = None
            if name == 'image':
                image = field.getScale(self)
            else:
                scalename = name[len('image_'):]
                if scalename in field.getAvailableSizes(self):
                    image = field.getScale(self, scale=scalename)
            if image is not None and not isinstance(image, basestring):
                # image might be None or '' for empty images
                return image
        elif name == 'favicon':
            field = self.getField('favicon')
            image = field.getScale(self)
            if image is not None and not isinstance(image, basestring):
                # image might be None or '' for empty images
                return image

        return ATLink.__bobo_traverse__(self, REQUEST, name)

    security.declareProtected(permissions.ModifyPortalContent,
                              'setExternalLink')

    def setExternalLink(self, value, **kwargs):
        """remote url mutator
        Use urlparse to sanify the url
        Also see http://dev.plone.org/plone/ticket/3296
        """
        if value:
            value = urlparse.urlunparse(urlparse.urlparse(value))
        self.getField('externalLink').set(self, value, **kwargs)
        self.setRemoteUrl(self.getRemoteUrl())

    security.declareProtected(permissions.ModifyPortalContent,
                              'setInternalLink')

    def setInternalLink(self, value, **kwargs):
        self.getField('internalLink').set(self, value, **kwargs)
        self.setRemoteUrl(self.getRemoteUrl())

    security.declareProtected(permissions.View, 'getRemoteUrl')

    def getRemoteUrl(self):
        """Return the URL of the link from the appropriate field, internal or external."""
        # We need to check if the self object has the reference_catalog attribute.
        # It's an integration problem with p4a that call this method when we don't have an internal link.
        if hasattr(self, 'reference_catalog'):
            ilink = self.getInternalLink()
        else:
            ilink = None

        # If we are using an internal link
        if ilink:
            anchor = self.getAnchor() or ''
            if anchor and not anchor.startswith("#"):
                anchor = '#' + anchor
            smartlink_config = queryUtility(ISmartlinkConfig,
                                            name="smartlink_config")
            if smartlink_config:
                if smartlink_config.relativelink:
                    object = self.getField('internalLink').get(self)
                    remote = '/'.join(object.getPhysicalPath())
                    return quote(remote + anchor, safe='?$#@/:=+;$,&%')
            remote = ilink.absolute_url() + anchor
        else:
            remote = self.getExternalLink()

        remote = getUtility(ILinkNormalizerUtility).toFrontEnd(remote)

        # If we still haven't remote value now, let's return the "normal" field value
        if not remote:
            remote = self.getField('remoteUrl').get(self)
        return quote(remote, safe='?$#@/:=+;$,&%')

    security.declarePrivate('cmf_edit')

    def cmf_edit(self, remote_url=None, **kwargs):
        if not remote_url:
            remote_url = kwargs.get('remote_url', None)
        self.update(externalLink=remote_url, **kwargs)

    security.declareProtected(permissions.View, 'post_validate')

    def post_validate(self, REQUEST, errors):
        """Check to make sure that either an internal or external link was supplied."""
        if not REQUEST.form.get('externalLink') and not REQUEST.form.get(
                'internalLink'):
            xlink = REQUEST.get('externalLink', None)
            ilink = REQUEST.get('internalLink', None)
            if (not xlink and not ilink):
                errors['externalLink'] = _(
                    "error_externallink_internallink_required",
                    default=
                    u'Please provide the external URL, or fill the "Internal link" field'
                )
                errors['internalLink'] = _(
                    "error_internallink_externallink_required",
                    default=
                    u'Please provide the internal link, or fill the "External link" field'
                )
            return errors
        if REQUEST.form.get('externalLink') and REQUEST.form.get(
                'internalLink'):
            errors['externalLink'] = _(
                "error_internallink_externallink_doubled",
                default=
                u'You must select an internal link or enter an external link. You cannot have both.'
            )
            return errors

    security.declarePrivate('_processForm')

    def _processForm(self, data=1, metadata=None, REQUEST=None, values=None):
        """BBB: I need to check old value before change it...
        I don't find a good place where to put this code. Zope3 events don't help me"""
        form = self.REQUEST.form
        target = self.getInternalLink()
        if target and target.UID() != form.get(
                'internalLink') and ISmartLinked.providedBy(target):
            interface.noLongerProvides(target, ISmartLinked)
        ATLink._processForm(self,
                            data=data,
                            metadata=metadata,
                            REQUEST=REQUEST,
                            values=values)

    security.declareProtected(permissions.View, 'getIcon')

    def getIcon(self, relative_to_portal=0):
        """If a favicon was provided, show it"""
        if not self.getFavicon():
            return ATLink.getIcon(self, relative_to_portal)

        utool = getToolByName(self, 'portal_url')
        if relative_to_portal:
            return self.absolute_url().replace(utool() + '/', "") + '/favicon'
        # Relative to REQUEST['BASEPATH1']
        res = utool(relative=1) + self.absolute_url().replace(utool(),
                                                              "") + '/favicon'
        while res[:1] == '/':
            res = res[1:]
        return res

    security.declareProtected(permissions.View, 'getInternalLinkPath')

    def getInternalLinkPath(self):
        """Get database path to the internally linked content"""
        ilink = self.getInternalLink()
        if ilink:
            return '/'.join(ilink.getPhysicalPath())
        if not ilink and not self.getExternalLink():
            # Try this way... this seems the only way to get the referenced object when we are deleting
            # No event will help us... neither OFS.interfaces.IObjectWillBeRemovedEvent
            portal_url = getToolByName(self, 'portal_url')
            internalPath = self.getRemoteUrl().replace(
                getUtility(ILinkNormalizerUtility).toFrontEnd(portal_url()),
                '')
            if not internalPath.startswith(
                    '/' + portal_url.getPortalObject().getId()):
                internalPath = '/' + portal_url.getPortalObject().getId(
                ) + internalPath
            return internalPath
        return None

    # Proxy data
    @property
    def proxy_enabled(self):
        """ Global check if proxy is enabled in the site """
        smartlink_config = queryUtility(ISmartlinkConfig,
                                        name="smartlink_config")
        if not smartlink_config:
            return False
        return getattr(smartlink_config, 'proxy_enabled', False)

    security.declarePrivate('check_proxy_status')

    def check_proxy_status(self):
        """ Returns True is we can proxy reference content's data """
        internal = self.getInternalLink()
        return internal and self.getInternalProxy() and self.proxy_enabled

    # Proxy data
    # NB: can't proxy title and description with property due to Archetypes internals  # noqa
    def Title(self):
        internal = self.getInternalLink()
        if internal and self.check_proxy_status():
            return internal.Title()
        return self.getField('title').get(self)

    def Description(self):
        internal = self.getInternalLink()
        if internal and self.check_proxy_status:
            return internal.Description()
        return self.getField('description').get(self)
Beispiel #10
0
class Contact(base.ATCTContent):
    """ Describe a contact.
    """
    implements(IContact)

    portal_type = "Contact"
    _at_rename_after_creation = True
    schema = ContactSchema

    title = atapi.ATFieldProperty('title')
    firstname = atapi.ATFieldProperty('firstname')
    lastname = atapi.ATFieldProperty('lastname')
    job_title = atapi.ATFieldProperty('job_title')
    organization = atapi.ATReferenceFieldProperty('organization')
    department = atapi.ATFieldProperty('department')
    address = atapi.ATFieldProperty('address')
    address_complement = atapi.ATFieldProperty('address_complement')
    postcode = atapi.ATFieldProperty('postcode')
    city = atapi.ATFieldProperty('city')
    country = atapi.ATFieldProperty('country')
    email = atapi.ATFieldProperty('email')
    website = atapi.ATFieldProperty('website')
    office_phone = atapi.ATFieldProperty('office_phone')
    mobile_phone = atapi.ATFieldProperty('mobile_phone')
    private_phone = atapi.ATFieldProperty('private_phone')
    fax_number = atapi.ATFieldProperty('fax_number')
    description = atapi.ATFieldProperty('description')

    def generateNewId(self):
        return self.id

    def Title(self):
        title = ('%s %s' % (
            self.getFirstname(),
            self.getLastname(),
        )).strip()
        if title:
            return title
        else:
            return "---"

    def setTitle(self, title):
        """
        Don't ever touch this method!!!
        It's existence prevent the parent's method to be called!
        """
        pass

    def Description(self):
        return ' '.join(
            [' / '.join([self.getOffice_phone(),
                         self.getEmail()])])

    def setDescription(self, description):
        """
        Don't ever touch this method!!!
        It's existence prevent the parent's method to be called!
        """
        pass

    def getOrganizationUID(self):
        return self.getOrganization().UID()

    def SearchableText(self):
        collec = []
        for name in ('firstname', 'lastname', 'job_title', 'organization',
                     'department', 'address', 'address_complement', 'city',
                     'country', 'email', 'website'):
            text = self.schema[name].get(self)
            if not isinstance(text, str):
                text = getattr(text, 'title', str(text))
            collec.append(text)
        return " ".join(collec)

    def sortable_title(self):
        return self.Title().lower()

    def directoryUID(self):
        return self.aq_inner.aq_parent.UID()
Beispiel #11
0
class Probmap(base.ATCTContent):
    """a Land Use Change probability map"""
    implements(IProbmap)

    meta_type = "Probmap"
    schema = ProbmapSchema
    security = ClassSecurityInfo()

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')

    # -*- Your ATSchema to Python Property Bridges Here ... -*-
    year = atapi.ATFieldProperty('year')

    roads = atapi.ATReferenceFieldProperty('roads')

    #transit = atapi.ATReferenceFieldProperty('transit')

    tdm = atapi.ATReferenceFieldProperty('tdm')

    trans_w = atapi.ATReferenceFieldProperty('trans_w')
    
    drivers = atapi.ATReferenceFieldProperty('drivers')

    nogrowth = atapi.ATReferenceFieldProperty('nogrowth')

    empcenters = atapi.ATReferenceFieldProperty('empcenters')
    
    emp_w = atapi.ATReferenceFieldProperty('emp_w')

    popcenters = atapi.ATReferenceFieldProperty('popcenters')
    
    pop_w = atapi.ATReferenceFieldProperty('pop_w')

    dem = atapi.ATReferenceFieldProperty('dem')

    landuse = atapi.ATReferenceFieldProperty('landuse')

    probview = atapi.ATReferenceFieldProperty('probview')

    probfile = atapi.ATFieldProperty('probfile')

    def _simmap(self, obj):
        """returns URL of the simImage download"""
        return obj.absolute_url() + '/at_download/simImage'

    security.declarePublic('getConfig')
    def getConfig(self):
        """Generate a configuration file for the Probmap"""
        #import pdb; pdb.set_trace()

        tree = Element('probmap')

        SubElement(tree, 'id').text = self.id
        SubElement(tree, 'title').text = self.title
        SubElement(tree, 'year').text = str(self.year)
        SubElement(tree, 'trans_w').text = str(self.trans_w)
        SubElement(tree, 'pop_w').text = str(self.pop_w)
        SubElement(tree, 'emp_w').text = str(self.emp_w)
        SubElement(tree, 'url').text = self.absolute_url()
        SubElement(tree, 'download').text = self.absolute_url() + \
            '/at_download/probfile'

        e = SubElement(tree, 'tdm')
        if self.tdm:
            e.text = self._simmap(self.tdm)

        e = SubElement(tree, 'roads')
        if self.roads:
            e.text = self._simmap(self.roads)

        e = SubElement(tree, 'drivers')
        for s in self.drivers:
            SubElement(e, 'driver').text = self._simmap(s)
        
        e = SubElement(tree, 'nogrowth_maps')
        for s in self.nogrowth:
            SubElement(e, 'nogrowth').text = self._simmap(s)
        
        e = SubElement(tree, 'empcenters')
        for s in self.empcenters:
            SubElement(e, 'empcenter').text = self._simmap(s)
        
        e = SubElement(tree, 'popcenters')
        for s in self.popcenters:
            SubElement(e, 'popcenter').text = self._simmap(s)

        e = SubElement(tree, 'landuse')
        if self.landuse:
            e.text = self._simmap(self.landuse)

        e = SubElement(tree, 'dem')
        if self.dem:
            e.text = self._simmap(self.dem)

        self.REQUEST.RESPONSE.setHeader('Content-Type',
            'application/xml;;charset=UTF-8')
        self.REQUEST.RESPONSE.setHeader('Content-Disposition',
            'attachment; filename="%s_probmap.xml"' % self.title)

        return tostring(tree, encoding='UTF-8')
Beispiel #12
0
class Person(base.ATCTContent):
    """Contact information of a person"""
    implements(IPerson)

    portal_type = 'Person'
    schema = PersonSchema

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')

    # -*- Your ATSchema to Python Property Bridges Here ... -*-
    shortName = atapi.ATFieldProperty('shortName')
    lastName = atapi.ATFieldProperty('lastName')
    firstName = atapi.ATFieldProperty('firstName')
    birthdate = atapi.ATFieldProperty('birthdate')
    organization = atapi.ATReferenceFieldProperty('organization')
    position = atapi.ATFieldProperty('position')
    department = atapi.ATFieldProperty('department')
    workPhone = atapi.ATFieldProperty('workPhone')
    workPhoneInternal = atapi.ATFieldProperty('workPhoneInternal')
    workMobilePhone = atapi.ATFieldProperty('workMobilePhone')
    workFax = atapi.ATFieldProperty('workFax')
    workEmail = atapi.ATFieldProperty('workEmail')
    workEmail2 = atapi.ATFieldProperty('workEmail2')
    workEmail3 = atapi.ATFieldProperty('workEmail3')
    photo = atapi.ATFieldProperty('photo')
    address = atapi.ATFieldProperty('address')
    country = atapi.ATFieldProperty('country')
    state = atapi.ATFieldProperty('state')
    city = atapi.ATFieldProperty('city')
    zip = atapi.ATFieldProperty('zip')
    phone = atapi.ATFieldProperty('phone')
    mobilePhone = atapi.ATFieldProperty('mobilePhone')
    email = atapi.ATFieldProperty('email')
    web = atapi.ATFieldProperty('web')
    text = atapi.ATFieldProperty('text')

    # deprecated properties
    short_name = DeprecatedATFieldProperty('shortName', 'short_name')
    last_name = DeprecatedATFieldProperty('lastName', 'last_name')
    first_name = DeprecatedATFieldProperty('firstName', 'first_name')
    work_phone = DeprecatedATFieldProperty('workPhone', 'work_phone')
    work_mobile_phone = DeprecatedATFieldProperty('workMobilePhone',
                                                  'work_mobile_phone')
    work_email = DeprecatedATFieldProperty('workEmail', 'work_email')
    work_email2 = DeprecatedATFieldProperty('workEmail2', 'work_email2')
    work_email3 = DeprecatedATFieldProperty('workEmail3', 'work_email3')
    mobile_phone = DeprecatedATFieldProperty('mobilePhone', 'mobile_phone')

    def _compute_title(self):
        """Compute title from last and first name"""
        names = []
        if self.lastName:
            names.append(self.lastName)
        if self.firstName:
            names.append(self.firstName)
        return safe_unicode(', '.join(names))

    def tag(self, **kwargs):
        """Generate image tag using the api of the ImageField
        """
        return self.getField('photo').tag(self, **kwargs)

    def __bobo_traverse__(self, REQUEST, name):
        """
        Transparent access to image scales.
        Taken from http://www.unc.edu/~jj/plone/#imagefieldscales
        """
        if name.startswith('photo'):
            field = self.getField('photo')
            image = None
            if name == 'photo':
                image = field.getScale(self)
            else:
                scalename = name[len('photo_'):]
                if scalename in field.getAvailableSizes(self):
                    image = field.getScale(self, scale=scalename)
            if image is not None and not isinstance(image, basestring):
                # image might be None or '' for empty images
                return image

        return super(Person, self).__bobo_traverse__(REQUEST, name)
Beispiel #13
0
class Protocol(folder.ATFolder, knowledgeobject.KnowledgeObject):
    '''Protocol.'''
    implements(IProtocol)
    schema = ProtocolSchema
    portal_type = 'Protocol'
    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')
    abstract = atapi.ATFieldProperty('abstract')
    involvedInvestigatorSites = atapi.ATReferenceFieldProperty(
        'involvedInvestigatorSites')
    coordinatingInvestigatorSite = atapi.ATReferenceFieldProperty(
        'coordinatingInvestigatorSite')
    leadInvestigatorSite = atapi.ATReferenceFieldProperty(
        'leadInvestigatorSite')
    bmName = atapi.ATFieldProperty('bmName')
    collaborativeGroupText = atapi.ATFieldProperty('collaborativeGroupText')
    phasedStatus = atapi.ATFieldProperty('phasedStatus')
    aims = atapi.ATFieldProperty('aims')
    analyticMethod = atapi.ATFieldProperty('analyticMethod')
    blinding = atapi.ATFieldProperty('blinding')
    cancerTypes = atapi.ATReferenceFieldProperty('cancerTypes')
    comments = atapi.ATFieldProperty('comments')
    dataSharingPlan = atapi.ATFieldProperty('dataSharingPlan')
    inSituDataSharingPlan = atapi.ATFieldProperty('inSituDataSharingPlan')
    startDate = atapi.ATFieldProperty('startDate')
    estimatedFinishDate = atapi.ATFieldProperty('estimatedFinishDate')
    finishDate = atapi.ATFieldProperty('finishDate')
    design = atapi.ATFieldProperty('design')
    fieldOfResearch = atapi.ATFieldProperty('fieldOfResearch')
    abbrevName = atapi.ATFieldProperty('abbrevName')
    objective = atapi.ATFieldProperty('objective')
    project = atapi.ATFieldProperty('project')
    protocolType = atapi.ATFieldProperty('protocolType')
    publications = atapi.ATReferenceFieldProperty('publications')
    outcome = atapi.ATFieldProperty('outcome')
    secureOutcome = atapi.ATFieldProperty('secureOutcome')
    plannedSampleSize = atapi.ATFieldProperty('plannedSampleSize')
    finalSampleSize = atapi.ATFieldProperty('finalSampleSize')
    isAPilotFor = atapi.ATReferenceFieldProperty('isAPilotFor')
    obtainsData = atapi.ATReferenceFieldProperty('obtainsData')
    providesData = atapi.ATReferenceFieldProperty('providesData')
    obtainsSpecimens = atapi.ATReferenceFieldProperty('obtainsSpecimens')
    providesSpecimens = atapi.ATReferenceFieldProperty('providesSpecimens')
    relatedProtocols = atapi.ATReferenceFieldProperty('relatedProtocols')
    animalSubjectTraining = atapi.ATFieldProperty('animalSubjectTraining')
    humanSubjectTraining = atapi.ATFieldProperty('humanSubjectTraining')
    irbApproval = atapi.ATFieldProperty('irbApproval')
    originalIRBApprovalDate = atapi.ATFieldProperty('originalIRBApprovalDate')
    currentIRBApprovalDate = atapi.ATFieldProperty('currentIRBApprovalDate')
    currentIRBExpirationDate = atapi.ATFieldProperty(
        'currentIRBExpirationDate')
    irbNotes = atapi.ATFieldProperty('irbNotes')
    irbNumber = atapi.ATFieldProperty('irbNumber')
    siteRoles = atapi.ATFieldProperty('siteRoles')
    reportingStage = atapi.ATFieldProperty('reportingStage')
    biomarkers = atapi.ATReferenceFieldProperty('biomarkers')
    datasets = atapi.ATReferenceFieldProperty('datasets')
    piName = atapi.ATFieldProperty('piName')
    datasetNames = atapi.ATFieldProperty('datasetNames')
    involvedInvestigatorUID = atapi.ATFieldProperty('involvedInvestigatorUID')
    involvedSiteNames = atapi.ATFieldProperty('involvedSiteNames')

    def _computePIName(self):
        if not self.leadInvestigatorSite:
            return None
        if not self.leadInvestigatorSite.principalInvestigator:
            return None
        return self.leadInvestigatorSite.principalInvestigator.title

    def _computeDatasetNames(self):
        if not self.datasets:
            return []
        return [i.title for i in self.datasets if i and i.title]

    def _computeInvolvedSiteNames(self):
        if not self.involvedInvestigatorSites:
            return []
        return [
            i.title for i in self.involvedInvestigatorSites if i and i.title
        ]

    def _computeDescription(self):
        # CA-580 order: abstract is most important; then objective, then aims, finally outcome.
        # If none of those have any text, punt.
        for fieldName in ('abstract', 'objective', 'aims', 'outcome'):
            value = getattr(self, fieldName, None)
            if value:
                filterer = MarkupFilterer()
                filterer.feed(safe_unicode(value))
                return filterer.getResult()
        return u''

    def _computePIUID(self):
        return self.leadInvestigatorSite is not None and self.leadInvestigatorSite.getPiUID(
        ) or None

    def _computeInvolvedSitePIUID(self):
        if not self.involvedInvestigatorSites:
            return None
        return [
            i.getPiUID() for i in self.involvedInvestigatorSites
            if i and i.getPiUID()
        ]
Beispiel #14
0
class StressAnalysis(base.ATCTContent):
    """Frontend to the LEAM Stress Analysis Model"""
    implements(IStressAnalysis, IModel)

    meta_type = "StressAnalysis"
    schema = StressAnalysisSchema
    security = ClassSecurityInfo()

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')

    # -*- Your ATSchema to Python Property Bridges Here ... -*-

    layer = atapi.ATReferenceFieldProperty('layer')

    scenario = atapi.ATReferenceFieldProperty('scenario')

    section = atapi.ATReferenceFieldProperty('section')

    runstatus = atapi.ATFieldProperty('runstatus')

    end_time = atapi.ATFieldProperty('end_time')

    start_time = atapi.ATFieldProperty('start_time')

    def checkDependencies(self):
        """Checks that all necessary impacts are ready for use."""
        pass

    security.declarePublic('requeue')

    def requeue(self):
        """simple method to requeue the scenario"""
        self.runstatus = 'queued'
        self.reindexObject([
            'runstatus',
        ])
        return "requeue"

    security.declarePublic('getConfig')

    def getConfig(self):
        """Generates a configuration file for this analysis."""

        model = Element('model')
        tree = SubElement(model, 'scenario')
        SubElement(tree, 'id').text = self.id
        SubElement(tree, 'title').text = self.title
        SubElement(tree, 'repository').text = \
            'http://datacenter.leamgroup.com/svn/desktop/ccrpc_sa/trunk'
        SubElement(tree, 'cmdline').text = \
            'python startup.py -c config.xml'

        for p in self.getLayer():
            reg = SubElement(tree, 'zonemap')
            SubElement(reg, 'title').text = p.title
            SubElement(reg, 'layer').text = p.absolute_url() + \
                    '/at_download/simImage'
        SubElement(tree, 'scenario').text = self.getScenario().absolute_url()
        SubElement(tree, 'section').text = ''

        self.REQUEST.RESPONSE.setHeader('Content-Type',
                                        'application/xml; charset=UTF-8')
        self.REQUEST.RESPONSE.setHeader(
            'Content-Disposition', 'attachment; filename="%s.xml"' % self.id)
        return tostring(model, encoding='UTF-8')
Beispiel #15
0
class Projection(base.ATCTContent):
    """A population and employment projection used within the LEAM model"""
    implements(IProjection)

    meta_type = "Projection"
    schema = ProjectionSchema
    security = ClassSecurityInfo()

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')

    # -*- Your ATSchema to Python Property Bridges Here ... -*-
    projection = atapi.ATFieldProperty('projection')

    zone = atapi.ATReferenceFieldProperty('zone')

    pop_density = atapi.ATReferenceFieldProperty('pop_density')

    emp_density = atapi.ATReferenceFieldProperty('emp_density')

    redevelopment = atapi.ATFieldProperty('redevelopment')

    security.declarePublic('config')

    def config(self):
        """return projection configuration"""

        url = self.absolute_url()
        p = self.getProjection()

        year = [rec['year'] for rec in p]
        pop = [rec['pop'] for rec in p]
        emp = [rec['emp'] for rec in p]

        r = {
            '@context': 'http://leamgroup.com/contexts/projections.jsonld',
            '@id': url,
            'title': self.title,
            'shortname': self.id,
            'startyear': p[0]['year'],
            'endyear': p[-1]['year'],
            'value': {
                'years': year,
                'population': pop,
                'employment': emp,
            },
            'zone': {
                '@id': self.zone.absolute_url(),
                '@type': 'simmap',
                'layer': self.zone.absolute_url() + '/at_download/simImage',
                'mapfile': self.zone.absolute_url() + '/at_download/mapFile',
            },

            # deprecated
            'graph': url + '/getGraph',
        }

        if self.pop_density:
            url = self.pop_density.absolute_url()
            r['pop_density'] = {
                '@id': url,
                '@type': 'simmap',
                'layer': url + '/at_download/simImage',
                'mapfile': url + '/at_download/mapFile',
            }

        if self.emp_density:
            url = self.emp_density.absolute_url()
            r['pop_density'] = {
                '@id': url,
                '@type': 'simmap',
                'layer': url + '/at_download/simImage',
                'mapfile': url + '/at_download/mapFile',
            }

        self.REQUEST.RESPONSE.setHeader('Content-type', 'application/json')
        return json.dumps(r)

    security.declarePublic('getConfig')

    def getConfig(self):
        """Generates a configuration file for this projection"""

        tree = Element('projection')

        SubElement(tree, 'id').text = self.id
        SubElement(tree, 'title').text = self.title
        SubElement(tree, 'startyear').text = self.getProjection()[0]['year']
        SubElement(tree, 'endyear').text = self.getProjection()[-1]['year']
        SubElement(tree, 'graph').text = self.absolute_url() + '/getGraph'
        SubElement(tree, 'layer').text = self.zone.absolute_url() + \
            '/at_download/simImage'
        SubElement(tree, 'redevelopment').text = str(self.redevelopment)

        e = SubElement(tree, 'pop_density')
        if self.pop_density:
            e.text = self.pop_density.absolute_url() + '/at_download/simImage'

        e = SubElement(tree, 'emp_density')
        if self.emp_density:
            e.text = self.emp_density.absolute_url() + '/at_download/simImage'

        self.REQUEST.RESPONSE.setHeader('Content-Type', 'text/plain')
        self.REQUEST.RESPONSE.setHeader(
            'Content-Disposition',
            'attachment; filename="%s_demand.xml"' % self.title)
        return tostring(tree, encoding='UTF-8')

    security.declarePublic('getGraph')

    def getGraph(self):
        """Generates a the projection in the LEAM land use models
        required format.
        """
        proj = StringIO()
        proj.write('# population and employment graph\n')
        proj.write('# title: %s\n' % self.title)
        proj.write('# url: %s\n' % self.absolute_url())
        proj.write('# spatial area: %s\n' % self.getZone().absolute_url())
        if self.pop_density:
            proj.write('# population density: %s\n' % \
                self.pop_density.absolute_url())
        if self.emp_density:
            proj.write('# employment density: %s\n\n' % \
                self.emp_density.absolute_url())

        proj.write('Population\n')
        for p in self.getProjection():
            proj.write('%s, %s\n' % (p['year'], p['pop'].replace(',', '')))

        proj.write('\nEmployment\n')
        for p in self.getProjection():
            proj.write('%s, %s\n' % (p['year'], p['emp'].replace(',', '')))

        # need to specify the encoding
        #self.REQUEST.RESPONSE.setHeader('Content-Type',
        #    'text/plain;;charset=UTF-8')
        self.REQUEST.RESPONSE.setHeader('Content-Type', 'text/plain')
        self.REQUEST.RESPONSE.setHeader(
            'Content-Disposition',
            'attachment; filename="%s_demand.txt"' % self.title)
        #return unicode(proj.getvalue())
        return proj.getvalue()

    security.declarePublic('getDecline')

    def getDecline(self):
        """Generates a the projection in the LEAM land use models
        required format normalized for decline.
        """
        proj = StringIO()
        proj.write('# population and employment graph\n')
        proj.write('# title: %s\n' % self.title)
        proj.write('# url: %s\n' % self.absolute_url())
        proj.write('# spatial area: %s\n' % self.getZone().absolute_url())
        if self.pop_density:
            proj.write('# population density: %s\n' % \
                self.pop_density.absolute_url())
        if self.emp_density:
            proj.write('# employment density: %s\n\n' % \
                self.emp_density.absolute_url())

        p = self.getProjection()[0]
        startpop = int(p['pop'].replace(',', ''))
        startemp = int(p['emp'].replace(',', ''))

        proj.write('Population\n')
        for p in self.getProjection():
            pop = int(p['pop'].replace(',', '')) - startpop
            if pop < 0:
                pop = -1 * pop
            else:
                pop = 0
            proj.write('%s, %d\n' % (p['year'], pop))

        proj.write('\nEmployment\n')
        for p in self.getProjection():
            emp = int(p['emp'].replace(',', '')) - startemp
            if emp < 0:
                emp = -1 * emp
            else:
                emp = 0
            proj.write('%s, %s\n' % (p['year'], emp))

        # need to specify the encoding
        #self.REQUEST.RESPONSE.setHeader('Content-Type',
        #    'text/plain;;charset=UTF-8')
        self.REQUEST.RESPONSE.setHeader('Content-Type', 'text/plain')
        self.REQUEST.RESPONSE.setHeader(
            'Content-Disposition',
            'attachment; filename="%s_demand.txt"' % self.title)
        #return unicode(proj.getvalue())
        return proj.getvalue()

    security.declarePublic('csv')

    def csv(self):
        """return the projection in 3-column CSV format"""
        proj = StringIO()
        proj.write('# population and employment projection\n')
        proj.write('# title: %s\n' % self.title)
        proj.write('# url: %s/csv\n' % self.absolute_url())

        for p in self.getProjection():
            proj.write(', '.join(
                (p['year'], p['pop'].replace(',',
                                             ''), p['emp'].replace(',', ''))))

        self.REQUEST.RESPONSE.setHeader('Content-Type', 'text/csv')
        self.REQUEST.RESPONSE.setHeader(
            'Content-Disposition',
            'attachment; filename="%s.csv"' % self.title)
        return proj.getvalue()
Beispiel #16
0
class LUCScenario(folder.ATFolder):
    """LEAM Land Use Change (LUC) Scenario"""
    implements(ILUCScenario, IModel)

    meta_type = "LUCScenario"
    schema = LUCScenarioSchema
    security = ClassSecurityInfo()

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')

    # -*- Your ATSchema to Python Property Bridges Here ... -*-
    end_time = atapi.ATFieldProperty('end_time')

    start_time = atapi.ATFieldProperty('start_time')

    runstatus = atapi.ATFieldProperty('runstatus')

    command = atapi.ATFieldProperty('command')

    growth = atapi.ATReferenceFieldProperty('growth')

    growthmap = atapi.ATReferenceFieldProperty('growthmap')

    decline = atapi.ATReferenceFieldProperty('decline')

    declinemap = atapi.ATReferenceFieldProperty('declinemap')

    def cmdline(self):
        url = self.absolute_url()
        cmd = api.portal.get_registry_record(
            'leam.luc.interfaces.settings.ILUCSettings.scenario_cmd')
        return cmd.format(id=self.id, url=url)

    def repository(self):
        url = self.absolute_url()
        repo = api.portal.get_registry_record(
            'leam.luc.interfaces.settings.ILUCSettings.scenario_repo')
        return repo.format(id=self.id, url=url)

    security.declarePublic('end_run')

    def end_run(self):
        """Mark the run as complete, set the end time, and set
           default page to summary.
           NEEDS WORK -- should set the endtime field, should set the
           default page to the summary doc, should pass an arg that 
           selects 'complete' or 'terminated'.
           
           more on setDefaultPage at https://svn.plone.org/svn/collective/CMFDynamicViewFTI/trunk/Products/CMFDynamicViewFTI/interfaces.py#L84
        """
        #import pdb; pdb.set_trace()
        self.runstatus = 'complete'
        self.reindexObject([
            'runstatus',
        ])

        #self.setDefaultPage(obj)
        return

    security.declarePublic('requeue')

    def requeue(self):
        """simple method to requeue the current scenario"""
        self.runstatus = 'queued'
        self.reindexObject([
            'runstatus',
        ])
        return "requeue"

    security.declarePublic('queue_post')

    def queue_post(self):
        """Create queued versions of any post-processing jobs found
        in the post-processing folder.

        Note: Is this the appropriate place for this funcntionality?
        How much model support logic should be in the interface code and 
        should this call be part of the API or triggered by a call
        to the model success API call and should it be called by the model
        directly, the jobserver, be Plone interface code?
        """
        #import pdb; pdb.set_trace()

        context = aq_inner(self)
        portal = api.portal.get()
        portal_path = '/'.join(portal.getPhysicalPath())

        # if a post-processing folder exists then delete contents
        if 'post-processing' in context:
            localpp = context.get('post-processing')
            for ids in localpp.keys():
                api.content.delete(obj=localpp[ids])

        # otherwise create post-processing folder
        else:
            localpp = api.content.create(type='Folder',
                                         title='Post Processing',
                                         container=context)

        # get the LUC post-processing folder
        # TODO: this path shouldn't be hard-coded
        pp_path = portal_path + '/luc/post-processing'
        pp = api.content.get(path=pp_path)
        for ids in pp.keys():
            api.content.copy(source=pp[ids], target=localpp)

        # update the variable in the newly created post-processing jobs
        intids = getUtility(IIntIds)
        scenario_id = intids.getId(context)
        for ids in localpp.keys():
            localpp[ids].scenario = RelationValue(scenario_id)
            localpp[ids].runstatus = 'queued'
            localpp[ids].reindexObject([
                'runstatus',
            ])

        return '%d jobs queued' % len(localpp.keys())

    security.declarePublic('config')

    def config(self):
        """return the scenario configuration"""
        #import pdb; pdb.set_trace()

        context = aq_inner(self)
        portal = api.portal.get()

        r = {
            '@context': 'http://leamgroup.com/contexts/scenario.jsonld',
            '@id': context.absolute_url(),
            'shortname': self.id,
            'title': context.title,
            'results': context.absolute_url(),
            'config': context.absolute_url()+'/config',

            'resources': {
                'grass': context.luc.resources.grass.absolute_url() \
                        + '/at_download/file',
                },

            'projections': [],
            'drivers': [],

            #deprecated
            'grass_loc': context.luc.resources.grass.absolute_url() \
                        + '/at_download/file',

            }

        for p in self.getGrowth():
            d = {
                '@id': p.absolute_url(),
                'config': p.absolute_url() + '/config',
                'mode': 'growth',
            }
            r['projections'].append(d)

        for p in self.getDecline():
            d = {
                '@id': p.absolute_url(),
                'config': p.absolute_url() + '/config',
                'mode': 'decline',
            }
            r['projections'].append(d)

        for p in self.getGrowthmap():
            d = {
                '@id': p.absolute_url(),
                'config': p.absolute_url() + '/getConfig',
                'cache': p.absolute_url() + '/at_download/probfile',
                'mode': 'growth',
            }
            r['drivers'].append(d)

        for p in self.getDeclinemap():
            d = {
                '@id': p.absolute_url(),
                'config': p.absolute_url() + '/getConfig',
                'cache': p.absolute_url() + '/at_download/probfile',
                'mode': 'decline',
            }
            r['drivers'].append(d)

        self.REQUEST.RESPONSE.setHeader("Content-type", "application/json")
        return json.dumps(r)

    security.declarePublic('getConfig')

    def getConfig(self):
        """Returns the configuration necessary for running the model"""
        #import pdb; pdb.set_trace()

        portal = api.portal.get()
        portal_url = portal.absolute_url()

        context = aq_inner(self)

        model = Element('model')
        tree = SubElement(model, 'scenario')
        SubElement(tree, 'id').text = context.id
        SubElement(tree, 'title').text = context.title
        SubElement(tree, 'portal').text = portal_url
        SubElement(tree, 'results').text = context.absolute_url()

        SubElement(tree, 'grass_loc').text = \
            context.luc.resources.grass.absolute_url() + '/at_download/file'

        # get the repository from registry
        registry = getUtility(IRegistry)
        settings = registry.forInterface(ILUCSettings)
        SubElement(tree, 'repository').text = settings.scenario_repo
        SubElement(tree, 'cmdline').text = settings.scenario_cmd

        # regions to be modeled
        reg = SubElement(tree, 'growth')
        for p in self.getGrowth():
            reg.append(fromstring(p.getConfig()))
        reg = SubElement(tree, 'growthmap')
        for p in self.getGrowthmap():
            reg.append(fromstring(p.getConfig()))

        reg = SubElement(tree, 'decline')
        for p in self.getDecline():
            reg.append(fromstring(p.getConfig()))
        reg = SubElement(tree, 'declinemap')
        for p in self.getDeclinemap():
            reg.append(fromstring(p.getConfig()))

        SubElement(tree, 'post-processing').text = context.absolute_url() + \
                '/queue_post'

        self.REQUEST.RESPONSE.setHeader('Content-Type',
                                        'application/xml;;charset=UTF-8')
        self.REQUEST.RESPONSE.setHeader(
            'Content-Disposition',
            'attachment; filename="%s_scenario.xml"' % self.title)
        return tostring(model, encoding='UTF-8')

    security.declarePublic('get_results')

    def get_results(self):
        """Returns the scenarios results to enable further processing"""

        #import pdb; pdb.set_trace()

        # context is the scenario object
        context = aq_inner(self)
        results = getattr(context, 'model-results', None)
        if results:
            url = context.absolute_url()
            d = dict(
                status=0,
                errmsg='',
                short_name=context.id,
                title=context.title,
                context=url,
                config=url + '/getConfig',
                results=url + '/at_download/file',
            )

        else:
            d = dict(
                status=1,
                errmsg='results not available',
                short_name=context.id,
                title=context.title,
                context=url,
            )

        self.REQUEST.RESPONSE.setHeader("Content-type", "application/json")
        return json.dumps(d)

    security.declarePublic('set_view')

    def set_view(self):
        """set the default content on scenario folder view"""

        #import pdb; pdb.set_trace()
        context = aq_inner(self)

        view_id = self.REQUEST.get('view_id', None)
        if not view_id:
            return "FAIL: view_id parameter required"

        view_obj = getattr(context, view_id, None)
        if not view_obj:
            return "FAIL: id %s not found in folder" % self

        context.default_page = view_id
        return "SUCCESS: default page = " + view_id
Beispiel #17
0
class Biomarker(ATFolder, knowledgeobject.KnowledgeObject):
    '''Biomarker.'''
    implements(IBiomarker)
    schema = BiomarkerSchema
    accessGroups = atapi.ATFieldProperty('accessGroups')
    biomarkerKind = atapi.ATFieldProperty('biomarkerKind')
    bmAliases = atapi.ATFieldProperty('bmAliases')
    description = atapi.ATFieldProperty('description')
    indicatedBodySystems = atapi.ATFieldProperty('indicatedBodySystems')
    protocols = atapi.ATReferenceFieldProperty('protocols')
    publications = atapi.ATReferenceFieldProperty('publications')
    resources = atapi.ATReferenceFieldProperty('resources')
    datasets = atapi.ATReferenceFieldProperty('datasets')
    shortName = atapi.ATFieldProperty('shortName')
    hgncName = atapi.ATFieldProperty('hgncName')
    geneName = atapi.ATFieldProperty('geneName')
    uniProtAC = atapi.ATFieldProperty('uniProtAC')
    mutCount = atapi.ATFieldProperty('mutCount')
    pmidCount = atapi.ATFieldProperty('pmidCount')
    cancerDOCount = atapi.ATFieldProperty('cancerDOCount')
    affProtFuncSiteCount = atapi.ATFieldProperty('affProtFuncSiteCount')
    reshgnc = atapi.ATFieldProperty('reshgnc')
    reskegg = atapi.ATFieldProperty('reskegg')
    resentrez = atapi.ATFieldProperty('resentrez')
    geoprofile = atapi.ATFieldProperty('geoprofile')
    geodataset = atapi.ATFieldProperty('geodataset')
    ressnp = atapi.ATFieldProperty('ressnp')
    gwasref = atapi.ATFieldProperty('gwasref')
    resgene = atapi.ATFieldProperty('resgene')
    generef = atapi.ATFieldProperty('generef')
    resuniprot = atapi.ATFieldProperty('resuniprot')
    proteinref = atapi.ATFieldProperty('proteinref')
    resfda = atapi.ATFieldProperty('resfda')
    resgenecard = atapi.ATFieldProperty('resgenecard')
    resensembl = atapi.ATFieldProperty('resensembl')
    resprobeid = atapi.ATFieldProperty('resprobeid')
    respdb = atapi.ATFieldProperty('respdb')
    respfam = atapi.ATFieldProperty('respfam')
    reskeggpathway = atapi.ATFieldProperty('reskeggpathway')
    reskeggpathwayname = atapi.ATFieldProperty('reskeggpathwayname')
    resgenename = atapi.ATFieldProperty('resgenename')
    resrnaseq = atapi.ATFieldProperty('resrnaseq')
    resentrezgene = atapi.ATFieldProperty('resentrezgene')
    restrembl = atapi.ATFieldProperty('restrembl')
    resbiosummary = atapi.ATFieldProperty('resbiosummary')
    piUIDs = atapi.ATFieldProperty('piUIDs')

    def _computeIndicatedBodySystems(self):
        return [i.capitalize() for i in self.objectIds()]

    def updatedIndicatedBodySystems(self):
        self.indicatedBodySystems = self._computeIndicatedBodySystems()

    def SearchableText(self):
        txt = super(Biomarker, self).SearchableText()
        certifications = ''
        for objID, obj in self.contentItems():
            if obj.cliaCertification:
                certifications += 'CLIA ' * 5
            if obj.fdaCertification:
                certifications += 'FDA ' * 20
        return certifications + txt