Replies: 2 comments 3 replies
-
|
@ion-oset @stratofax Created an initial pass (it is just a starting point) at a UML at https://github.com/TrustTheVote-Project/VTP-web-api/blob/feature/12-add-uml-mermaid-diagram/docs/VTP-core-data-classes.md. It did not take long for me to hit some fundamental questions. I know this is a UML targeted to the VTP-web-api and hence is not a UML for the VoteTrackerPlus repo implementation, but I am confused regarding the line between data and 'action' (code). For example, in the current version of the above which is based on the current version of the VoteTrackerPlus repo, the tally operation returns/prints stream based IO. It is more like a syslog then a data structure. I don't think it is wise to try to replicate the logic in javascript or anywhere else and I don't think we have the time to change the format from syslog like to a proper data structure - this is a tally which is a function, not a data structure. If that is true (TBD), then the tally box will want something like verbosity which really speaks to 'code' as opposed to 'data'. In any case, I would like to hear comments and discuss what is there now before spending more time on it solo. |
Beta Was this translation helpful? Give feedback.
-
|
Here is a first pass at just the blank ballot first two endpoints. Note - the solid black diamonds are 'has-a' relationships (a.k.a. contains/references/composition) and the hollow arrows are 'is-a' relationships (inheritance) classDiagram
Choice *-- Selection
Ballot *-- Contest
Contest *-- Selection
Choice *-- Ticket
class Choice {
+String name
+String party
+Dict ticket
+String choice_type
}
class Selection {
+Int index
+String name
}
class Ticket {
+String name
+String party
}
class Contest {
+List choices # order is important
+String vote_variation # RCV, plurality
+String uid # unique to election only
+Float win_threshold # default = 0.5
+Int votes_allowed # defines overvote
+String write_in # unimplemented
+List selection # index + name
}
class Ballot {
+List active_ggos # order is important
+Dict contests # ordered by active_ggos
+String ballot_status # blank or cast
}
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Updated class diagram from TrustTheVote-Project/BallotLab#81 (reply in thread)
classDiagram ElectionData *-- BallotStyleData BallotStyleData *-- CandidateContestData BallotStyleData *-- BallotMeasureData BallotMeasureData *-- BallotChoiceData ContestData <|-- BallotMeasureData CandidateContestData *-- CandidateChoiceData ContestData <|-- CandidateContestData CandidateChoiceData *-- PartyData class ElectionData { +String name +String type +String start_date +String end_date } class BallotStyleData { +GpUnit[] ballot_scopes +ContestData[] contests +candidate_contests() +ballot_measure_contests() } class ContestData { +String id +String title +String district } class CandidateContestData { +String vote_type +Integer votes_allowed +CandidateChoiceData[] candidates } class CandidateChoiceData { +String id +PartyData party +Boolean is_write_in } class PartyData { +String name +String abbreviation } class BallotMeasureData { +String text +BallotChoiceData[] choices } class BallotChoiceData { +String id +String choice }Notes
ContestDatafor the real contest data types.BallotStyleData.contestshas to be a union of the contest types because contests are a mix of possible contest types, and splitting them would lose their ordering.PartyDatatype is used because it's easier to manage than having it be a dictionary.ballot_scopesis a list of theGpUnits theBallotStylerefers toBallotStyleData.idis theBallotStyle.ExternalIdentifier.Value. (There is no@idforBallotStyles.)Beta Was this translation helpful? Give feedback.
All reactions