Analytics and occupancy control in physical spaces