<!DOCTYPE html>
<head>
  <title>ASCO Abstract Title Evaluator</title>
  <link rel="stylesheet" href="static/main.css">
  <link rel="stylesheet" href="static/theme.css">
</head>

<body>
   <center><h1>ASCO Abstract Title Evaluator</h1></center>
   <center><form action="/" method="post">
         <textarea   rows="3"
                     cols="64"
                     name="title" 
                     placeholder="Enter abstract title..." 
                     required>{{ title }}</textarea><br>
         <input type="submit" value="Evaluate"/>
   </form></center>

   {% if tprob %}
      <center style="margin-inline:10em; text-align: justify;"><p>
         <h3>{{ tprob }}% Similarity</h3>
         The similarity of your abstract title to accepted 
         ASCO 2023 titles is in this percentile.
      </p></center>
      <br>
   {% endif %}

   {% if result %}
      <center style="margin-inline:10em; text-align: justify;"><p>
         <h3>{{ result }} Chance of on-site presentation</h3>
         Probability of on-site presentation 
         versus online only publication of your 
         abstract, based on the title, if
         accepted.
         {% if tprob|int < 5 %}
         <p><i style="color: var(--red1)">Warning: the similarity is too low to be confident in this prediction.</i></p><br>
         {% endif %}
      </p></center>
      <br>
   {% endif %}

   {% if closest %}
   {% set closed = closest.split('\n')[:-1] %}
   <h3>Closest {{ closed|length }} titles from ASCO 2023:</h3>
   <ol>
      {% for close in closed %}
      <li>{{ close|safe }}</li>
      {% endfor %}
   </ol>
   {% endif %}

   <center><a href="{{ url_for('static', filename='about.html') }}">About</a></center>

	<script>
      function sub(event) {
          if (event.key == 'Enter' && !event.shiftKey) {
              if (!event.repeat) {
                  const newEvent = new Event("submit", {cancelable: true});
                  event.target.form.dispatchEvent(newEvent);
              }

              event.preventDefault(); 
          }
      }

      document.querySelector("textarea").addEventListener("keydown", sub);
	</script>
	<center><a href="//git.signorovitch.org/jacob/asco">Source</a></center>
</body>
