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 13 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

Copy link
Collaborator Author

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.

@CarsonDavis
Copy link
Collaborator

Can you remove the switch functionality for now?
Also, can you move the choice field declaration into the collection_choice_fields.py. Make sure to follow the style in that file.
Add a null value, so a url can be none of the 35 TDAMM categories.
Rewrite the tests so that it will use the BaseUrl inside of delta_urls.py.
The core field functionality can be tested against the DeltaUrl class.

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.

  • sde_collections/tests/test_promote_collection.py

@Kirandawadi Kirandawadi removed the request for review from bishwaspraveen November 22, 2024 19:29
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