|||

Progress on the Causal Map app

I’ve been working more or less full-time on our app for causal mapping, now called simply Causal Map” for over a year now. You can find out more on causalmap.app. Mostly that work is just writing computer code, though I’ve also done plenty of text coding”, i.e. actually using the app to do research for clients, as well as working with Fiona and James on the business plan, interacting on Upwork.com with people who are helping with the code, and so on.

Anyway, writing code can be a pretty lonely process so I thought I’d start to keep an occasional diary of what I’ve been up to. In theory, there is a record of my progress at the corresponding github repository, but this is private at the moment.

So here’s a snapshot of what I did in the last 2-3 days so I don’t feel so lonely!

Layout

The most important change is a different layout algorithm. Before, all the factors were laid out in one big diagram, and when you were viewing some subset of it, e.g. because you had applied some filters, you’d still see the factors in the same relative positions. I had thought this was a good idea, and it is great for small networks because you get a feel for where everything is even though you can’t see it all. But for larger networks it is nonsense because everything” is an enormous hairball.

So now, by default, each subset of the network is laid out afresh, like this (viewing just the causal network around patronage”, in the middle). It means you have to do a lot less moving around to see what is going on. It is the basic Sugiyama layout with a bit of tweaking. Not perfect but much better. I also added two buttons to increase/decrease font size.

70c13f0d7ab4bb0d29a6b7f8ed3f89d4.png There is a button to get the old one-layout-to-rule-them-all behaviour if you want it. Here is what looks like if you ask for this, and what it would have looked like until yesterday.

845a65bd7674d8d45ad7eb632391941d.png845a65bd7674d8d45ad7eb632391941d.png

Refactoring

I most of yesterday tidying and refactoring the code. This led to me fixing a bug in the conceptual zoom” functionality which had been bugging me for months.

Sliders

90d01ee1efcb2ee231262f17f20c9ac2.png90d01ee1efcb2ee231262f17f20c9ac2.png

The interface allows the user to change, if required, the default strength and actualisation level” of each causal claim. (I’ve been updating the explanation of what this means in the doc Coding styles in the app”). As there are only five possibilities for each (High, Low, Zero, -Low and -High) I felt it would be easier to have sets of buttons rather than the existing slider. I spent some of Saturday making button bars for this purpose, only to abandon them again in favour of simplified sliders on which you can just click in the appropriate place. I’ve also added the option missing” or unspecified” for each of these, subtly different from zero, which was a bit of a faff. The slider still shows numbers rather than High” etc, that is the next step.

Styling

d4a75f3e404903ae905ee0a185e5a312.pngd4a75f3e404903ae905ee0a185e5a312.png

I did a little bit of work on styling to make the app start to follow the colours in our branding, and added a logo.

Upwork

I spent a lot of Saturday going back-and-forth with Novica about the task to enable background save to the database. This is by far the biggest thing holding us back from being able to work conveniently online.

Coded-statement-finder

Usually I code all the statements one by one. But sometimes you have to jump ahead, e.g. to switch to a different kind of respondent. But then you can get lost as to what you have coded and what you haven’t. There is a button to jump to the furthest statement ever coded, but that won’t help you if you have left gaps in between. So I added two things:

  • the app now remembers where you were the last time you did a save, and returns to that point when you fire up the app again.
  • I added a little panel which shows a little box for every statement, 50 per row (count them!). Each box is black if that statement has been coded. Of course sometimes you choose not to code individual statements, but with this panel you can identify longer sections where you haven’t done anything, and then you can click on the box to go to that statement.

f0c2e9629b23467a64e9dfa88288d453.pngf0c2e9629b23467a64e9dfa88288d453.png

Documentation

I’m continuing to add explanatory texts for all of these buttons and widgets which are revealed when you mouse over them or when you press the Guide me” button.

And I keep adding to the Coding styles” doc.

Thinking

At the moment I am spending a lot of time thinking about three problems.

Causal Zoom

This is a big one. At the moment we can do Conceptual Zoom which means removing granularity. So Big theme>Subtheme and Big theme>Subtheme2 and Big theme all get sucked up into Big theme, and their links are transferred too. It works fine.

