Git Product home page Git Product logo

mmp's Introduction

Test codecov flake8 Lint

MMP

Mapping Medieval Peoples: Visualizing Semantic Landscapes in Early Medieval Europe

About

a generic djangobaseproject port of https://gitlab.com/acdh-oeaw/imafo/gens, created with following steps:

Install

see the dedicated contributing file or try your luck with the following instructions

  • clone the repo git clone https://github.com/acdh-oeaw/mmp.git
  • [optional]
    • create a virtual env, e.g. virtualenv myenv
    • activate virtual env, e.g. source myenv/bin/activate
  • install needed packages pip install -r requirements.txt (jupyter notebook requirements not incldued)
  • [optional]
    • created your custom settings-file, e.g. pg_local

Start

on a clear database

  • apply migrations python manage.py migrate --settings=djangobaseproject.settings.dev
  • start dev-server python manage.py runserver ---settings=djangobaseproject.settings.dev
  • open http://127.0.0.1:8000/

use a db-dump

  • get a dump
  • create a new postgres-db name e.g. mmp
  • create postgis-extension
  • restore db-dump
  • make sure your (local) settings-file matches your db-settings (should be the case if you use the checked in pg_local.py settings file and if you named your db mmp)
  • start dev-server python manage.py runserver ---settings=djangobaseproject.settings.pg_local

[optional] populate netvis-cache

  • run something like python manage.py populate_netvis_cache <app_name> <model_name>

    • python manage.py populate_netvis_cache archiv autor --settings=djangobaseproject.settings.pg_local
  • go to http://127.0.0.1:8000/netvis/archiv/autor to the see the corresponding generic netvis

building the image

docker build -t mmp:latest . docker build -t mmp:latest --no-cache .

running the image

To run the image you should provide an .env file to pass in needed environment variables; see example below:

DB_NAME=mmp
DB_USER=mmp
DB_PASSWORD=db_pw
PROJECT_NAME=mmp
SECRET_KEY=randomstring
DEBUG=True
DJANGO_SUPERUSER_USERNAME=user_name
DJANGO_SUPERUSER_PASSWORD=user_pw
VOCABS_DEFAULT_PEFIX=mmp
VOCABS_DEFAULT_PEFIX=en
REDMINE_ID=12345

docker run -it -p 8020:8020 --rm --env-file .env_dev mmp:latest

or use published image:

docker run -it -p 8020:8020 --rm --env-file .env_dev acdhch/mmp:latest

dev notes

python manage.py remove_stale_contenttypes

cheat sheet

http://127.0.0.1:8000/archiv-ac/schlagwort-autocomplete/ http://127.0.0.1:8000/archiv-ac/eigenname-autocomplete/ http://127.0.0.1:8000/story-maps/data/1/

http://127.0.0.1:8000/api/stelle/?key_word__art=Schlagwort http://127.0.0.1:8000/api/stelle/?key_word__art=Eigenname http://127.0.0.1:8000/api/keyword/?art=Eigenname 127.0.0.1:8000/api/keyword/?art=Schlagwort

mmp's People

Contributors

csae8092 avatar dependabot[bot] avatar linxod avatar marcs19 avatar stefanprobst avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mmp's Issues

missing related authors / places

Texts might have several authors, in legacy_db this is expressed by columns tautor1, tautor2, tautor3
the default import script only covers tautor1, so customization is needed for the missing cols

same with places tort1, tort2, .. tort6

add 'date' fields

e.g. Text has CharFields start_date ... -> add additional field to store actual integers for start_end dates and provide some logic to populate them

GeoJson Serializer

provide GeoJson for SpatialCoverage including properties

  • stelle
    • text.title
    • text.jahrhundert
    • text.start_date
    • text.end_date
      • text.author (is a M2M field ...)
      • text.art
  • keyword
    • keyword.stichwort
    • keyword.wurzel
    • keyword.variants

provide timetable as table for usecase detail view

add a table to the usecase detail view looking like

start-date | end-date | title | description | type [event/text/autor]

ordered by start-date (ascending) and presenting information for Events (all), related Authors and Texts -> #33 should help

more filters

Keywords should be filterable basically by all properties they are related to (through whatever relations), e.g. by Text, or the related place of the author of a text a stelle is related to
please add those additional filters

UseCase.get_timetable_data

create a model method which returns an array with dicts looking like this

time_table_data = [
    {
        'id': 55,  # the object's id
        'start_date': 1104,  # the object's start_date
        'end_date': 1104,
        'ent_type': "event",  # lower case of the objects model name [event|autor|text]
        'ent_title': "1104 Lund replaces Hamburg as archbishopric of the North",  # title, or name
        'ent_description': "Lund replaces Hamburg as archbishopric of the North"  # only for events, for autor/text maybe some useful data or empty string
        'ent_detail_view': "/archiv/event/detail/55"  # the value of the .get_absolute_method
    },
    {
         'id': 234,  # the object's id
        ...
    }
]

