I would be concerned that adding details of all of the patient's encounters to the context model would lead to performance problems.
Letting other modules populate the patient appcontext as you describe makes sense, though it does invalidate a previous assumption that a page completely defines its own context model, and thus can document it. So this line would no longer be accurate. Offhand I don't think this will break anything, but we should change our documentation of how to define apps in the app framework to indicate this change.
I would assume the flow is:
- Page controller sets up the initial context model like this
- Page controller calls a new method
- this new method iterates through all the registered components and calls something like
AppContextExtender.extend(AppContextModel m, String name)
- the "name" is so you know which page you're on, e.g. if you wanted to allow different details on the patient dashboard vs the visit dashboard
We should avoid making a module like Data Integrity require the App Framework or Core Apps modules for this.