# # Collective Knowledge (automating artifact evaluation) # # See CK LICENSE.txt for licensing details # See CK COPYRIGHT.txt for copyright details # # Developer: Grigori Fursin, Grigori.Fursin@cTuning.org, http://fursin.net # cfg={} # Will be updated by CK (meta description of this module) work={} # Will be updated by CK (temporal data) ck=None # Will be updated by CK (initialized CK kernel) # Local settings ############################################################################## # Initialize module def init(i): """ Input: {} Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 } """ return {'return':0} ############################################################################## # process JSON file from HOTCRP and generate table of artifacts def process_hotcrp(i): """ Input: { json_file - input JSON file from HOTCRP } Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 } """ jf=i.get('json_file','') if jf=='': return {'return':1, 'error':'--json_file with HOTCRP JSON file is not specified'} r=ck.load_json_file({'json_file':jf}) if r['return']>0: return r d=r['dict'] hh='\n' hh+=' \n' hh+=' \n' hh+=' \n' hh+=' \n' hh+=' \n' hh+=' \n' hh+=' \n' hh+=' \n' tt='' j=0 for a in d: j+=1 sj=str(j) if len(sj)<2: sj=' '+sj title=a['title'] authors=a['authors'] decision=a['decision'] badges='' xauthors='' for au in authors: if xauthors!='': xauthors+=', ' xauthors+=au['first']+' '+au['last'] ck.out(sj+') '+title) hh+=' \n' hh+=' \n' hh+=' \n' hh+=' \n' hh+=' \n' hh+=' \n' hh+=' \n' hh+=' \n' tt+='***********************************************\n' tt+=sj+') '+title+'\n' tt+=' ('+xauthors+')\n' tt+='\n' tt+=' ACM badges: '+badges+'\n' hh+='
PaperArtifact availableArtifact functionalArtifact reusableResults reproducedResults replicated
\n' hh+=' '+sj+') '+title+'
\n' hh+=' '+xauthors+'

\n' hh+='

\n' if 'available' in decision: hh+='
\n' if badges!='': badges+=',' badges+='available' hh+='
\n' if 'functional' in decision: hh+='
\n' if badges!='': badges+=',' badges+='functional' hh+='
\n' if 'reusable' in decision: hh+='
\n' if badges!='': badges+=',' badges+='reusable' hh+='
\n' hh+=' \n' if 'replicated' in decision: hh+='
\n' if badges!='': badges+=',' badges+='replicated' hh+='
\n' r=ck.save_text_file({'text_file':'tmp-ae.html', 'string':hh}) if r['return']>0: return r r=ck.save_text_file({'text_file':'tmp-ae.txt', 'string':tt}) if r['return']>0: return r return {'return':0} ############################################################################## # Convert a list of HotCRP users in CSV to HTML def convert_hotcrp_users_cvs_to_html(i): """ Input: { file [string] - CSV filename fileout [string] - html output file } Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 } """ fn=i['file'] import csv import sys if sys.version_info[0] > 2: f=open(fn, 'r', encoding="utf-8") else: f=open(fn, 'rb') reader = csv.reader(f) users = list(reader) f.close() # Prepare h='\n' fo=i.get('fileout','') if fo=='': ck.out(h) else: r=ck.save_text_file({'text_file':fo, 'string':h}) if r['return']>0: return r return {'return':0}