# Path: collectors/cochrane_reviews/record.py
# class Record(base.Record):
#     table = 'cochrane_reviews'
# 
#     # Fields
# 
#     id = Text(primary_key=True)
#     study_id = Text()
#     file_name = Text()
#     study_type = Text()
#     doi_id = Text()
#     robs = Json()
#     refs = Json()


import uuid
    import xml.etree.ElementTree as etree
    from lxml import etree
from .record import Record
            'doi_id': doi_id,
            'file_name': review_file.name,
            'study_id': study.attrib['ID'],
            'study_type': study.attrib['DATA_SOURCE'],
            'refs': [],
        }
        corresponding_robs = [rob for rob in study_robs
                              if rob['study_id'] == study_info['study_id']]
        study_info['robs'] = corresponding_robs
        for reference in study.iter('REFERENCE'):
            ref = {
                'type': reference.attrib['TYPE'],
                'authors': reference.findtext('AU', ''),
                'title': reference.findtext('TI', ''),
                'source': reference.findtext('SO', ''),
                'year': reference.findtext('YR', ''),
                'vl': reference.findtext('VL', ''),
                'no': reference.findtext('NO', ''),
                'pg': reference.findtext('PG', ''),
                'country': reference.findtext('CY', ''),
                'identifiers': [],
            }
            for identifier in reference.iter('IDENTIFIER'):
                ident = {key.lower(): value for key, value in identifier.items()
                         if key not in ['MODIFIED', 'MODIFIED_BY']}
                ref['identifiers'].append(ident)
            study_info['refs'].append(ref)

        # Create record


# Path: collectors/cochrane_reviews/record.py
# class Record(base.Record):
#     table = 'cochrane_reviews'
# 
#     # Fields
# 
#     id = Text(primary_key=True)
#     study_id = Text()
#     file_name = Text()
#     study_type = Text()
#     doi_id = Text()
#     robs = Json()
#     refs = Json()


# Path: collectors/cochrane_reviews/parser.py
import uuid
    import xml.etree.ElementTree as etree
    from lxml import etree
from .record import Record

            'doi_id': doi_id,
            'file_name': review_file.name,
            'study_id': study.attrib['ID'],
            'study_type': study.attrib['DATA_SOURCE'],
            'refs': [],
        }
        corresponding_robs = [rob for rob in study_robs
                              if rob['study_id'] == study_info['study_id']]
        study_info['robs'] = corresponding_robs
        for reference in study.iter('REFERENCE'):
            ref = {
                'type': reference.attrib['TYPE'],
                'authors': reference.findtext('AU', ''),
                'title': reference.findtext('TI', ''),
                'source': reference.findtext('SO', ''),
                'year': reference.findtext('YR', ''),
                'vl': reference.findtext('VL', ''),
                'no': reference.findtext('NO', ''),
                'pg': reference.findtext('PG', ''),
                'country': reference.findtext('CY', ''),
                'identifiers': [],
            }
            for identifier in reference.iter('IDENTIFIER'):
                ident = {key.lower(): value for key, value in identifier.items()
                         if key not in ['MODIFIED', 'MODIFIED_BY']}
                ref['identifiers'].append(ident)
            study_info['refs'].append(ref)

        # Create record


        record = Record.create(url, study_info)