{"action":"created","issue":{"url":"https://api.github.com/repos/medic/medic-webapp/issues/1911","repository_url":"https://api.github.com/repos/medic/medic-webapp","labels_url":"https://api.github.com/repos/medic/medic-webapp/issues/1911/labels{/name}","comments_url":"https://api.github.com/repos/medic/medic-webapp/issues/1911/comments","events_url":"https://api.github.com/repos/medic/medic-webapp/issues/1911/events","html_url":"https://github.com/medic/medic-webapp/issues/1911","id":133327831,"number":1911,"title":"Postgres needs to support Contacts in a sane way","user":{"login":"btbonval","id":880439,"avatar_url":"https://avatars.githubusercontent.com/u/880439?v=3","gravatar_id":"","url":"https://api.github.com/users/btbonval","html_url":"https://github.com/btbonval","followers_url":"https://api.github.com/users/btbonval/followers","following_url":"https://api.github.com/users/btbonval/following{/other_user}","gists_url":"https://api.github.com/users/btbonval/gists{/gist_id}","starred_url":"https://api.github.com/users/btbonval/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/btbonval/subscriptions","organizations_url":"https://api.github.com/users/btbonval/orgs","repos_url":"https://api.github.com/users/btbonval/repos","events_url":"https://api.github.com/users/btbonval/events{/privacy}","received_events_url":"https://api.github.com/users/btbonval/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/medic/medic-webapp/labels/2%20-%20Active%20Work","name":"2 - Active Work","color":"bfd4f2"}],"state":"open","locked":false,"assignee":{"login":"btbonval","id":880439,"avatar_url":"https://avatars.githubusercontent.com/u/880439?v=3","gravatar_id":"","url":"https://api.github.com/users/btbonval","html_url":"https://github.com/btbonval","followers_url":"https://api.github.com/users/btbonval/followers","following_url":"https://api.github.com/users/btbonval/following{/other_user}","gists_url":"https://api.github.com/users/btbonval/gists{/gist_id}","starred_url":"https://api.github.com/users/btbonval/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/btbonval/subscriptions","organizations_url":"https://api.github.com/users/btbonval/orgs","repos_url":"https://api.github.com/users/btbonval/repos","events_url":"https://api.github.com/users/btbonval/events{/privacy}","received_events_url":"https://api.github.com/users/btbonval/received_events","type":"User","site_admin":false},"milestone":null,"comments":5,"created_at":"2016-02-12T19:49:09Z","updated_at":"2016-03-04T07:49:09Z","closed_at":null,"body":"Generally, contacts is JSON and could be parsed using Postgres JSON stuff into views. This would be broken down into a view for CHPs, a view for patients, a view for this or that other kind of contact.\r\n\r\nHowever, it sounds like LG will need to add extra data for CHPs (if not other sorts of contacts), which would be best facilitated by making and populating a table. This would be node work.\r\n\r\nAlternatively, make views of contacts could work if there is a table with primary key of UUID for storing only extra parameters. Then create a secondary view which combines this or that contacts view with the extra table information.\r\n\r\nThis is unique to 0.6 / LG, so there shouldn't be much for backwards compatibility considerations.\r\n\r\nIdeally this is done by Feb 15, but realistically it must be done by Feb 19."},"comment":{"url":"https://api.github.com/repos/medic/medic-webapp/issues/comments/192169443","html_url":"https://github.com/medic/medic-webapp/issues/1911#issuecomment-192169443","issue_url":"https://api.github.com/repos/medic/medic-webapp/issues/1911","id":192169443,"user":{"login":"btbonval","id":880439,"avatar_url":"https://avatars.githubusercontent.com/u/880439?v=3","gravatar_id":"","url":"https://api.github.com/users/btbonval","html_url":"https://github.com/btbonval","followers_url":"https://api.github.com/users/btbonval/followers","following_url":"https://api.github.com/users/btbonval/following{/other_user}","gists_url":"https://api.github.com/users/btbonval/gists{/gist_id}","starred_url":"https://api.github.com/users/btbonval/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/btbonval/subscriptions","organizations_url":"https://api.github.com/users/btbonval/orgs","repos_url":"https://api.github.com/users/btbonval/repos","events_url":"https://api.github.com/users/btbonval/events{/privacy}","received_events_url":"https://api.github.com/users/btbonval/received_events","type":"User","site_admin":false},"created_at":"2016-03-04T07:49:09Z","updated_at":"2016-03-04T07:49:09Z","body":"Contacts appear to use JSON, so I could theoretically use VIEWs instead of TABLEs for this stuff.\r\n\r\nIf I go that route, I'll need one table with contact.uuid as PK and any custom fields that people need to apply to contacts. Possibly I would make one such table per contact type. Also possibly, I could not bother until there was a need, just so long as the plan exists to handle the situation when it arises. It has been noted that there can/will be CHP fields which are not currently in the CouchDB."}}