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

Implement ML Tags Backend in COSMOS #1081

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

Kirandawadi
Copy link
Collaborator

No description provided.

@Kirandawadi Kirandawadi linked an issue Nov 4, 2024 that may be closed by this pull request
]

# Define TDAMM fields but make them optional
@property
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement ML Tags Backend in COSMOS
2 participants