diff --git a/protcur/protcur/__init__.py b/protcur/protcur/__init__.py index eead319..fa9c4ec 100644 --- a/protcur/protcur/__init__.py +++ b/protcur/protcur/__init__.py @@ -1 +1 @@ -__version__ = '0.0.5' +__version__ = '0.0.6' diff --git a/protcur/protcur/analysis.py b/protcur/protcur/analysis.py index be580c6..6acb057 100755 --- a/protcur/protcur/analysis.py +++ b/protcur/protcur/analysis.py @@ -1109,6 +1109,8 @@ class protc(AstGeneric): #TODO we need more here... )) _manual_fix = { + # FIXME param: vs protc: for fuzzy-quantity, the fuz is not handled + # by the param parser atm so keeping it in protc for now ... 'roomtemperature':('protc:fuzzy-quantity', '"room temperature"', '"temperature"'), 'room temperature':('protc:fuzzy-quantity', '"room temperature"', '"temperature"'), @@ -1209,7 +1211,7 @@ def manual_corrections(v): id, label = self.ontLookup(value) if id: #value += f" ({id_}, {data['labels'][0]})" - value = f"(term {id} \"{label}\" #:original \"{value}\"{ont})" + value = f"(term {id} {json.dumps(label)} #:original {json.dumps(value)}{ont})" #value = ("term", id_, data['labels'][0], "#:original", value) #raise ValueError(value) return value diff --git a/protcur/protcur/document.py b/protcur/protcur/document.py index 8062c31..cea31cd 100644 --- a/protcur/protcur/document.py +++ b/protcur/protcur/document.py @@ -268,11 +268,59 @@ def _uri_humans(self): slugs[anno.uri_normalized].append(anno) return dict(slugs) - def document_rows(self): + def slug_rows(self): + yield ('slug', + 'uri', + 'anno count', + 'doi', + 'title', + 'author count', + 'authors', + 'protocol created', + 'protocol updated', + 'protocol has versions', + 'anno date first', + 'anno date last', + 'anaesthesia', + 'microscopy', + 'close but no cigar', # euthanasia, ephys rig + ) + tails = self.slug_tails() + for slug, pios in self.slug_streams().items(): + spios = sorted([p for p in pios], key=lambda p: p.uri_human) + pio = spios[0] + annos = tails[pio.asStr()] # already normalized I think? + hpio = pio.uri_human + + minad = min([a.created for a in annos]) + maxad = max([a.updated for a in annos]) + + authors = [a.name for a in hpio.authors] + + yield (slug, + hpio.asStr(), + len(annos), + hpio.title, # title + hpio.doi.asStr() if pio.doi else '', + len(authors), + authors_s, + isoformat(hpio.created), + isoformat(hpio.updated), + hpio.hasVersions, + minad, + maxad, + '' + '', + '', + '', + ) + + def document_rows(self): norms = self.normalized() yield ('slug', 'uri', + 'anno count', 'doi', 'title', 'author count', @@ -280,13 +328,13 @@ def document_rows(self): 'protocol created', 'protocol updated', 'protocol has versions', - 'anno count', 'anno date first', 'anno date last', 'anaesthesia', 'microscopy', 'close but no cigar', # euthanasia, ephys rig ) + for slug, pios in self.slug_streams().items(): #annos = tails[slug] spios = sorted([p for p in pios], key=lambda p: p.uri_human) @@ -299,6 +347,7 @@ def document_rows(self): authors_s = '|'.join(authors) yield (slug, pio.asStr(), + len(annos), pio.doi.asStr() if pio.doi else '', pio.title, # title len(authors), @@ -306,7 +355,6 @@ def document_rows(self): isoformat(pio.created), isoformat(pio.updated), pio.hasVersions, - len(annos), minad, maxad, '' diff --git a/protcur/setup.py b/protcur/setup.py index a71771f..bf74a49 100644 --- a/protcur/setup.py +++ b/protcur/setup.py @@ -70,7 +70,7 @@ def find_version(filename): install_requires=[ 'flask', 'htmlfn', - 'hyputils>=0.0.5', + 'hyputils>=0.0.6', 'Markdown', 'pyontutils>=0.1.22', 'pysercomb>=0.0.5',