Created
July 18, 2018 03:01
-
-
Save sdumitriu/bf5c3ba0e5e9fb72d9f10eac51f63a1b to your computer and use it in GitHub Desktop.
Set the proband_id where missing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{velocity}} | |
#foreach ($i in $services.query.hql(', BaseObject f, BaseObject p, LargeStringProperty d where f.name = doc.fullName and f.className = ''PhenoTips.FamilyClass'' and p.name = doc.fullName and p.className = ''PhenoTips.PedigreeClass'' and d.id.id = p.id and d.id.name = ''data'' and d.value <> '''' and not exists (from StringProperty prob where prob.id.id = f.id and prob.id.name = ''proband_id'' and prob.value <> '''')').execute()) | |
#set ($d = $xwiki.getDocument($i)) | |
#set ($p = $jsontool.parseToJSONObject($d.getObject('PhenoTips.PedigreeClass').getValue('data'))) | |
#set ($pid = $p.opt('proband')) | |
#set ($ms = $p.opt('members')) | |
#set ($pref = false) | |
#foreach ($m in $ms) | |
#if ($pid == $m.opt('id')) | |
#set ($pref = $m.opt('pedigreeProperties').opt('phenotipsId')) | |
#break | |
#end | |
#end | |
#if ($pref) | |
$!d.getObject('PhenoTips.FamilyClass').set('proband_id', "xwiki:data.${pref}") | |
$!d.save('Set proband_id') | |
1. [[$i]] | |
#end | |
#end | |
{{/velocity}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment