-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implement ML Tags Backend in COSMOS #1081
base: dev
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
] | ||
|
||
# Define TDAMM fields but make them optional | ||
@property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See if you are able to find an architecture that allows us to only define a single field and generate two. The idea would be to simplify the definitions and the logic within the models file and the serializers by abstracting it to the DualField generator.
If you aren't able to figure out a good architecure, then it is ok to implement the more straightforward approach, where we have some duplication in the definitions, but a relatively clean logic contained within the serializers. Something like this:
class CandidateURL(models.Model):
"""A candidate URL scraped for a given collection."""
TDAMM_tag = models.CharField(
TDAMM_tag_ml = models.CharField(
division = models.enums()
division_ml =
document_type =
document_type_ml =
ej_classification =
ej_classification_ml =
def serialize()
tdamm = self.TDAMM_tam if self.TDAMM_tag else self.TDAMM_tag_ml
division = self.division if self.division else self.division_ml
document_type = self.document_type if self.document_type else self.division_ml
ej_classification = self.ej_classification if self.ej_classification else self.division_ml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented an architecture that allows us to only define a single field with its field_type and generate two.
Can you remove the switch functionality for now? there are some other tests that this needs to pass as well. I don't know if you need to add test cases, or just run them. Read the files and decide for yourself.
|
No description provided.