I am trying to build data mapping based on activities.
In our Marketing Activities tree, we have a very strict and structured way to differentiate between different types of activities.
How can I get activity data based on its location in the tree?
Sounds like you want to filter based on a pattern match on the dotted path to the campaign/program.
You can't filter in this way
As Sanford mentioned, you cannot filter on location in the tree, or what Program an activity belongs to. You can filter on whether Leads/Contacts are on a particular Static List, and on activity Type (and date of course).
Each Activity is linked to a Lead/Contact and - if applicable - to an asset (Form, Email, Landing Page, etc.). If you download all asset and folder data to a local database through the Asset API, you will be able to look up the Folder ID of the Asset for a particular Activity, then traverse the tree to determine the location in the tree. In some cases, the Asset API also gives you the path, so you could optionally use pattern matching.