Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/source description split (agents, spaces) #48

Merged
merged 16 commits into from
Apr 15, 2024

Conversation

lukavdplas
Copy link
Contributor

This re-does part of #45 - creating a split between historical constructs and descriptions in narrative sources. Refactoring was done to avoid the duplication of every entity having both a Historical and SourceDescription version, which is not always needed.

  • Creates base classes and admin utilities in core.
  • Updates the space app. These changes are quite minor, mostly adding some fields for where/how information is represented in the source. SpaceDescriptions now require a source - the migrations add a "MISSING SOURCE" object as a placeholder.
  • Updates the agent app, which is more radical. The Agent model is split into HistoricalPerson and AgentDescription. I decided to simply delete all existing agents from the database, rather than converting them into one of the new models. For existing agents, we don't actually know if they are described in narrative sources or not.

Updates for letter and event will follow later, but I wanted to avoid a massive PR.

Notes:

  • Some fields in the letter/event apps are commented out because they refer to agents (which were deleted).
  • As we discussed earlier, a HistoricalPerson is a single person, while an agent can also be a group. This is because identifying groups as "historical figures" can get ship-of-Theseus-y. It's also less relevant for users.
  • Date of birth/death are only added as properties on historical figures; as I understand from the researchers, birth/death dates only feature in their analysis as "historical background information".
  • You can add names, gender, social status, and location (for groups) as part of an agent's description. This results in a form pretty similar to the mock-up in data entry mockup (contd.) #44

@lukavdplas lukavdplas marked this pull request as ready for review April 9, 2024 13:32
@lukavdplas lukavdplas changed the title Feature/source description split (refactor) Feature/source description split (agents, spaces) Apr 11, 2024
Copy link
Contributor

@XanderVertegaal XanderVertegaal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. Just a few questions for clarification, but nothing holding back merging.

source = models.ForeignKey(
to=Source,
on_delete=models.PROTECT,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why no CASCADE here? Is there something wrong with deleting associated descriptions when a source is removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not really an issue on a technical level, but sources are quite fundamental, you can accidentally remove half the database that way. 🙃

return f"{self.person} died c. {self.year_lower}-{self.year_upper}"


class PersonReference(Field, models.Model):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I correct in assuming you will want to add more properties to this relationship in the future?

(I'm a bit confused why this is not simply a ForeignKey.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's inherits Field, it has the certainty and note properties! I thought those would be useful.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, sorry; I missed that one.


class PersonDateOfBirth(Field, LettercraftDate, models.Model):
person = models.OneToOneField(
to=HistoricalPerson,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused as to why DateOfBirth and DateOfDeath are directly linked to HistoricalPerson, while Gender would be linked to AgentDescription.

I expect dates to be a lot more controversial and source-dependent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't really sure about this, it's true that it's not really consistent.

I think it makes sense to me because I'm not a historian but I have some background in queer theory, so I see dates as boring background information, and representations of gender as dynamic and interesting. That framing depends on research interest, though.


def clean(self):
if self.location.source != self.agent.source:
raise ValidationError("Can only link descriptions in the same source text")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@lukavdplas lukavdplas merged commit 5dd7556 into develop Apr 15, 2024
2 checks passed
@lukavdplas lukavdplas deleted the feature/source-description-split-2 branch April 15, 2024 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants