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

nodes and query-paths endpoints return node data in different formats #46

Open
dhimmel opened this issue May 9, 2019 · 3 comments
Open

Comments

@dhimmel
Copy link
Collaborator

dhimmel commented May 9, 2019

@vincerubinetti mentioned that this is an annoyance for the frontend.

From https://search-api.het.io/v1/nodes/

        {
            "id": 0,
            "identifier": "128239",
            "identifier_type": "int",
            "name": "IQGAP3",
            "data": {
                "url": "http://identifiers.org/ncbigene/128239",
                "source": "Entrez Gene",
                "license": "CC0 1.0",
                "chromosome": "1",
                "description": "IQ motif containing GTPase activating protein 3"
            },
            "metanode": "Gene"
        },

From https://search-api.het.io/v1/query-paths/?source=11545&target=33324&metapath=SEcCrCrC:

    "nodes": {
        "11545": {
            "neo4j_id": 11545,
            "node_label": "SideEffect",
            "data": {
                "name": "Nasal itching",
                "source": "UMLS via SIDER 4.1",
                "identifier": "C0850060",
                "url": "http://identifiers.org/umls/C0850060",
                "license": "CC BY-NC-SA 4.0"
            },
            "metanode": "Side Effect"
        },
@vincerubinetti
Copy link

As we discussed in person, the best idea might be to put every property that will always be there in the top level, and any property that is only sometimes there under data. This would probably be the most clear and least arbitrary split. The other option is to put the more "significant" (subjectively) properties -- like perhaps name, metanode, and source -- in the top level, and the less important ones under data.

Also, I recommend changing the name of data since it's pretty ambiguous and nondescript, and it also conflicts with some of the nomenclature in D3 and elsewhere in the code. If we do the always/sometimes split mentioned above, I recommend renaming data to optional_fields or extra_fields or something like that.

We can get to this at some other point in time since it's a relatively minor issue.

dhimmel added a commit that referenced this issue May 14, 2019
Merges #50

* Use properties rather than data for extra node/edge attributes
BACKWARDS INCOMPATIBLE. FRONTEND BREAKING
Refs #46
http://atodorov.org/blog/2013/04/06/tip-renaming-model-fields-in-django/

* Cleanup & document code (mostly around API views)

* Enable markdown API docstrings
API markdown docstrings: one sentence per line

* Add direction to paths.cypher_rel_query
Previously each relationship was matched twice because direction
was not specified.
@vincerubinetti
Copy link

@dhimmel seems like this can be closed?

@dhimmel
Copy link
Collaborator Author

dhimmel commented May 15, 2019

Well we addressed the name of data, but we haven't unified the format of the nodes results to be the same from the /nodes and /query-paths endpoints.

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

2 participants