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

Add sets #103

Open
physikerwelt opened this issue Oct 16, 2024 · 0 comments
Open

Add sets #103

physikerwelt opened this issue Oct 16, 2024 · 0 comments
Assignees

Comments

@physikerwelt
Copy link
Member

old code

def is_jfm(hit) -> bool:

    try:

        return hit["_source"]["database"] == "JFM"

    except KeyError:

        return False



def append_set_info(hit, parent, doc):

    classification = collect_info_for_hit(hit, "classification")

    sets = {""}

    for v in str(classification).split(";"):

        sets.add(v.strip()[0:2])

    sets.remove("")

    if is_jfm(hit):

        sets.add("JFM")

    # sorted is required for integration tests

    for s in sorted(sets):

        node = doc.createElement("setSpec")

        node.appendChild(doc.createTextNode(s))

        parent.appendChild(node)
@physikerwelt physikerwelt self-assigned this Oct 16, 2024
physikerwelt added a commit that referenced this issue Oct 17, 2024
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

No branches or pull requests

1 participant