Ejemplo n.º 1
0
 def set_claim_form(self, claim):
     """Initialize the edit form that displays the claim itself."""
     post = self.request.POST
     session = self.session
     ref_id = self.ref_id
     logging.info("Checkpoint 5, ref_id is {0}".format(repr(ref_id)))
     if claim.evidence:
         evidence = make_curie(claim.evidence)
         logging.info("Calling make_curie, got {0}".format(evidence))
     else:
         evidence = NOSPEC
     if claim.narrative:
         narrative = make_curie(claim.narrative)
     else:
         narrative = 'None'
     scf = ClaimEdit(post,
                     claim,
                     behavior_label=get_blabel(claim, session))
     scf.behavior_term.data = make_curie(claim.behavior_term)
     scf.evidence.data = evidence
     scf.ref_id = claim.ref_id
     scf.publication.data = make_curie(claim.publication)
     scf.narrative.data = narrative
     scf.narrative.choices = narrative_choice(session, claim.publication)
     scf.publication.choices = publication_choice(session)
     scf.behavior_term.choices = behavior_choice(session)
     scf.evidence.choices = evidence_choice(session)
     self.claim_form = scf
Ejemplo n.º 2
0
 def update_graph(self, claim, parts, link_ids: List[str]):
     """Rewrite the graph drawing commands into the d3script."""
     logging.info("Updating graph with {0} parts".format(len(parts)))
     blabel = get_blabel(claim, self.session)
     node_index = self.graph.add_term((10, 100), blabel)
     halfcount = len(parts) / 2
     ptx = 20 + 8 * len(blabel)
     for index, part in enumerate(parts):
         link = link_ids[part]
         pty = 100 + 50 * (index - halfcount)
         pt_index = self._draw_part_(part_id=part, root=(ptx, pty))
         if pt_index:
             self.graph.add_link(node_index,
                                 pt_index,
                                 D3renderer.get_link_color(link))