A search interface for the Performing Patents Otherwise publication as part of the Politics of Patents case study (part of Copim WP6): this parses data from the archive of RTF files and provides additional data from the European Patent Office OPS API. https://patents.copim.ac.uk
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
3.4KB

  1. {% extends "base.html" %}
  2. {% block content %}
  3. <a href="{{ url_for('main.index') }}" class="search-back text-left" title="back to search">search</a>
  4. <h1 class="h1 text-center"> There are a total of {{ total_number }} patents.</h1>
  5. <div class="anchordata">
  6. <a href="#time">temporal focus</a>
  7. <br>
  8. <a href="#geo">geographic focus</a>
  9. </div>
  10. <br><br>
  11. <div class="row">
  12. <div class="col-6 text-center">
  13. {% for i in range(0, year_data|length) %}
  14. {% if i % 2 %}
  15. {{ year_data[i] }}<br>
  16. {% else %}
  17. <a href="{{ url_for('search.basic_search', year=year_data[i]) }}">
  18. {{ year_data[i] }}
  19. </a>:
  20. {% endif %}
  21. {% endfor %}
  22. </div>
  23. <div class="col-6 text-center">
  24. {% for i in range(0, country_data|length) %}
  25. {% if i % 2 %}
  26. {{ country_data[i] }}<br>
  27. {% else %}
  28. {% if country_data[i].name is defined %}
  29. <a href="{{ url_for('search.basic_search', country=country_data[i].alpha_2) }}">
  30. {{ country_data[i].name }}
  31. </a>
  32. {{ country_data[i].flag }}:
  33. {% else %}
  34. <a href="{{ url_for('search.basic_search', country=country_data[i]) }}">
  35. {{ country_data[i] }}
  36. </a>:
  37. {% endif %}
  38. {% endif %}
  39. {% endfor %}
  40. </div>
  41. </div>
  42. <div id="time">
  43. <canvas id="chartOfYearFrequency" width="600" height="300"></canvas>
  44. </div>
  45. <div id="geo">
  46. <canvas id="chartOfCountryFrequency" width="600" height="300"></canvas>
  47. </div>
  48. <script type="text/javascript">
  49. // retrieve variables passed from Python
  50. var year_labels = {{ year_labels|safe }}
  51. var year_dataset = {{ year_dataset|safe }}
  52. // set up chart
  53. var data = {
  54. labels: year_labels,
  55. datasets: year_dataset,
  56. };
  57. var config = {
  58. type: 'bar',
  59. data: data,
  60. options: {
  61. plugins: {
  62. title: {
  63. display: true,
  64. text: 'number of patent records for each year'
  65. },
  66. animation: {
  67. onComplete: () => {
  68. delayed = true;
  69. },
  70. delay: (context) => {
  71. let delay = 0;
  72. if (context.type === 'data' && context.mode === 'default' && !delayed) {
  73. delay = context.dataIndex * 1000 + context.datasetIndex * 100;
  74. }
  75. return delay;
  76. },
  77. },
  78. },
  79. responsive: true,
  80. scales: {
  81. x: {
  82. title: {
  83. display: true,
  84. text: 'year'
  85. },
  86. stacked: true,
  87. },
  88. y: {
  89. title: {
  90. display: true,
  91. text: 'number of records'
  92. },
  93. stacked: true
  94. }
  95. }
  96. }
  97. };
  98. Chart.defaults.font.family = 'Compagnon'
  99. var yearGraph = new Chart(
  100. document.getElementById('chartOfYearFrequency'),
  101. config
  102. );
  103. </script>
  104. <script type="text/javascript">
  105. // retrieve variables passed from Python
  106. var country_labels = {{ country_labels|safe }}
  107. var country_dataset = {{ country_dataset|safe }}
  108. // set up chart
  109. var data = {
  110. labels: country_labels,
  111. datasets: country_dataset,
  112. };
  113. var config = {
  114. type: 'pie',
  115. data: data,
  116. options: {
  117. plugins: {
  118. title: {
  119. display: true,
  120. text: 'number of patent records from each country'
  121. },
  122. },
  123. responsive: true,
  124. }
  125. };
  126. Chart.defaults.font.family = 'Compagnon'
  127. var yearGraph = new Chart(
  128. document.getElementById('chartOfCountryFrequency'),
  129. config
  130. );
  131. </script>
  132. {% endblock %}