LandRegistry/system-of-record-alpha

Name: system-of-record-alpha

Owner: HM Land Registry

Description: The system of record holds titles in an immutable datastore

Created: 2014-06-15 19:47:41.0

Updated: 2015-01-22 12:24:59.0

Pushed: 2014-12-19 16:50:59.0

Homepage:

Size: 1011

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

System of Record

Build Status

Coverage Status

Storage of minted title entries

Service to create new versions of a title, hashed and signed.

Try it out

Check out the repo. Then cd into the repo directory:

Create a virtualenv (assuming you have virtualenv and virtualenvwrapper installed)

irtualenv system-of-record

Install some stuff

Install dependencies into the virtualenv

install -r requirements
Create a local Postgres db.

Assuming you have postgres 9.3 installed and running

OSX
teuser -s sysofrec

That should work out of the box if you're on OSX using Postgres.app.

Create the sysofrec database

tedb -U sysofrec -O sysofrec sysofrec -T template0

Export a couple of environment variables

For the moment export the following:

rt SETTINGS='config.Config'
rt  DATABASE_URL='postgresql://localhost/sysofrec'

For the future you can create a .env file alongside the Profile with this content

INGS=config.Config
BASE_URL=postgresql://localhost/sysofrec

It's a special file that if sitting alongside a Procfile, foreman will use to create the environment variables contained. So anytime you run using the run.sh (which uses foreman) these will be set.

psycopg on Mac

If `pip install -r requirements.txt` fail on Mac, try pointing your PATH to Postgres.App:

export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.3/bin
Linux

The intial createuser may ask for a password and whether user should be super user. If so, add a password and and say yes to give all privileges. This is only for local development so let's be relaxed. If you have created the user with a password change the last line of .env to this:

rt export DATABASE_URL='postgresql://sysofrec:password@localhost/sysofrec'
Create the schema

There's an intial migration script in the project created using Flask-Migrate so you just need to call the following

on manage.py db upgrade

On heroku run this

ku run python manage.py db upgrade --app lr-system-of-record

Run the upgrade command whenever you have additional migrations

Install and start Redis to enqueue data for the feeder
 install redis

s-server
Run the app
n.sh

PUT some data

 -X PUT -H "Content-Type: application/json"  http://localhost:8000/titles/TEST_AB1234567 \
{ "title":
    {
        "title_number": "TEST_AB1234567",
        "proprietors": [
            {
                "first_name": "firstname",
                "last_name": "lastname"
            }
        ],
        "property" : {
            "address": {
                "house_number": "house number",
                "road": "road",
                "town": "town",
                "postcode": ""
            },
            "tenure": "freehold",
            "class_of_title": "absolute"
        },
        "payment": {
            "price_paid": "12345",
            "titles": ["TEST_AB1234567"]
        }
    }
}'

GET some data

 -H "Accept: application/json"  http://localhost:8000/titles/TEST_AB1234567

Which should return:


itle": {
"data": "{u'title': {u'proprietors': [{u'first_name': u'firstname', u'last_name': u'lastname'}], u'title_number': u'TEST_AB1234567', u'property': {u'tenure': u'freehold', u'class_of_title': u'absolute', u'address': {u'house_number': u'house number', u'town': u'town', u'postcode': u'', u'road': u'road'}}, u'payment': {u'titles': [u'TEST_AB1234567'], u'price_paid': u'12345'}}}",
"number": "TEST_AB1234567"


Seeing everything in the store
 -H "Accepts application/json"  http://localhost:8000/titles
Run the tests
rt SETTINGS='config.TestConfig'
est
TODO

Check incoming title entry for integrity using public key.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.