acdh-oeaw / apis-core

https://acdh-oeaw.github.io/apis-core/
MIT License
11 stars 3 forks source link

tei:export incomplete #379

Open martinantonmueller opened 1 year ago

martinantonmueller commented 1 year ago

this is an incomplete export:

<date to-iso="1938-09-25">03.12.1918 – 25.09.1938</date>

from-isois missing

cf. https://pmb.acdh.oeaw.ac.at/apis/entities/tei/institution/36687

gregorpirgie commented 1 year ago

relates to #391

Will propose a solution for both issues. The current date handling is managed in this template:

{% if object.start_date_written == object.end_date_written %} # GP: add check here that both dates are not none or catch this case above
<date>{{ object.start_date_written }}</date>
{% elif object.start_date_written and object.end_date_written %}
<date
      {% if object.start_start_date %}
        from-iso="{{ object.start_start_date|date:'Y-m-d' }}"
      {% endif %}
      {% if object.end_date %} 
        to-iso="{{ object.end_date|date:'Y-m-d' }}"
      {% endif %}
    >{{ object.start_date_written }}  – {{ object.end_date_written }}</date>
{% elif object.start_date_written %}
<date
      {% if object.start_start_date %}
        notBefore-iso="{{ object.start_start_date|date:'Y-m-d' }}"
      {% endif %}
      {% if object.start_date %}
        when-iso="{{ object.start_date|date:'Y-m-d' }}"
      {% endif %}
    >{{ object.start_date_written }}</date>
{% elif object.end_date_written %}
<date
      {% if object.end_date %}
        when-iso="{{ object.end_date|date:'Y-m-d' }}"
      {% endif %}
      {% if object.end_end_date %}
        notAfter-iso="{{ object.end_end_date|date:'Y-m-d' }}"
      {% endif %}
    >{{ object.end_date_written }}</date>
{% else %}
{% endif %}

I think we would need even more checks, for each individual date-section. To unifiy the beaviour, I would propose to return:

@martinantonmueller and @csae8092 - would this be the desired behaviour and if so, what should be the default value for the second case where a to-iso and from-iso is expected but only one of the two is None? Should it be simply "None"

PS: to be clear, in the second case, I suggest, of course, to keep the exisiting date and set the missing date (either from-iso or to-iso to None)