(domain, name)
return func(metadata_xml)
Return the study metadata of the given name for the given domain
Return the study metadata of the given name for the given domain
Return the study metadata of the given name for the given domain
def get_study_constant(domain, name):
    """
    Return the study metadata of the given name for the given domain
    """
    xpath_text = lambda xml, xpath: xml.xpath(xpath, namespaces=odm_nsmap)[0].text
    xpath_xml = lambda xml, xpath: etree.tostring(xml.xpath(xpath, namespaces=odm_nsmap)[0], encoding='utf-8')
    func = {
        'study_oid': lambda xml: xml.xpath('./odm:Study', namespaces=odm_nsmap)[0].get('OID'),
        'study_name': lambda xml: xpath_text(xml, './odm:Study/odm:GlobalVariables/odm:StudyName'),
        'study_description': lambda xml: xpath_text(xml, './odm:Study/odm:GlobalVariables/odm:StudyDescription'),
        'protocol_name': lambda xml: xpath_text(xml, './odm:Study/odm:GlobalVariables/odm:ProtocolName'),
        'study_xml': lambda xml: xpath_xml(xml, './odm:Study'),
        'admin_data_xml': lambda xml: xpath_xml(xml, './odm:AdminData'),
    }[name]
    metadata_xml = get_study_metadata(domain)
    return func(metadata_xml)
def get_study_constant ( domain , name ) : xpath_text = lambda xml , xpath : xml . xpath ( xpath , namespaces = odm_nsmap ) [ 0 ] . text xpath_xml = lambda xml , xpath : etree . tostring ( xml . xpath ( xpath , namespaces = odm_nsmap ) [ 0 ] , encoding = 'utf-8' ) func = { 'study_oid' : lambda xml : xml . xpath ( './odm:Study' , namespaces = odm_nsmap ) [ 0 ] . get ( 'OID' ) , 'study_name' : lambda xml : xpath_text ( xml , './odm:Study/odm:GlobalVariables/odm:StudyName' ) , 'study_description' : lambda xml : xpath_text ( xml , './odm:Study/odm:GlobalVariables/odm:StudyDescription' ) , 'protocol_name' : lambda xml : xpath_text ( xml , './odm:Study/odm:GlobalVariables/odm:ProtocolName' ) , 'study_xml' : lambda xml : xpath_xml ( xml , './odm:Study' ) , 'admin_data_xml' : lambda xml : xpath_xml ( xml , './odm:AdminData' ) , } [ name ] metadata_xml = get_study_metadata ( domain ) return func ( metadata_xml )