Skip to content

Add sets #103

@physikerwelt

Description

@physikerwelt

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)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions