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

Identify a StoryMap's Theme #1788

Closed
knoopum opened this issue Apr 5, 2024 · 7 comments
Closed

Identify a StoryMap's Theme #1788

knoopum opened this issue Apr 5, 2024 · 7 comments
Assignees

Comments

@knoopum
Copy link

knoopum commented Apr 5, 2024

I am interested in a simple way of determining which StoryMap Theme a StoryMap is using. My overall goal is to generate statistics across our organization about which of the built-in and custom Themes are most commonly used.

One can extract a story's theme information manually by locating the node with the type of "story-theme" among all of the story's nodes.

It would be helpful to have the theme information surfaced directly. For example, perhaps "theme" could be a returned property, or added as type option for get() to get directly to its node.

@nanaeaubry nanaeaubry self-assigned this Apr 5, 2024
@nanaeaubry
Copy link
Contributor

@knoopum Great suggestion I will work on putting this in. For now the workaround about looking at the node is the best way but we can add a property or make it so the method returns a theme if no parameters are given :)

@knoopum
Copy link
Author

knoopum commented Apr 5, 2024

I'll note a complication I ran into is that StoryMap Collections, which can also reference Themes, are not currently accessible via the API. Passing an item ID for a StoryMap Collection to arcgis.apps.storymap.StoryMap() results in a 404.

For Collections, it looks like I will have to harvest the Theme info from the item's JSON for now?

@nanaeaubry
Copy link
Contributor

@knoopum Good news for collections! Support will be added at 2.3.0 (coming out next week) so you will be able to access them soon. However the theme property you are suggesting was not added so it will be in Storymap, Collections, and Briefings for 2.3.1

I would refer to the json for now. I will make a custom method and can post it here soon as well to facilitate this.

@knoopum
Copy link
Author

knoopum commented Apr 5, 2024

@nanaeaubry that is great! I'll scrape the JSON in the meantime, and look forward to the updates

@nanaeaubry
Copy link
Contributor

Here is a quick method that can be used to get the theme

def get_theme(story):
    """
    Get the theme of the story, briefing, or collection.
    """

    for node, node_info in story._properties["resources"].items():
        for key, val in node_info.items():
            if key == "type" and val == "story-theme":
                return story._properties["resources"][node]["data"]["themeId"]

This will either return the name or the itemid of the theme used

@knoopum
Copy link
Author

knoopum commented Apr 8, 2024

@nanaeaubry Thank you! that confirms the logic I ended up using

@nanaeaubry
Copy link
Contributor

This will be a method in the next release of the API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants