Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usages for fhir_patch_resource functions ? #158

Open
sh0umik opened this issue Sep 22, 2016 · 2 comments
Open

Usages for fhir_patch_resource functions ? #158

sh0umik opened this issue Sep 22, 2016 · 2 comments

Comments

@sh0umik
Copy link

sh0umik commented Sep 22, 2016

I am using the update functions , It works well but it replaces the old resources doesn’t not update the fields with new value . I am looking for patch update like just updating names or address in the entire resource with the old value ..

Right now I have a whole patient resource with all the data if i try to patch update like this

SELECT fhir_patch_resource('{"resource": {"resourceType": "Patient", "id": "35", "name": [{"given": ["John"], "family": ["Smith"]}]}}'); 

Then I get this error ..

ERROR: TypeError: Cannot read property 'length' of undefined DETAIL: plv8_init() LINE 6234: var results = new Array(patches.length), p = 0, plen = patches.length, patch, key; ********** Error **********

Is there any way to do a PATCH update in fhirbase . If not then looking forward for this feature . It would make the CRUD function complete .

@niquola
Copy link
Member

niquola commented Sep 22, 2016

That's by FHIR design. patch function is applying json-patch to resource (
http://jsonpatch.com/).

On 22 September 2016 at 13:28, Fahim Shariar Shoumik <
[email protected]> wrote:

I am using the update functions , It works well but replaces the old
recources doesnt not update the fields with new value . I am looking for
patch update like just updating names or address in the entire resource
with the old value ..

Right now I have a whole patient resource with all the data if i try to
patch update like this

SELECT fhir_patch_resource('{"resource": {"resourceType": "Patient", "id": "35", "name": [{"given": ["John"], "family": ["Smith"]}]}}');

Then I get this error ..

ERROR: TypeError: Cannot read property 'length' of undefined
DETAIL: plv8_init() LINE 6234: var results = new Array(patches.length), p
= 0, plen = patches.length, patch, key;
********** Error **********

Is there any way to do a PATCH update in fhirbase . If not then looking
forward for this feature . It would make the CRUD function complete .


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#158, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAB9Qo61grqIfLHKQabcs8ofoiYU5Dhmks5qssizgaJpZM4KENqL
.

@sh0umik
Copy link
Author

sh0umik commented Sep 22, 2016

Thank you @niquola for you quick reply . Can you leave an API example of how we could use json patch to fhirbase fhir_patch_resource function ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants