AnatomicMaps / flatmap-maker

Make anatomical flatmaps from SVG diagrams, Powerpoint slides, and other sources.
Apache License 2.0
3 stars 7 forks source link

Implement proxy mechanism and propagate to the map viewer #105

Open napakalas opened 5 days ago

napakalas commented 5 days ago

Develop a new proxy system that allows map authors to add extra feature annotations, which will be passed along and made accessible in the map viewer.

This will add a proxy_features.json file in the flatmap source with contents such as:

   [
       {
          "proxy": "UBERON:0000044",
         "name": "dorsal root ganglion",
         "features": [
              "UBERON:0003943"
         ]
       }
   ]

and adding an entry in the manifest file: "proxy Features": "proxy features.json"

Then propagated to the map viewer as:

{
     "class":"spinal_45",
     "featureId":343,
     "id":"S45_L4",
     "label":"fourth lumbar dorsal root ganglion",
     "models":"UBERON:0003943",
     ...,
     "proxy-features":[["UBERON:0000044","dorsal root ganglion"]]
}

proxy-features containing a list of proxy pairs and their labels. Is this format appropriate?

dbrnz commented 5 days ago
[
{
"proxy": "UBERON:0000044",
"name": "dorsal root ganglion",
"features": [
"UBERON:0003943"
]
}
]

Isn't this back to front, as UBERON:0003943 will be a proxy for UBERON:0000044, in the sense that a proxy is a substitute representing another entity?

What about:

[
    {
        "feature": "UBERON:0000044",
        "name": "dorsal root ganglion",
        "proxies": [
            "UBERON:0003943"
        ]
    }
]
napakalas commented 5 days ago

yeah, that makes sense, i will update it accordingly.

dbrnz commented 5 days ago

Thanks for the changes to mapmaker and human flatmaps.

What about the other AC maps? Do they also need updating??

How about looking at what else is needed to have proxies implemented, now that index.mbtiles has proxy information? There needs to be a way for the viewer to retrieve a map's proxies from a flatmap server, and in the viewer, for code to load the proxies and use them when finding features on which to place markers.

Thanks.

napakalas commented 2 days ago

Thanks for the changes to mapmaker and human flatmaps.

What about the other AC maps? Do they also need updating??

It seems like we need to update the other flatmaps for consistency and completeness.

How about looking at what else is needed to have proxies implemented, now that index.mbtiles has proxy information? There needs to be a way for the viewer to retrieve a map's proxies from a flatmap server, and in the viewer, for code to load the proxies and use them when finding features on which to place markers.

Thanks.

In the flatmap-server, it is better to provide a function like: @get('flatmap/{map_uuid:str}/proxies')

then in the flatmap-viewer, this function is called and the return value is added to the flatmap like:

const flatmap = new FlatMap(container, this.
{
   ...,
   proxies: proxies
}
nickerso commented 2 days ago

Not sure I completely get the finer points, but would be good to make sure that proxies also show up in the viewer / api just like normal features. e.g., adding a dataset marker for a given feature shouldn't need to care too much if its a proxy or not. (Although perhaps useful to be able to find out if needed)

napakalas commented 2 days ago

In the map viewer, feature-proxies can be added to the SearchIndex, so that one featureId can have multiple model markers. I've tried this, and tried searching using UBERON:0000044 and UBERON:0003943, they refer to the same featureId.

dbrnz commented 2 days ago

@napakalas yes, adding a flatmap/{map_uuid:str}/proxies endpoint to the server and using it to populate a this.#proxies field in the flatmap (in the viewer) is the way to go.

Then the code that finds where to place markers needs to check the flatmap's proxies (in this.#proxies).

If you can implement and test all this sooner rather than later and in particular get a PR for the viewer then we should be able to slip it into the current promotion (@alan-wu would need things ready sometime tomorrow).

napakalas commented 2 days ago

I have created issues and PRs:

For the flatmap-viewer, I updated the Flatmap.modelFeatureIds function since it is called by the addMarker function to fine the featureIds. In that function, if the featureIds is not found in __modelToFeatureIds, it will be looked for in proxy_features.