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

patient update bug #4

Closed
wanghaisheng opened this Issue Aug 5, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@wanghaisheng

wanghaisheng commented Aug 5, 2014

I create a patient resource successfully: http://fhirtest.uhn.ca/base/Patient/1658

<Patient xmlns="http://hl7.org/fhir">
    <text>
      <status value="generated"/>
      <div xmlns="http://www.w3.org/1999/xhtml">Zimmerman, Mr Brian,</div>
    </text>
    <identifier>
      <use value="usual"/>
      <label value="URNo"/>
      <value value="89532"/>
    </identifier>
    <name>
      <text value="王海生"/>
      <family value="王"/>
      <given value="海生"/>
    </name>
    <telecom>
      <system value="phone"/>
      <value value="9899 9878"/>
      <use value="home"/>
    </telecom>
    <telecom>
      <system value="email"/>
      <value value="zimmerman@datacorp.com.au"/>
      <use value="home"/>
    </telecom>
    <gender>
      <coding>
        <system value="http://hl7.org/fhir/v3/AdministrativeGender"/>
        <code value="M"/>
        <display value="Male"/>
      </coding>
      <text value="Male"/>
    </gender>
    <birthDate value="1986-07-10"/>
    <address id="1c1f583f220d4c06984909210ba9e6ed">
      <use value="home"/>
      <text value="99 Houston Road, BENTLEIGH, 3204"/>
      <line value="99 Houston Road"/>
      <city value="BENTLEIGH"/>
      <state value="Victoria"/>
      <zip value="3204"/>
      <period>
        <start value="2006-06-17"/>
      </period>
    </address>
    <active value="true"/>
</Patient>

then I want to update this one with the following :PUT http://fhirtest.uhn.ca/base/Patient/1658

<Patient xmlns="http://hl7.org/fhir">
    <text>
      <status value="generated"/>
      <div xmlns="http://www.w3.org/1999/xhtml">Zimmerman, Mr Brian,</div>
    </text>
    <identifier>
      <use value="usual"/>
      <label value="URNo"/>
      <value value="89532"/>
    </identifier>
    <name>
      <text value="王海生"/>
      <family value="王"/>
      <given value="海生"/>
    </name>
    <telecom>
      <system value="phone"/>
      <value value="9899 9878"/>
      <use value="home"/>
    </telecom>
    <telecom>
      <system value="email"/>
      <value value="zimmerman@datacorp.com.au"/>
      <use value="home"/>
    </telecom>
    <gender>
      <coding>
        <system value="http://hl7.org/fhir/v3/AdministrativeGender"/>
        <code value="M"/>
        <display value="Male"/>
      </coding>
      <text value="Male"/>
    </gender>
    <birthDate value="1986-07-10"/>
    <address id="1c1f583f220d4c06984909210ba9e6ed">
      <use value="home"/>
      <text value="99 Houston Road, BENTLEIGH, 3204"/>
      <line value="99 Houston Road"/>
      <city value="BENTLEIGH"/>
      <state value="Victoria"/>
      <zip value="3204"/>
      <period>
        <start value="2006-06-16"/>
      </period>
    </address>
    <active value="true"/>
</Patient>

Then I get the following info:

    Status Code: 204 No Content
    Access-Control-Allow-Origin: *
    Connection: close
    Content-Length: 0
    Content-Type: text/plain; charset=UTF-8
    Date: Tue, 05 Aug 2014 08:57:04 GMT
    Location: http://fhirtest.uhn.ca/base/Patient/1658/_history/6
    Server: GlassFish Server Open Source Edition 4.0
    X-Powered-By: HAPI FHIR 0.5-SNAPSHOT RESTful Server
    access-control-allow-methods: GET, POST, PUT, DELETE
    access-control-expose-headers: Content-Location

@jamesagnew

This comment has been minimized.

Owner

jamesagnew commented Aug 5, 2014

Hello,

This is actually expected behaviour. According to the FHIR specs, if an update is successful the server can either return an HTTP 200 with an OperationOutcome resource, or just return an HTTP 204 and no response body. The key is in the location header returned, which tells you the new version ID that has been created.

@wanghaisheng

This comment has been minimized.

wanghaisheng commented Aug 5, 2014

in the specification section 2.1.8
"If the interaction is successful, the server SHALL return either a 200 OK if the resource was updated, or a 201 Created if the resource was created, with a Last-Modified header, and a Location and Content-Location header that refers to the specific version created by the update interaction. The server MAY send an OperationOutcome resource with hints and warnings about the resource; if one is sent it SHALL not include any errors. "
I dont see the 204 status code

2014-08-05

王海生
15901958021

发件人:James Agnew notifications@github.com
发送时间:2014-08-05 19:39
主题:Re: [hapi-fhir] patient update bug (#4)
收件人:"jamesagnew/hapi-fhir"hapi-fhir@noreply.github.com
抄送:"wanghaisheng"edwin_uestc@163.com

Hello,
This is actually expected behaviour. According to the FHIR specs, if an update is successful the server can either return an HTTP 200 with an OperationOutcome resource, or just return an HTTP 204 and no response body. The key is in the location header returned, which tells you the new version ID that has been created.

Reply to this email directly or view it on GitHub.

@jamesagnew jamesagnew closed this in 1793f6d Aug 5, 2014

@jamesagnew

This comment has been minimized.

Owner

jamesagnew commented Aug 5, 2014

Thanks wanghaisheng, you are right! Sorry about that.

This has been corrected, I will deploy a new version of the server today that contains the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment