Dome Lighting Question

What is it doing? the dome light is a open ground circuit. Like the door close, the switch is open, open the door the switch closes and the light comes on.
As My Pics Show There Was A Lot Of Hacks And I Returned The Wiring Back To Almost Factory But I Lost A Few Pics Of The Before For Reference Need Help To Attach The Correct Wire To The Relay (Note I'm Not Reattaching The Map Light)