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

documents: simplify subjects structure #3278

Merged
merged 1 commit into from
Mar 16, 2023
Merged

Conversation

jma
Copy link
Contributor

@jma jma commented Mar 8, 2023

  • Uses entity for subjects and imported subjects.
  • Uses entity for genreForm and imported genreForm.
  • Uses entities as subject subdivisions.
  • Removes non working entity links such as timestamps, places, etc.
  • Removes entity links for imported version of subjects and genreForm.
  • Removes subject factory.

Why are you opening this PR?

  • Which task/US does it implement?
  • Which issue does it fix?

Dependencies

My PR depends on the following rero-ils-ui's PR(s):

  • rero/rero-ils-ui#

How to test?

  • What command should I have to run to test your PR?
  • What should I test through the UI?

@github-actions github-actions bot added dev: fixtures Fixtures data used for ils.test and ilsdev.test f: data About data model, importation, transformation, exportation of data, specific for bibliographic data f: data migration Data migration from a legacy system or a previous version f: search labels Mar 8, 2023
@jma jma force-pushed the maj-subjects branch 3 times, most recently from 3e373c3 to aac5d59 Compare March 9, 2023 15:56
@jma jma changed the title in progress documents: simplify subjects structure Mar 9, 2023
@jma jma marked this pull request as ready for review March 9, 2023 18:36
@jma jma requested review from rerowep, zannkukai and lauren-d March 9, 2023 18:36
build_string_from_subfields(
value,
subfield_code_per_tag[creator_tag_key]),
'.', '.'
)
) + '. ' + subject['authorized_access_point']
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't understand why we have to add subject['authorized_access_point'] again.
If we really have to add it it is preferable to work with f strings.

Copy link
Contributor

Choose a reason for hiding this comment

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

@rerowep in this case (600t, 610t, 611t), it seems some subfields value must be prepend to subject term.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we really have to add it it is preferable to work with f strings.

I do not see a simple way to do this. Can you provide an example?

@@ -0,0 +1,59 @@
{
"title": "Local Entity",
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe better to name Local Contribution?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea is to express the fact that a contribution is an entity. The professional should "see" that an entity can be a subfield of different document fields.

}
]
}
"title": "Entities",
Copy link
Contributor

Choose a reason for hiding this comment

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

File name and title not matching ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No but should it be?

@@ -0,0 +1,60 @@
{
"title": "Local Entity",
Copy link
Contributor

Choose a reason for hiding this comment

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

File name and title not matching ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No but should it be?

},
"place_subdivisions": {
"$ref": "#/definitions/place_subdivisions"
"title": "Entities",
Copy link
Contributor

Choose a reason for hiding this comment

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

File name and title not matching ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No but should it be?

# print(str(err))
return 'Subject parsing error !'
entity = subject_data['entity']
if language is None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Normally we don't need this test, because entity.get(... will do the job, but it is more clear this way.

build_string_from_subfields(
value,
subfield_code_per_tag[creator_tag_key]),
'.', '.'
)
) + '. ' + subject['authorized_access_point']
Copy link
Contributor

Choose a reason for hiding this comment

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

@rerowep in this case (600t, 610t, 611t), it seems some subfields value must be prepend to subject term.

'z': 'bf:Place'
}
for tag, val in value.items():
if tag in subdivisions.keys():
Copy link
Contributor

Choose a reason for hiding this comment

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

COSMETIC : you could use if tag in subdivisions: . Using this notation on a dict, will check into dict.keys()... but it's maybe less human readable.

Comment on lines 309 to 311
for subject in [
res.get('entity') for res in doc.get(self.name, [])
]:
Copy link
Contributor

Choose a reason for hiding this comment

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

COSMETIC : maybe add a default value for res.get('entity', {}). It should prevent any error if entity isn't present (I know it's required into JSON schema... but 2 security systems are always better than only one)

'entity': {
'$ref': 'n/a',
'pid': 'n/a',
'type': DocumentSubjectType.PERSON
Copy link
Contributor

Choose a reason for hiding this comment

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

We could use EntityType class and remove DocumentSubjectType as we already removed subjectFactory

@jma jma requested a review from PascalRepond March 14, 2023 06:56
@github-actions github-actions bot added the dev: DB Database structure (models.py) label Mar 14, 2023
"items": {
"type": "object",
"title": "Entities",
"description": "Topic (including genre/form), place, temporal, person, family or corporate body (including conferences). Always create a link to IdRef or GND, if possible.",
Copy link
Contributor

Choose a reason for hiding this comment

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

"Imported topic, place, temporal, person, family or corporate body (including conferences), used for information. Do not enter data manually."

"items": {
"type": "object",
"title": "Entities",
"description": "Topic (including genre/form), place, temporal, person, family or corporate body (including conferences). Always create a link to IdRef or GND, if possible.",
Copy link
Contributor

Choose a reason for hiding this comment

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

"Imported genre or form, used for information. Do not enter data manually."

"cssClass": "editor-title"
}
"title": "Genres, forms (imported)",
"description": "Genre of form from imported bibliographic data",
Copy link
Contributor

Choose a reason for hiding this comment

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

"Genre or form imported from external data"

"cssClass": "editor-title"
}
"title": "Subjects (imported)",
"description": "Subject from imported bibliographic data",
Copy link
Contributor

Choose a reason for hiding this comment

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

"Subject imported from external data"

},
"source": {
"title": "Source",
"description": "Source of the subject.",
Copy link
Contributor

Choose a reason for hiding this comment

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

"Source catalog where the subject was imported from."

"items": {
"type": "object",
"title": "Entities",
"description": "Topic (including genre/form), place, temporal, person, family or corporate body (including conferences). Always create a link to IdRef or GND, if possible.",
Copy link
Contributor

Choose a reason for hiding this comment

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

"Topic (including genre/form), place, temporal, person, family or corporate body (including conferences). Always create a link to IdRef or GND, if possible."

Copy link
Contributor Author

@jma jma Mar 16, 2023

Choose a reason for hiding this comment

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

Seems to be a copy from the original description.

"bf:Topic",
"bf:Concept",
"bf:Place",
"bf:Temporal"
Copy link
Contributor

Choose a reason for hiding this comment

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

bf:Person and bf:Organisation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No as subdivision does not allows Person nor Organisation.

Copy link
Contributor

Choose a reason for hiding this comment

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

so default should not be bf:Person

]
}
"title": "Entities",
"description": "Topic (including genre/form), place, temporal, person, family or corporate body (including conferences). Always create a link to IdRef or GND, if possible.",
Copy link
Contributor

Choose a reason for hiding this comment

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

"Genre or form of the document. Always create a link to IdRef or GND, if possible."

Comment on lines 40 to 48
"source": {
"title": "Source",
"description": "Source of the subject.",
"type": "string",
"minLength": 3,
"form": {
"templateOptions": {
"itemCssClass": "col-lg-6"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not needed.

@jma jma requested a review from rerowep March 14, 2023 12:54
* Uses entity for subjects and imported subjects.
* Uses entity for genreForm and imported genreForm.
* Uses entities as subject subdivisions.
* Removes non working entity links such as timestamps, places, etc.
* Removes entity links for imported version of subjects and genreForm.
* Removes subject factory.

Co-Authored-by: Johnny Mariéthoz <[email protected]>
Co-Authored-by: Renaud Michotte <[email protected]>
@jma jma requested a review from PascalRepond March 16, 2023 13:20
@jma jma merged commit 97b3635 into rero:US-2434-entity Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev: DB Database structure (models.py) dev: fixtures Fixtures data used for ils.test and ilsdev.test f: data migration Data migration from a legacy system or a previous version f: data About data model, importation, transformation, exportation of data, specific for bibliographic data f: search
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants