In [1]:
# Some code to generate a list of pubmed IDs
# of all studies included in the CDSR
# with associated quality scores AND direct quotes

import biviewer
import re
import progressbar

In [2]:
bv = biviewer.BiViewer()

In [3]:
len(bv)


Out[3]:
52454

In [4]:
# search through all the Cochrane data for quality assessments
# which the authors have given a direct quote justifying their decision
# and add the pubmed id to the search list

p = progressbar.ProgressBar(len(bv), timer=True)

pmids = []
domain_names = []

for i, study in enumerate(bv):
    p.tap()
    quality_data = study.cochrane["QUALITY"]
    for domain in quality_data:
        if re.match('Quote:', domain['DESCRIPTION']):
            pmids.append(study.pubmed["pmid"])
            domain_names.append(domain['DOMAIN'])


[====================] 100% - done!                     

In [5]:
domain_names = list(set(domain_names))

In [6]:
with open("domain_names.txt", "wb") as f:
    f.write('\n'.join(domain_names))

In [ ]: