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.

139 lines
3.0KB

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