Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Twitter

Categories

In this Discussion

El fin de este foro es dar soporte gratuito y comercial a los distintos productos y servicios de CaboLabs.com. El soporte gratuito se brinda en los foros de acceso público y no tiene garantía de tiempo mínimo de respuesta. El soporte comercial se brinda en foros privados donde se garantiza una respuesta dentro de las 24 horas.

Composition commit

vigvig
edited October 2017 in EHRServer
I create composition with $ opt source.opt . 1
(https://gist.github.com/vig/974288064458c4b8b67351c1c0459594)

when I send POST request to http://192.168.158.124:8090/ehr/api/v1/ehrs/11111111-1111-1111-1111-111111111111/compositions?format=xml&auditSystemId=popo&auditCommitter=pepe
curl -H 'Content-type: application/xml; Authorization: Bearer ...' -d @openEHR-EHR-COMPOSITION.common_examination.v1_20171009114038_1.xml -X POST 'http://192.168.158.124:8090/ehr/api/v1/ehrs/11111111-1111-1111-1111-111111111111/compositions?format=xml&auditSystemId=popo&auditCommitter=pepe'

I'm getting mysql error com.mysql.jdbc.MysqlDataTruncationMessageData truncation: Data too long for column 'params_elt' at row 1
https://gist.github.com/vig/94d383feb7be8055d9ac3607ada28c80

I've done
mysql> alter table commit_params modify params_elt VARCHAR(20844);
so now I can see request in this column.


I now i've got 402.1 error
< message >versions should have one or more items and has none< /message >
< code >EHR_SERVER::API::RESPONSE_CODES::402.1< /code >
How properly create composition with 'versions' tag?

thanks in advance,
Valentine.
Tagged:

Comments

  • edited October 2017
    It seems the XML is being send as a parameter, not in the request body, because the error on the table is because the Commit saves the requests params and those should be < 255 in length (format, auditSystemId, auditCommitter).



    The other error is telling me the XML is not on the body. The body of the request should be <versions ...">
    <version xsi:type="ORIGINAL_VERSION">

    That is mentioned on the guide for the commit endpoint. and there is a sample XML.

    Also the new Insomnia script has an example, check the /api folder of the EHRServer project in the master branch.



    This curl is generated from Insomnia:

    curl --request POST \
      --url 'http://192.168.1.105:8090/ehr/api/v1/ehrs/11111111-1111-1111-1111-111111111111/compositions?auditCommitter=Gregory House, MD.&amp;auditSystemId=my.emr' \
      --header 'authorization: Bearer eyJhb...fD2zb33z4=' \
      --header 'content-type: application/xml' \
      --cookie JSESSIONID=88090161A4DE67885AC6F7AD6E7C026B \
      --data '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <versions xmlns="http://schemas.openehr.org/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <version xsi:type="ORIGINAL_VERSION">
      <contribution>
        <id xsi:type="HIER_OBJECT_ID">
          <value>893f9cf3-fb32-4f12-a11c-c148b450db82</value>
        </id>
        <namespace>EHR::COMMON</namespace>
        <type>CONTRIBUTION</type>
      </contribution>
      <commit_audit>
        <system_id>CABOLABS_EHR</system_id>
        <committer xsi:type="PARTY_IDENTIFIED">
          <name>Dr. Pablo Pazos</name>
        </committer>
        <time_committed>
          <value>2017-10-12T23:18:24.953Z</value>
        </time_committed>
        <change_type>
          <value>creation</value>
          <defining_code>
            <terminology_id>
              <value>openehr</value>
            </terminology_id>
            <code_string>249</code_string>
          </defining_code>
        </change_type>
      </commit_audit>
      <uid>
        <value>bbdfea95-794d-4e3b-96dd-fcbbb5250f35::EMR_APP::1</value>
      </uid>
      <data xsi:type="COMPOSITION" archetype_node_id="openEHR-EHR-COMPOSITION.test_all_datatypes.v1">
        ...
       <content xsi:type="OBSERVATION" archetype_node_id="openEHR-EHR-OBSERVATION.test_all_datatypes.v1">
          <name>
            <value>Blood Pressure</value>
          </name>
          <language>
             <terminology_id>
               <value>ISO_639-1</value>
             </terminology_id>
             <code_string>es</code_string>
           </language>
           <encoding>
             <terminology_id>
               <value>UNICODE</value>
             </terminology_id>
             <code_string>UTF-8</code_string>
          </encoding>
          <subject xsi:type="PARTY_SELF"/>
          <data xsi:type="HISTORY" archetype_node_id="at0001">
            <name>
              <value>history</value>
            </name>
            <origin>
              <value>2017-10-12T23:18:24.954Z</value>
            </origin>
            <events xsi:type="POINT_EVENT" archetype_node_id="at0002">
              <name>
                <value>any event</value>
              </name>
              <time><value>2017-10-12T23:18:24.954Z</value></time>
              <data xsi:type="ITEM_TREE" archetype_node_id="at0003">
                <name>
                  <value>Arbol</value>
                </name>
                <items xsi:type="ELEMENT" archetype_node_id="at0011">
                  <name>
                    <value>Count</value>
                  </name>
                  <value xsi:type="DV_COUNT">
                    <magnitude>3</magnitude>
                  </value>
                </items>
              </data>
            </events>
          </data>
        </content>
      </data>
      <lifecycle_state>
        <value>completed</value>
        <defining_code>
          <terminology_id>
            <value>openehr</value>
          </terminology_id>
          <code_string>532</code_string>
        </defining_code>
      </lifecycle_state>
    </version>
    </versions>'

  • vigvig
    edited October 2017
    Is it possible to properly create composition (XML) with 'versions' tag with opt script?
    how do you make composition with 'versions' tag?
  • The goal of openEHR-OPT is to generate valid versions and compositions, not commits to the EHRServer, but that can be added easily since it is just one extra tag. What I do is adding the versions tag manually while testing, this requires just a couple of seconds to do.
  • Thanks, Pablo!
  • In the future we might change that to commit multiple "version" as multi-part, need to test that, but that change won't be on the next release.
Sign In or Register to comment.