Code as a Vote

This post is a part of F# Calendar in English initiative started in 2014 and still driven by Sergey Tihon. Many thanks for organising this!

All advent posts
About this post

I'm building some sort of interactive analytics with special purpose data library that can serve both educational and social goals.
Initially I wanted to describe everything at once but realized it is too baffled, hence the split.

The proper library I'm going to describe on my second #FsAdvent slot shortly. In this entry I want to share a concept that leaded to the idea somehow:

  • trending_flat code as a vote

No, it is not a voting library but shares some similarities that will help understand the final project.

What you’ll learn
  • check You will look at programming from different, begginer perspective and use term "vote" in place of "algorithm" or "function".

Towards Smart Citizens

There is an ongoing discussion whether programming is possible to grasp for an average person. Switching to IT profession requires a lot of effort and self-denial. However programming doesn't have to be your profession.

It can be just another skill in your arsenal, beneficial for entire society.

In order to make the learning worth it, it must have tangible effect. Residents even don't have to write a code but at least be able to read it to give the feedback.

My idea to encourage people to learn programming or analytic skills is to make it impactful for their lifespaces or neighborhood.


Current Smart Citizens state

It is hard to force idea of programming when in vast majority of cities Smart Citizens initiatives boils down only to some sort of budget participation (where you have many local investments to be prioritized and you have to vote).

After initial success the formula is experiencing an existential crisis. I'm not going to address budget participation initally but it is a good example of broader problem common to other votings or general elections:

  • trending_flat people are aware only of few options/candidates (maybe those suggested by family/friends)
  • trending_flat people only focus on one slogan rather than tangible values so at the end they vote badly
  • trending_flat people don't vote at all not believing it makes sense with current system

You can make UI easily for such votings in a form of check boxes.This simplicity is both good and bad as you cannot specify relative, functional conditions.


Lets participate!

Lets look at example where current forms of voting are insufficient.
I have a task for you:

    Provide best address in your city for a living (or work).
    Make sure you have checked all possible places (~70k).
    Clarify your decision in few words

    I can here you say: "many thanks for such a form of democracy.. cheers!".

    Don't worry, the hardest part can be easily automated. Lets first write sample vote. For simplicity we assume that the city lifespace quality boils down to distances to city facilities: shops, parks, hospitals etc. It can be more than that: noise/ crime level, neightbourhood demography, any data we have access to.

    Obviously such votes are very subjective, look at mine and my grandma:

    It can be any F# code based on requirements and target group:

    What if we wanted to find formula for next bus station investment?


    Voting results

    Result of such voting is not a single winner. It is going to be a collection of values. This is very important: voting this way you are not asking for the winner but you do a thorough ... election campaign!

    This particular part is done by simple mini city engine. It gives you all the needed data necessary to create municipal vote and collects result along with analytics.

    You can do call the winner in a second round of apriori rule but it really doesn't matter here.

    We can use any sophisticated analyzer for visualizations or just a console printer. Looking ehead I can tell you that my analyzer will be build as Fable/Feliz component runnable both on dotnet-interactive and as a standalone web site.


    Votable open data

    Presented project can provide yet another advantage.
    For the time being open city data are basically in two "flavours". Static files for aggregated data that don't change frequently: spatial data, demography, city facilities, crime breakdown, transportation, to name a few. Other flavour is REST API when we can obtain realtime, dynamic data like vehicle positions, bus schedule, parking allowance etc.

    Proposed library extends it with contextual, votable data. Best places to live, work, best job offers, precalculated distances can be also an open data and make creating municipal apps more easily and more creative. But with one condition: the calculation must also be open.


    What next

    In next posts (starting 3th Dec) I will provide details how presented idea can be implemented for any city with quite interesting latest F# stack.

    That series will have a special form of learning , stay tuned!


This page collects only the traffic data.