Ed Andersen

Software Developer and Architect in Japan

Open Sourcing “Cognition”

Ed Andersen Avatar



One of the perks of working in R&D at Medidata is “Innovation Time”. Twice a year, engineers get to spend two weeks building whatever they want. Ideally some of the things we build will go back into direct product development but if not, we are encouraged to open source the work.

Fresh from attending Microsoft’s Build 2013 conference in San Francisco, I wanted an excuse to use all the latest Microsoft web stack tools. Namely:

  • Visual Studio 2013 Preview
  • ASP.NET MVC5 Beta
  • Entity Framework 6 Beta
  • SignalR 2.0 Beta

I also wanted to test out CouchDB, which was made infinitely easier with the awesome MyCouch library by Daniel Wertheim. The result of which is “Cognition” – a cross between a wiki and a CMS that can be used as a basic CRM, a job board or knowledge base. The result of two weeks work can be seen on the company repo at https://github.com/mdsol/cognition – a test site can be seen hosted on Azure at http://cognition-demo.cloudapp.net. There is quite a lot of rough code with scant test coverage, unfortunately necessary to get the experiment out the door in two weeks. It does however show what is possible with the .NET web stack.


Here is a short video showing the current state of the app (no audio – visit the full post page to view):

Some of the current features:

    • Fully custom document types – document types are literally .NET type structures internally. Admins can create dynamic types by providing C# source code in the admin area’s code editor or types can be directly compiled into the app.
    • Live document updates – anyone viewing a document will see the document automagically update when another user edits it. There is also a basic activity stream on the front page that also auto-updates.
    • Version control – all previous versions of a document are saved and can be rolled back. This is handled on top of CouchDB as attachments because, despite first impressions, CouchDB only uses it’s reversions for concurrency resolving, not actual versioning.
    • Permissions system – You can restrict edit rights to whole domains or specific users. Public documents can be made viewable by even non-authenticated users (and thus, indexed by search engines) or again restricted to only registered users. The system is very flexible. Note that searching and the update stream don’t have these permissions applied yet.
    • Markdown support – Document type fields can support markdown editing. Additionally, document types can override the whole display template and provide a markdown based template for the whole page (shown in the demo for the “Page” type).
    • Searching across all documents – all documents are searchable by title at the moment, handled by CouchDB Views. Search is a big area for improvement here – coupled with Elastic Search we could do fulltext search, or with a MongoDB datastore we could provide advanced search on specific fields.

Medidata is hiring engineers in the UK, US and Japan! http://jobvite.com/m?3TCt6gwP

Ed Andersen Avatar

About me

Hi! 👋 I’m a Software Developer, Architect and Consultant living in Japan, building web and cloud apps. Here I write about software development and other things I find interesting. Read more about my background.

Ed’s “Newsletter”

Get the latest blog posts via email ✌️


Leave a Reply

Your email address will not be published. Required fields are marked *