Coder Social home page Coder Social logo

cca-public / scope Goto Github PK

View Code? Open in Web Editor NEW
23.0 8.0 4.0 11.14 MB

SCOPE: An access interface for DIPs from Archivematica

License: GNU Affero General Public License v3.0

Python 77.89% HTML 17.27% Dockerfile 0.20% JavaScript 2.74% Shell 0.12% SCSS 1.78%
archivematica django digital-archives dip elasticsearch library-software

scope's People

Contributors

cole avatar dependabot[bot] avatar jraddaoui avatar kyledennis03 avatar mireillen avatar pyup-bot avatar seihpos avatar stefanabreitwieser avatar tw4l avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scope's Issues

Error in login page

The first time entering the GUI, after the admin user is created in the CLI, yo are redirected to the login page, with the following error:

Internal Server Error: /login/
Traceback (most recent call last):
  File "/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 217, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 215, in _get_response
    response = response.render()
  File "/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/template/response.py", line 107, in render
    self.content = self.rendered_content
  File "/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/template/response.py", line 84, in rendered_content
    content = template.render(context, self._request)
  File "/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/template/backends/django.py", line 66, in render
    return self.template.render(context)
  File "/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/template/base.py", line 207, in render
    return self._render(context)
  File "/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/template/base.py", line 199, in _render
    return self.nodelist.render(context)
  File "/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/template/base.py", line 990, in render
    bit = node.render_annotated(context)
  File "/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/template/base.py", line 957, in render_annotated
    return self.render(context)
  File "/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/template/loader_tags.py", line 177, in render
    return compiled_parent._render(context)
  File "/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/template/base.py", line 199, in _render
    return self.nodelist.render(context)
  File "/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/template/base.py", line 990, in render
    bit = node.render_annotated(context)
  File "/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/template/base.py", line 957, in render_annotated
    return self.render(context)
  File "/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/template/defaulttags.py", line 315, in render
    match = condition.eval(context)
  File "/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/template/defaulttags.py", line 892, in eval
    return self.value.resolve(context, ignore_failures=True)
  File "/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/template/base.py", line 736, in resolve
    new_obj = func(obj, *arg_vals)
  File "/home/radda/dip-access-interface/accesspoc/dips/templatetags/custom_tags.py", line 12, in has_group
    group = Group.objects.get(name=group_name)
  File "/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/db/models/query.py", line 380, in get
    self.model._meta.object_name
django.contrib.auth.models.DoesNotExist: Group matching query does not exist.

Store digital files `datemodified` field as date time

The DigitalFiles' datemodified field of is currently being stored as a char field in the database and therefore as a text field in the Elasticsearch index. This is made to allow any date format from the METS file but, considering that this field will be used to sort the digital files data tables, it should be stored as a date time field, which will also allow to do better aggregations in Elasticsearch queries in the future.

Pay special attention to the timezone when parsing and saving the date time to the database and the Elasticsearch index.

Technical requirements documentation

Artefactual needs to provided expanded / improved documentation about the technical infrastructure required to host this application. Initial documentation is in the README.

Review/configure storage of zipped objects files

Currently, everything is being saved to a "media" directory. Need way to configure multiple (mounted) storage spaces: as size of total DIPs passes 5TB, CCA will need to split storage into several directories

Error adding a new user

ValueError at /new_user/
The view dips.views.new_user didn't return an HttpResponse object. It returned None instead.
Request Method:	POST
Request URL:	http://localhost:8080/new_user/
Django Version:	1.11.5
Exception Type:	ValueError
Exception Value:	
The view dips.views.new_user didn't return an HttpResponse object. It returned None instead.
Exception Location:	/home/radda/dip-access-interface/venv/lib/python3.6/site-packages/django/core/handlers/base.py in _get_response, line 198
Python Executable:	/home/radda/dip-access-interface/venv/bin/python
Python Version:	3.6.3
Python Path:	
['/home/radda/dip-access-interface/accesspoc',
 '/home/radda/dip-access-interface/venv/lib/python36.zip',
 '/home/radda/dip-access-interface/venv/lib/python3.6',
 '/home/radda/dip-access-interface/venv/lib/python3.6/lib-dynload',
 '/usr/local/lib/python3.6',
 '/home/radda/dip-access-interface/venv/lib/python3.6/site-packages']
Server time:	Fri, 22 Dec 2017 19:48:42 +0000

Update application style/branding

Preliminary design notes / questions:

  • Logo: see CCA logo-2018.zip

  • CCA Blue: see Pantone Reflex Blue C.png (blue should only be used as an accent color)

  • Typeface: CCA currently uses Univers for digital external communication tools and Futura Bold and Book for internal communications tools. Which font should be used?

  • Visual reference(s): CCA uses their website as their main design reference. Internal tools and platforms have a different look and feel at the moment. This is something that we intend to address in the future. This should be discussed in more detail.