implenting #31 before might be very helpful

enable download of result lists

Wäre es möglich, dass man Ergebnislisten auch als Excelliste herunterladen kann?

Excel ist möglich, allerdings braucht die Erstellung einer Excel Datei bei größeren Datenmengen ~ +1000 Zeilen extrem viel Resourcen; die Generierung einer .csv Datei wäre daher zu bevorzugen

move delete button to a less clickable place

Edit und delete Button liegen nahe beieinander – könnte man das ‚delete‘ feld woanders unterbringen, um sicher zu gehen, dass nicht versehentlich etwas auf die Schnelle gelöscht wird?

Art des Stichworts

adde choice options for this
options so far are 'Schlagwort' and 'Eigenname'

alt-title and lang field to text

Neue Textstelle: kann man bei der Titeleingabe auch zwei Titel (oder mehrere) = eingeben; es gibt Texte (wenige), deren Titel nicht eindeutig auf einen einzigen eingrenzbar sind

new Class `UseCase`

with props

  • title -> CharField
  • description -> (Rich)TextField
  • PI -> FK User

Passage M2M UseCase

serialize Texte as XML/TEI

each archiv.Text object should be represented as XML/TEI object,

  • including all related passages -> tei:body
  • keywords -> tei:term
  • Author(s) -> tei:header / tei:listPerson/tei:person
  • bibliographic information -> tei:header

see for reference implementations

  • gtrans
  • apis_core

implementation (suggestion)

  • render XML/TEI via django-template engine and parse the result with lxml to check if the created XML is actually well-formed

create 'cone' data

create convex-hull for spatial coverage + location of author;
probably as model-method for spatial coverage

make Event more robust

override Event's save() method to make sure

  1. if no end_date is provided, fill in the value of start_date
  2. if end_date is smaller than start_date raise a custom error msg

create views for Event

create list/detail/edit/create/delete views + urls + templates for Event in analogy to the other classes

provide keyword-cooccurrence-network API-endpoint

generate a graph based on cooccurrence of keywords in passages (stelle).

that is, e.g. from:

stelle1 | keyword1, keyword2
stelle2 | keyword1, keyword3
stelle3 | keyword1, keyword2, keyword3

generate:

keywordA | keywordB | count 
keyword1 | keyword2 | 2
keyword1 | keyword3 | 2
keyword2 | keyword3 | 1

additionally, we need to be able to filter by metadata of the stelle, especially: year, author, text

tests for listview

check if every list-view in app archiv actually returns a 200 http-code

json endpoint for timetable-data

add a new view which exposes the timetable data #33 of a given UseCase as JSON
the url should look like:
usecase-timetable-data/(?P<pk>[0-9]+)$ so e.g. http://mmp.acdh-dev.oeaw.ac.at/archiv/usecase-timetable-data/7

filter KeyWords by Author (and the other way)

Suchfunktion: wichtig wäre es Autor und key word gemeinsam suchen zu können; d.h. keyword in den Werken eines Autors; um u.a. auch sehen zu können wie oft ein Autor ein bestimmtes keyword benutzt und in Verbindung mit welchen anderen keywords

fetch timetable data in usecase detail view template async

rewrite the usecase detail view template in a way that the table for the timetable is not rendered by django-template but with vanilla javascript

  1. make an ajax request to the timetable endpoint (#36)
  2. process the response to create a table presenting the data in the html

and yes, thats much more complicated than the already existing solution, but its a nice practice, and this technique might become useful if we are dealing with big amounts of data

separate text of quote and location of quote

Stelle.zitat contains the actual quote (i.e. the text transcribed/copied from the source) AND the location, i.e. p. 123-344. good thing though, it looks like the actual quote starts after the first :, so it should be easy move this information into a dedicated field

-> this could be added to the import_data script

cached properties for UseCase to fetch related Texts, Authors and Keywords

provide methods for archiv.models.UseCase to fetch Text ,Autor and related KeyWord which are somehow (via Stelle) related to the given UseCase.

use the cached-property method decorator so that the related objects can be called as any other properties like some_usecase.title

see for a reference implementation https://github.com/acdh-oeaw/mmp/blob/master/archiv/models.py#L544

also read about cached-properties in the django-docs
also I assume that some clever ordering does matter, e.g. first fetch all related 'Stelle' objects and use those in the methods to fetch Texts and use this method/property for fetching Autors

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.