An Intra-Party Democracy Index: Theory, Design and a Demonstration