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.

data.html 3.4KB

2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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 %}