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.

interventions.py 2.7KB

2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # @name: interventions.py
  2. # @creation_date: 2022-09-09
  3. # @license: The MIT License <https://opensource.org/licenses/MIT>
  4. # @author: Simon Bowie <ad7588@coventry.ac.uk>
  5. # @purpose: interventions route for Section 1: Archive interventions
  6. # @acknowledgements:
  7. from flask import Blueprint, render_template, request
  8. from . import solr
  9. from . import ops
  10. interventions = Blueprint('interventions', __name__)
  11. # route for interventions page
  12. @interventions.route('/interventions/')
  13. def index():
  14. return render_template('index.html')
  15. # route for random entry page ('A random entry')
  16. @interventions.route('/interventions/random/')
  17. def random_record():
  18. core = 'all'
  19. search_results = solr.random_search(core)
  20. results = search_results[0]
  21. for result in results:
  22. publication_details = ops.get_publication_details(result['doc_ref'])
  23. result.update(publication_details)
  24. if ops.get_images(result['doc_ref']):
  25. image = ops.get_images(result['doc_ref'])
  26. result.update(image)
  27. return render_template('record.html', results=results)
  28. # route for comparing two random records ('A juxtaposition of two')
  29. @interventions.route('/interventions/juxtaposition/')
  30. def two_random_records():
  31. core = 'all'
  32. results_list = []
  33. i = 0
  34. while i <= 1:
  35. search_results = solr.random_search(core)
  36. results = search_results[0]
  37. for result in results:
  38. publication_details = ops.get_publication_details(result['doc_ref'])
  39. result.update(publication_details)
  40. if ops.get_images(result['doc_ref']):
  41. image = ops.get_images(result['doc_ref'])
  42. result.update(image)
  43. results_list.append(result)
  44. i += 1
  45. return render_template('compare.html', results=results_list)
  46. # route for getting ten random titles ('A poetics of titles')
  47. @interventions.route('/interventions/titles/')
  48. def ten_random_titles():
  49. titles = solr.get_ten_random_elements('title')
  50. additional_titles = solr.get_ten_random_elements('title')
  51. return render_template('titles.html', titles=titles, additional_titles=additional_titles)
  52. # route for getting ten random abstracts ('A handful of fragments')
  53. @interventions.route('/interventions/fragments/')
  54. def ten_random_abstracts():
  55. abstracts = solr.get_ten_random_elements('abstract')
  56. return render_template('abstracts.html', abstracts=abstracts)
  57. # route for getting ten random images ('A scattering of images')
  58. @interventions.route('/interventions/scattering/')
  59. def random_images():
  60. images = solr.get_random_images(4)
  61. additional_images = solr.get_random_images(6)
  62. return render_template('images.html', images=images, additional_images=additional_images)