mariarahat / bungeni-editor

Automatically exported from code.google.com/p/bungeni-editor
2 stars 0 forks source link

Bungeni Editor querying external data sources #91

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Problem
-----------------

Presently there is no transparent interface to query external data sources.
External data-sources are assumed to be jdbc datasources and the tables and 
columns are hard-coded in the editor and the external data source is expected 
to be in this format. This is problematic given that the nature or schema of 
the external data source is not known. A common data source could be Bungeni 
parliamentary information system  -- but the Editor needs to look at scenarios 
(e.g. judgement) where bungeni may not be in the picture and requires a 
transparent way to map external data-sources.
To look at a example usage of the current way data sources are queried , create 
a new debaterecord and try to markup either a Question, Speech or Motion. These 
actions prompt the user for a dialog where they have to select from a list of 
questions or list of members of parliament or a list of motions. Similarly when 
you create a new document , the start up metadata screen requires entering a 
parliament id, session id, sitting id etc.. these need to be populated from an 
external data source.

To Do - General Architecture
-----------------------------

The Editor needs to support a standard API for retrieving information from data 
sources.

Lets highlight how the new API shoud look like with an example -- 

Currently we use hard queries like :

Select MP_name, MP_id, MP_uri from members_of_parliament 

to retrieve member of parliament lists.

Instead if we had a transparent API like :

http://localhost:9348/editorapi/get_all_members_of_parliament

which returns a XML (or perhaps better JSON since this is purely for 
interchange and not persistence-- http://jackson.codehaus.org/ ) package 
containing a list of members of parliament and their details :

<package>
<users type="members">
 <user id="282" uri="/ke/MP/1935-01-02/an.name">
    <firstname>An</firstname>
    <lastname>Name</lastname>
 </user> 
 <user ....>
 </user>
</users>
</package>

The editor screens are written to this REST API and they always return 
information in a fixed documented form.
The REST API in turn has configurable data connectors (which are mapped to the 
API using interfaces ... which means we can switch and swap and write new 
connectors and map them to the API ).

So something like -- 

REST API (e.g. /get_all_members ) ==> maps to connector ==> IBungeniConnector 
(implements generic IEditorConnector ) ==> retrieves information from bungeni 

so the REST API acts as a proxy to the actual data store.

The REST API needs to run in the Editor application ...so it starts and stops 
with the Editor.

REST API could be written using the Restlet framework (http://www.restlet.org/ )

To Do - API Details
-----------------------------

1) Get parliament metadata info 

Info about the current parliament :
date of parliament creation
name of parliament
current session
current sitting

2) Get list of questions in current parliament 

Question name
Question date
Type of Question
Who asked the question
Who was it put to 

3) Get list of motions in current parliament

Motion name
Motion date
Type of motion
Who created the motion

4) Get list of bills in current parliament 

Bill name
Bill date
type of bill 
Who created the bill

5)Get list of members of parliament :

Name
URI

6) More ..to come ..

Original issue reported on code.google.com by ashok.ha...@gmail.com on 20 Jun 2011 at 10:39

GoogleCodeExporter commented 9 years ago

Original comment by reaganmb...@gmail.com on 18 Jan 2012 at 1:26