Other client feedback to address:

  • Remove the grey banner. There is a grey banner that says the title of the page, and then immediately underneath that, is a header with the same or similar title page. For example, on the homepage, there is “Collections” in a grey banner and then again as a header directly underneath it.
  • Revise "view" buttons to "see more"
  • Search bar should read "Search collection titles"
  • Revise text to read “To access born digital content within an archive/collection, select view from the list below. To search digital files across all collections, select “Search” from the menu above.”
  • Revise title to "Browse collections"
  • Add additional text to explain searching on homepage (after Stefana provides updated text)
  • Update FAQ text (after Stefana provides updated text)
  • Folder should be “View parent folder”; details should be “File details”
  • Search bar should read "Search all digital files"
  • Change font to Roboto (https://github.com/google/roboto)

Initial pyup update

The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.

Improve error message for deactivated users login

If an account is deactivated, on the login page display a different error message. Instead of "Please enter a correct username and password. Note that both fields may be case-sensitive." display "Your account has been disabled, please contact the reference librarian".

Changes in header

Changes needed in the header based on the GUI mock-up:

  • White background (no separator/shadow).
  • Add CCA logo.
  • Add home page icon/link.
  • Add link to "Collections" page (after #52).
  • Move "FAQ" link to right navigation.
  • Replace "Search" link with search bar.
  • Add language menu (done in #16).
  • Modify user and language menus caret?

Migrations should be tracked

The migrations created with python accesspoc/manage.py makemigrations should be committed alongside the model changes. It should only be necessary to run python accesspoc/manage.py migrate to create the database.

GUI width issues

  • Consider removing containers to use the full width of the window. This will help a lot with the display of data tables in large screens.
  • Avoid having container/row elements inside each others. The interface width is getting smaller as it goes down as a consequence of it.
  • Tables do not display properly in small widths. Consider using Bootstrap responsive tables.

Move Dublin Core fields to its own model and table

The DC fields shared between the Collection and DIP models should have its own table and be related with them to keep a cleaner database and to avoid code duplication (that could get worse as the app. grows).

Having its own form and partial template to be shared in the other models forms would be great after they are separated.

Truncate description text in data tables

Descriptions currently take up a lot of space on the screen. Is there a way to make the description cut off after, for example, 50 words that can be expanded if the user clicks?

Add production installation notes

Create a "Production installation" section in the README file with technical requirements for hosting the application.

We should also consider removing the development notes using Python virtualenv and the Django development server in favor of the Docker environment. The installation requirements will grow soon with Elasticsearch, the Celery worker and maybe a different database service and they will be similar in production and development (outside Docker).

Do not keep track of database

Considering that it could be multiple instances of this application, the database shouldn't be tracked as part of the source code.

For the initial stages of development a database seeder task could be used to add the first admin. user. This could be replaced later for some sort of install plugin, which could also be used to set other configuration options, like setting Elasticsearch, etc.

Ideally, the README file should include how to create, migrate and seed the database in the "Installation (dev)" section.

Users should be able to edit their own account

Currently, Managers and Administrators can edit all users but Editors and Viewers don't have access to the manage user pages.

An "Edit account" link should be added to the user drop-down to allow access to all users to their own edit user form to change their personal data. This form should not include the "Active", "Administrator" and "Groups" fields if the user is an Editor or a Viewer.

Upgrade to Django 2.x

Since we're targeting Python 3.6 or higher we should consider the upgrade to Django 2.x. Some deprecation warnings when running the tests (with python -Wall):

/src/accesspoc/dips/models.py:27: RemovedInDjango20Warning: on_delete will be a required arg for ForeignKey in Django 2.0. Set it to models.CASCADE on models and in existing migrations if you want to maintain the current default behavior. See https://docs.djangoproject.com/en/1.11/ref/models/fields/#django.db.models.ForeignKey.on_delete
  ispartof = models.ForeignKey(Collection, related_name='dips')
/src/accesspoc/dips/models.py:60: RemovedInDjango20Warning: on_delete will be a required arg for ForeignKey in Django 2.0. Set it to models.CASCADE on models and in existing migrations if you want to maintain the current default behavior. See https://docs.djangoproject.com/en/1.11/ref/models/fields/#django.db.models.ForeignKey.on_delete
  dip = models.ForeignKey(DIP, related_name='digital_files')
/src/accesspoc/dips/models.py:73: RemovedInDjango20Warning: on_delete will be a required arg for ForeignKey in Django 2.0. Set it to models.CASCADE on models and in existing migrations if you want to maintain the current default behavior. See https://docs.djangoproject.com/en/1.11/ref/models/fields/#django.db.models.ForeignKey.on_delete
  digitalfile = models.ForeignKey(DigitalFile, related_name='premis_events')
/src/accesspoc/dips/tests.py:3: RemovedInDjango20Warning: Importing from django.core.urlresolvers is deprecated in favor of django.urls.
  from django.core.urlresolvers import reverse
/src/.tox/py36/lib/python3.6/importlib/_bootstrap.py:219: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
  return f(*args, **kwds)
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
/src/accesspoc/dips/tests.py:52: DeprecationWarning: Please use assertEqual instead.
  self.assertEquals(view.func, collection)
./src/accesspoc/dips/tests.py:48: DeprecationWarning: Please use assertEqual instead.
  self.assertEquals(response.status_code, 404)
./src/accesspoc/dips/tests.py:43: DeprecationWarning: Please use assertEqual instead.
  self.assertEquals(response.status_code, 200)
./src/accesspoc/dips/tests.py:85: DeprecationWarning: Please use assertEqual instead.
  self.assertEquals(view.func, dip)
./src/accesspoc/dips/tests.py:81: DeprecationWarning: Please use assertEqual instead.
  self.assertEquals(response.status_code, 404)
./src/accesspoc/dips/tests.py:76: DeprecationWarning: Please use assertEqual instead.
  self.assertEquals(response.status_code, 200)
./src/accesspoc/dips/tests.py:26: DeprecationWarning: Please use assertEqual instead.
  self.assertEquals(view.func, home)
./src/accesspoc/dips/tests.py:22: DeprecationWarning: Please use assertEqual instead.
  self.assertEquals(response.status_code, 200)
..../src/accesspoc/dips/tests.py:133: DeprecationWarning: Please use assertEqual instead.
  self.assertEquals(response.status_code, 200)

Consider the use of a different database service

Before moving to production we should consider a more robust database service for the application. Django abstract the database interactions so it should not require major code changes, just configuration. Knowing this will allow us to use that service in the development and test instances to prevent issues when moving to production.

Revisit data table behaviour

Without being completely sure of how this works, it looks like there is no pagination involved in the request/response cycle of pages with data tables and that it's being handled by datatables.min.js.

It also looks like the sort options are being handled by sortable.js and that it only works with the entire table header, so I'm not sure how hard would be to remove it from columns like "Details" and "Edit" where a sort option isn't needed.

Getting all the data from the server and using this two libraries to do pagination and sorting on the client side will become a problem when the application data grows. Moreover, if the plan is to use Elasticsearch in the future to browse and search over the data, you can't retrieve all the documents from the index at once as it requires a pagination/scroll system to do it. Therefore, pagination and sorting should be moved to the server side as soon as possible.

Ideally, a couple of partials should be created to render the pagination and table header elements and that could be reused for all data tables using include.

Implement user groups

Looking at the README, there is an "Edit Collections and Folders" group but there isn't a way to add an user to that group.

Collapse Preservation metadata section in Digital File view page

The PREMIS events/Preservation Metadata should be hidden by default (showing just the words “Preservation metadata”). If the user clicks on the words “Preservation metadata”, the field expands to show the events. Users didn’t know what PREMIS events were and found them overwhelming to look at, but still wanted to have the information available, if less prominent.

Add `link` field to Folders

Like the 'link' field in the Collection model. Should they be renamed in the interface from 'Finding Aid' to 'Link'?

Avoid nested `if` blocks when possible

This is just a personal preference to make the code a little clear and avoid writing a lot of indented code.

For example:

@login_required(login_url='/login/')
def new_user(request):
    # only admins can make new users
    if request.user.is_superuser:
        if request.method == 'POST':
            form = UserCreationForm(request.POST)
            if form.is_valid():
                user = form.save()
                return redirect('users')
        else:
            form = UserCreationForm()
            return render(request, 'new_user.html', {'form': form})
    else:
        return redirect('home')

Looks a little better like:

@login_required(login_url='/login/')
def new_user(request):
    # only admins can make new users
    if not request.user.is_superuser:
        return redirect('home')

    if request.method is not 'POST':
        form = UserCreationForm()
        return render(request, 'new_user.html', {'form': form})
        
    form = UserCreationForm(request.POST)
    if form.is_valid():
        user = form.save()
        return redirect('users')

Improve breadcrumb generation

The same code is used in several templates to render the breadcrumbs, e.g.:

<ol class="breadcrumb">
  <li class="breadcrumb-item"><a href="{% url 'home' %}">{% trans "Collections" %}</a></li>
  <li class="breadcrumb-item"><a href="{% url 'collection' digitalfile.dip.collection.pk %}">{{ digitalfile.dip.collection }}</a></li>
  <li class="breadcrumb-item">{% trans "Folder" %}</li>
  <li class="breadcrumb-item"><a href="{% url 'dip' digitalfile.dip.pk %}">{{ digitalfile.dip }}</a></li>
  <li class="breadcrumb-item">{% trans "Digital file" %}</li>
  <li class="breadcrumb-item active">{{ digitalfile.uuid }}</li>
</ol>

This should be moved to a partial and create the <li> elements from a list generated in the views.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.