I'm looking for the most effective way to extract the following information from D2L.
For a given user find all Department in which he is not enrolled, but is enrolled in any Offerings belonging to this Department.
The only solution I see is:
It's obvious that if user is teaching many Courses then too many calls will be required in step2.
Any suggestions are greatly appreciated.
For your step 2 which starts with the set of the student's enrolled course offerings, you may find it easier to call GET /d2l/api/lp/(version)/orgstructure/(orgUnitId)/ancestors/ to find all the departments containing those course offerings, and produce your List 2.
Unfortunately, the Valence Learning Framework doesn't really give you any set-predicate API calls around the org structure (to determine if a given orgUnit Y is a descendant of another orgUnit X, and so forth).