<commit_before>from generatePoaXml import *
from parseXlsFiles import * 
import xlrd
import settings as settings


"""
read from an xls file
output an xml file


# Gotchas
TODO: currnet XLS does not provide author contrib type TODO: query for author contrib type 
TODO: we need a decision on what we do with middle names, for now we are ignoring them 
TODO: print out authors in their contrib order 
TODO: add contrib-type
TODO: add managing editor information 
TODO: add subjects 

"""

def build_xml_for_article(article_id):
	doi = get_doi(article_id)
	title = get_title(article_id)
	#uri = doi2uri(doi)
	article = eLifePOA(doi, title)
	#
	abstract = get_abstract(article_id)
	article.abstract = abstract
	article.manuscript = article_id
	#
	license_id = get_license(article_id)
	license = eLifeLicense(license_id)
	article.license = license
	#
	accepted_date = get_accepted_date(article_id)

	t_accepted = time.strptime(accepted_date.split()[0], "%Y-%m-%d")
	accepted = eLifeDate("accepted", t_accepted)
	article.add_date(accepted)
	# Use accepted date as the received date
	received = eLifeDate("received", t_accepted)
	article.add_date(received)
	#
	# set the license date to be the same as the accepted date
	date_license = eLifeDate("license", t_accepted)
	article.add_date(date_license)

	# default conflict text
	article.conflict_default = "The authors declare that no competing interests exist."

	# ethics
	ethic = get_ethics(article_id)
	if ethic:
		ethics = parse_ethics(ethic)
		if len(ethics) > 1:
			print article_id
		for e in ethics:
			article.add_ethic(e)
<commit_msg>Removed debug code.<commit_after>from generatePoaXml import *
from parseXlsFiles import * 
import xlrd
import settings as settings


"""
read from an xls file
output an xml file


# Gotchas
TODO: currnet XLS does not provide author contrib type TODO: query for author contrib type 
TODO: we need a decision on what we do with middle names, for now we are ignoring them 
TODO: print out authors in their contrib order 
TODO: add contrib-type
TODO: add managing editor information 
TODO: add subjects 

"""

def build_xml_for_article(article_id):
	doi = get_doi(article_id)
	title = get_title(article_id)
	#uri = doi2uri(doi)
	article = eLifePOA(doi, title)
	#
	abstract = get_abstract(article_id)
	article.abstract = abstract
	article.manuscript = article_id
	#
	license_id = get_license(article_id)
	license = eLifeLicense(license_id)
	article.license = license
	#
	accepted_date = get_accepted_date(article_id)

	t_accepted = time.strptime(accepted_date.split()[0], "%Y-%m-%d")
	accepted = eLifeDate("accepted", t_accepted)
	article.add_date(accepted)
	# Use accepted date as the received date
	received = eLifeDate("received", t_accepted)
	article.add_date(received)
	#
	# set the license date to be the same as the accepted date
	date_license = eLifeDate("license", t_accepted)
	article.add_date(date_license)

	# default conflict text
	article.conflict_default = "The authors declare that no competing interests exist."

	# ethics
	ethic = get_ethics(article_id)
	if ethic:
		ethics = parse_ethics(ethic)
		for e in ethics:
			article.add_ethic(e)

{'fraction_non_alphanumeric': 0.08057324840764331, 'fraction_numerical': 0.0015923566878980893, 'mean_word_length': 5.028790786948177, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '186278', 'n_tokens_mistral': 1095, 'n_tokens_neox': 1040, 'n_words': 321}