(Either add this functionality to ExistingOrNewVisitAssignmentHandler in core, or else to a new class in the visit management module.)
We should support the use case where the patient has an encounter an "Hospital Xyz Ward A" but we want this to create a visit at "Hospital Xyz" rather than in the specific ward.
I propose supporting a configuration property on the handler that is a LocationTag. Then when creating the new visit, we'd step up through the location hierarchy from encounter.location until we find one with the specified tag. ("Hospital" in our example.) If you don't find a location in the hierarchy with that tag, just use encounter.location.