예제 #1
0
        sys.exit(1)

    # read list
    with codecs.open(_list_path, 'r') as handle:
        ncts = [
            nct.strip() if len(nct.strip()) > 0 else None
            for nct in handle.readlines()
        ]
        assert len(ncts) > 0
        trials = {}
        rows_and_years = []
        lilly = LillyCOI()

        # retrieve from our database
        if not _force_update:
            existing = Study.retrieve(ncts)
            for ex in existing:
                trials[ex.nct] = ex

        # loop trials
        for nct in ncts:
            if not nct:
                continue

            # get the trial fresh via web
            if nct in trials:
                trial = trials[nct]
            else:
                trial = lilly.get_trial(nct)
                if trial is None:
                    raise Exception("No trial for %s" % nct)
예제 #2
0
	# look for the list
	if not os.path.exists(_list_path):
		print 'x>  The list file at %s does not exist' % _list_path
		sys.exit(1)
	
	# read list
	with codecs.open(_list_path, 'r') as handle:
		ncts = [nct.strip() if len(nct.strip()) > 0 else None for nct in handle.readlines()]
		assert len(ncts) > 0
		trials = {}
		rows_and_years = []
		lilly = LillyCOI()
		
		# retrieve from our database
		if not _force_update:
			existing = Study.retrieve(ncts)
			for ex in existing:
				trials[ex.nct] = ex
		
		# loop trials
		for nct in ncts:
			if not nct:
				continue
			
			# get the trial fresh via web
			if nct in trials:
				trial = trials[nct]
			else:
				trial = lilly.get_trial(nct)
				if trial is None:
					raise Exception("No trial for %s" % nct)
예제 #3
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

# NCT01954979


from ClinicalTrials.study import Study

# loop trials
trials = Study.retrieve(['NCT01954979'])
for trial in trials:
	print '-> ', trial.title
	codifieds = trial.codified_properties()
	if codifieds is None or 0 == len(codifieds):
		print 'xx>  No codified data'
		continue
	
	# look at codified data
	for prop, codified in codifieds.iteritems():
		if len(codified) > 0:
			for nlp_name, res in codified.iteritems():
				
				# MetaMap
				if 'metamap' == nlp_name:
					codes = res.get('codes')
					if codes:
						text = codes.get('text')
						cuis = codes.get('cui')
						
						# sort cuis by location
						sorted_cuis = []