ArcGIS Hub Premium enables organizations, like local non-profits, governments, or schools, to share a project or update with their community by starting an initiative or creating a site and organizing content and teams to share web maps, apps, datasets, and more with the public. Hub Premium also supports creating and sharing events related to your initiative using hub's built-in events management system. Click here to learn more about ArcGIS Hub.
In this notebook, we will explore the Hub Premium capabilities of Initiatives and Events.
from arcgis.gis import GIS
First, we will sign in to an organization with Hub Premium enabled to demonstrate these workflows.
Note: In order to replicate these workflows for yourself, you may have to verify the features available to you, per your ArcGIS Hub licensing.
You may also want to look at these examples for site and page creation and cloning using ArcGIS Basic and site and page layout and theme editing using Enterprise Sites to see the other ways of working with your Hub using the ArcGIS API for Python.
gis = GIS(profile="your_online_hub_premium_profile")
Enter password: ········
Next, we will initialize a Hub object to create an initiative with this Hub Premium Web GIS.
hub_premium = gis.hub
Adding new Initiatives
An Initiative supports policy or activity oriented goals through workflows, tools and team collaboration. Initiatives manage the team, events, content, and experiences involved in achieving a shared goal.
You can add a new initiative with the following commands:
initiative1 = hub_premium.initiatives.add(title='Initiative with Python')
initiative1.item
A Hub Initiative comes with an Initiative item and a Site item. You also get a Content Team group created to manage the content in your initiative's content library and a Followers Team group that maintains a list of the followers of the initiative. Users with Administrative privileges that create an initiative will also have a Core Team group created as part of the initiative, to allow collaboration among members of that team.
To access the site of an initiative, you can fetch the site using the site_id
property of the initiative.
site1 = hub_premium.sites.get(initiative1.site_id)
site1.item
Searching for and Fetching initiatives
Initiatives that have been previously created can be searched for across your Hub.
initiatives = hub_premium.initiatives.search(title='Vision Zero', tags='Hub')
initiatives[:5]
[<Initiative title:"Vision Zero - v180628" owner:publisher2>, <Initiative title:"Vision Zero Maine Demo" owner:content_mgr1>, <Initiative title:"Vision Zero Tags" owner:hub_user4>, <Initiative title:"vision-zero-1" owner:publisher2>, <Initiative title:"Vision Zero - courtney" owner:content_mgr3>]
You can also fetch a particular initiative using its item id.
initiative2 = hub_premium.initiatives.get('07fad5be49da45bea02c8f5b0876be24')
initiative2
<Initiative title:"Walkability Assessment " owner:creator1>
Update an Initiative
You can update certain initiative properties using the update()
method on the Initiative object. The list of properties that can be updated using this method can be found here.
We will first print the current snippet of the initiative we created, update it and verify the update.
initiative1.snippet
'Create your own initiative by combining existing applications with a custom site. Use this initiative to form teams around a problem and invite your community to participate.'
initiative1.update(initiative_properties={"snippet":"Test change of snippet"})
True
initiative1.snippet
'Test change of snippet'
Delete an Initiative
Deleting an initiative deletes the initiative and site items, as well as the groups created as part of the initiative creation process.
initiative1.delete()
True
Searching for Events
ArcGIS Hub supports engagement through in-person and virtual events. Events are meetings for people to support an Initiative and are scheduled by an organizer and have many attendees. An Event will have an associated Group that will allow you to include content for preparation as well as gather and archive content during the event for later retrieval or analysis.
Note: The pattern to add, search, get, update and delete Events is identical to that of Initiatives.
all_events = hub_premium.events.search()
all_events[:5]
[<Event title:"Test" venue:White House>, <Event title:"Bicycle Lanes in Ward 8" venue:Anacostia Neighborhood Library>, <Event title:"Neighborhood Kickoff" venue:>, <Event title:"Hub Onsite Kickoff" venue:>, <Event title:"Hub Home brainstorming" venue:>]
You can also filter your events search by initiative_id
, title
, venue
, and organizer_name
as demonstrated below:
events_title = hub_premium.events.search(title='Ward')
events_title[:5]
[<Event title:"Bicycle Lanes in Ward 8" venue:Anacostia Neighborhood Library>]
events_organizer = hub_premium.events.search(venue='White House')
events_organizer[:5]
[<Event title:"Test" venue:White House>, <Event title:"Test Attendance" venue:The White House>, <Event title:"Test 2" venue:The White House>, <Event title:"Katie Test" venue:The White House>, <Event title:"Let's talk Python" venue:The White House>]