fix(medcat): Relcat addon fix deserialise_from to match metacat behavior#542
Merged
Conversation
…defaults - cleaup
…defaults - cleaup
…defaults - cleaup
tomolopolis
approved these changes
Jun 16, 2026
tomolopolis
left a comment
Member
There was a problem hiding this comment.
lgtm - to get this merged in. Would be good for @mart-r to review also when he's back.
|
|
||
| - MetaCAT only — one ``MetaCATModel`` row is created. | ||
| - RelCAT only — registration succeeds; no ``MetaCATModel`` rows. | ||
| - MetaCAT and RelCAT — both addons load; only MetaCAT is registered. |
Member
There was a problem hiding this comment.
so, RelCAT and MetaCAT AddOns cannot be registered at the same time?
Collaborator
Author
There was a problem hiding this comment.
This is on the trainer side, I believe (correct me!) that trainer just doesnt care about the relcat addons
Like the ModelPack class doesnt load relcats at all
The unit test here I just wanted to confirm that it doesnt break if more addons are included
ModelPack doesnt have a field for relcat:
class ModelPack(models.Model):
name = models.TextField(help_text='', unique=True)
model_pack = models.FileField(help_text='Model pack zip')
concept_db = models.ForeignKey('ConceptDB', on_delete=models.CASCADE, blank=True, null=True)
vocab = models.ForeignKey('Vocabulary', on_delete=models.CASCADE, blank=True, null=True)
meta_cats = models.ManyToManyField('MetaCATModel', blank=True, default=None)
create_time = models.DateTimeField(auto_now_add=True)
last_modified = models.DateTimeField(auto_now=True)
last_modified_by = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, default=None, null=True)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Error
When I save a model pack in medcat trainer, that has a relcat addon, then it errors the page and returns 500
The error looks like the RelCAT addon isn't as safe as the Metacat addon.
This change updates the relcat deserialise_from method to match the metacat one, by adding defaults and some safety into it. It should look like
MetaCATAddonTrainer
Medcat
This is the error in medcat, after making a unit test to check this load_addons function.