(domain)
return question_items
Return a dictionary of {(event, question): (study_event_oid, form_oid, item_group_oid, item_oid)}
Return a dictionary of {(event, question): (study_event_oid, form_oid, item_group_oid, item_oid)}
Return a dictionary of { ( event question ) : ( study_event_oid form_oid item_group_oid item_oid ) }
def get_question_items(domain):
    """
    Return a dictionary of {(event, question): (study_event_oid, form_oid, item_group_oid, item_oid)}
    """
    metadata_xml = get_study_metadata(domain)
    question_items = {}
    meta_e = metadata_xml.xpath('./odm:Study/odm:MetaDataVersion', namespaces=odm_nsmap)[0]
    for se_ref in meta_e.xpath('./odm:Protocol/odm:StudyEventRef', namespaces=odm_nsmap):
        se_oid = se_ref.get('StudyEventOID')
        for form_ref in meta_e.xpath('./odm:StudyEventDef[@OID="{}"]/odm:FormRef'.format(se_oid),
                                     namespaces=odm_nsmap):
            form_oid = form_ref.get('FormOID')
            for ig_ref in meta_e.xpath('./odm:FormDef[@OID="{}"]/odm:ItemGroupRef'.format(form_oid),
                                       namespaces=odm_nsmap):
                ig_oid = ig_ref.get('ItemGroupOID')
                for item_ref in meta_e.xpath('./odm:ItemGroupDef[@OID="{}"]/odm:ItemRef'.format(ig_oid),
                                             namespaces=odm_nsmap):
                    item_oid = item_ref.get('ItemOID')
                    event = se_oid.lower()
                    question = item_oid.lower()
                    question_items[(event, question)] = Item(se_oid, form_oid, ig_oid, item_oid)
    return question_items
def get_question_items ( domain ) : metadata_xml = get_study_metadata ( domain ) question_items = { } meta_e = metadata_xml . xpath ( './odm:Study/odm:MetaDataVersion' , namespaces = odm_nsmap ) [ 0 ] for se_ref in meta_e . xpath ( './odm:Protocol/odm:StudyEventRef' , namespaces = odm_nsmap ) : se_oid = se_ref . get ( 'StudyEventOID' ) for form_ref in meta_e . xpath ( './odm:StudyEventDef[@OID="{}"]/odm:FormRef' . format ( se_oid ) , namespaces = odm_nsmap ) : form_oid = form_ref . get ( 'FormOID' ) for ig_ref in meta_e . xpath ( './odm:FormDef[@OID="{}"]/odm:ItemGroupRef' . format ( form_oid ) , namespaces = odm_nsmap ) : ig_oid = ig_ref . get ( 'ItemGroupOID' ) for item_ref in meta_e . xpath ( './odm:ItemGroupDef[@OID="{}"]/odm:ItemRef' . format ( ig_oid ) , namespaces = odm_nsmap ) : item_oid = item_ref . get ( 'ItemOID' ) event = se_oid . lower ( ) question = item_oid . lower ( ) question_items [ ( event , question ) ] = Item ( se_oid , form_oid , ig_oid , item_oid ) return question_items