And, you can remove less frequently mentioned factors with a slider. But what if you have factors B, C and C which all transmit an influence from factor A to factor E: if B, C and D are not mentioned frequently, then they will disappear when you move the slider.


graph LR
    A --> B
    A --> C
    A --> D
    B --> E
    C --> E
    D --> E    

Causal Zoom will be a feature which, when you move the slider, combines and relocates the edges in this kind of case, making the most conservative assumptions about the strength, etc of the resulting links. So for example if either of A → B or B → C have strength=0, so does the link which results from combining them.


graph LR
    A --> E
    A --> E
    A --> E    

Causal Zoom will enable the user to ask questions like Show me the aggregated paths from Intervention J to Outcome P”, and get an answer showing say 3-4 green” paths where all the connections are normal, this-causes-this links, and maybe one or two grey, zero-strength links and one or two weak ones, one or two negative ones, etc.

I am pretty clear on how to do this, I just need to get round to it.

Generalising statement coding

At the moment, you view the statements (and the corresponding network) either one-by-one or all at once. You can only code in the one-by-one view.

  • This isn’t great. In Nvivo, you can say Show me all the coded passages connected to them X” and then continue to code within that coding.
  • Some people (Fiona) would like to code longer sections, say everything from one respondent all at once, while viewing the network for that respondent, not just for one statement.

So I think the solution is not to make this all-or nothing distinction. Instead, the statement panel will always show something depending on a metadata filter which you set. So it can show text statement-by-statement or respondent-by-respondent, or village-by-village, or question-by-question, optionally filtered by any other filters, and you can keep coding, and you can see the corresponding section of the network. Then you can click to get to the next statement/respondent or whatever.

I think this is do-able and is deliciously general, but would need a lot of rewriting.

At the moment the functionality to search / replace / reorganise factors is great. But not links. We need to be able to do things like Show me all the links with the hashtag #xx and also with strength=High, and recode them as … . The only way to systematically search and replace stuff inside links is with the clunky filter table at the top of the UI. I have tried about 10 different ways to do this using different kinds of tables etc but nothing satisfies. Instead, I want to be able to search and replace using the existing panel for coding new links. This would be more intuitive and easier to get at.

It is do-able.

Bits

I learned how to make a single-button toggle using shinyWidgets, like this one, which is toggled on:

09a6b8de866cea90ff55dfecc687f4ae.png I moved all the buttons which are just for local use into a separate toolbar.

Up next Articles and presentations related to Causal Maps and Theorymaker Here are some things I’ve already written as steps on the road to understanding causal mapping. If you’ve read any of these, you might be interested Using Dropbox for syncing Shiny app data on Amazon EC2 I’ve been working more or less full-time on our app for causal mapping, now called simply “Causal Map” for over a year now. You can find out more on
Latest posts Making notes on PDFs without computer or paper Publications causal-map Causal Map intro Causal Mapping - an earlier guide The walk to school in Sarajevo Glitches Draft blog post for AEA365 Theory Maker! Inventory & analysis of small conservation grants, C&W Africa - Powell & Mesbach! Lots of charts! Answering the “why” question: piecing together multiple pieces of causal information rbind.fill for 1-dimensional tables in r yED graph editor Examples of trivial graph format Using attr labels for ggplot An evaluation puzzle: “Talent show” An evaluation puzzle: “Mobile first” An evaluation puzzle: “Many hands” An evaluation puzzle: Loaves and fishes An evaluation puzzle: “Freak weather” An evaluation puzzle: “Billionaire” Using Dropbox for syncing Shiny app data on Amazon EC2 Progress on the Causal Map app Articles and presentations related to Causal Maps and Theorymaker Better ways to present country-level data on a world map: equal-area cartograms A starter kit for reproducible research with R A reproducible workflow for evaluation reports Welcome to the Wiggle Room Realtime comments on a Theory of Change Responses to open questions shown as tooltips in a chart A panel on visualising Theories of Change for EES 2018?