<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[SIL-Thailand - Medium]]></title>
        <description><![CDATA[Thailand’s sandbox for digital health standards - Medium]]></description>
        <link>https://medium.com/thai-fhir-sig?source=rss----40876970312e---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>SIL-Thailand - Medium</title>
            <link>https://medium.com/thai-fhir-sig?source=rss----40876970312e---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 12:40:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/thai-fhir-sig" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[FHIR Shorthand]]></title>
            <link>https://medium.com/thai-fhir-sig/fhir-shorthand-2bffc4a46458?source=rss----40876970312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/2bffc4a46458</guid>
            <category><![CDATA[profile]]></category>
            <category><![CDATA[fhir]]></category>
            <category><![CDATA[fsh]]></category>
            <category><![CDATA[sushi]]></category>
            <dc:creator><![CDATA[SIL-Thailand]]></dc:creator>
            <pubDate>Fri, 16 Jul 2021 10:56:05 GMT</pubDate>
            <atom:updated>2021-07-16T10:56:05.475Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*-33_8UVQGPVO9qoNki2GPA.png" /><figcaption>Image source: <a href="http://hl7.org/fhir/uv/shorthand/overview.html">hl7.org</a></figcaption></figure><p>Resources ต่างๆ ใน FHIR ได้รับการออกแบบโดยคํานึงถึงกฎ 80/20 โดยมุ่งเน้นที่ requirement 20% ที่ตอบสนองด้านการทํางานร่วมกัน (Interoperability) 80% ดังนั้น ในการนำ FHIR resources ไปใช้งานในบริบทต่างๆ ควรมีการทำ Profile เพื่อ</p><ul><li>กำหนด contraint ให้กับ element ต่างๆ ใน resource เมื่อนิยามของ resource เดิมนั้นกว้างเกินไป (too generic)</li><li>กำหนด extension ให้กับ resource เมื่อนิยามของ resource เดิมนั้นไม่เพียงพอต่อการใช้งาน</li></ul><p>ในการสร้าง FHIR Profile หรือ Implemention Guide (IG) สามารถทำได้โดยใช้วิธีการหรือเครื่องมือต่างๆ แต่ละวิธีมีข้อดี ข้อเสียแตกต่างกันไป</p><ul><li>สร้างหรือแก้ไข FHIR Conformance artifacts เช่น StructureDefinition และ ValueSet เอง​ (manual editing) ตั้งแต่เริ่มต้น เป็นงานใหญ่และซับซ้อนตั้งแต่เริ่ม แต่มีข้อดีคือ ผู้นิพนธ์สามารถควบคุมได้อย่างเต็มที่ในทุกแง่มุม</li><li>Excel spreadsheet เป็นวิธีดั้งเดิมที่เคยใช้เป็นการภายในตั้งแต่พัฒนา FHIR รุ่นแรกๆ ข้อเสียคือการจัดการเวอร์ชันนั้นเป็นเรื่องยาก ไฟล์จะถูกบันทึกในรูปแบบของ Excel ซึ่งเนื้อหาผสมกับคําสั่งการจัดรูปแบบ (<a href="https://confluence.hl7.org/display/FHIR/FHIR+Spreadsheet+Profile+Authoring">FHIR Spreadsheet Profile Authoring</a>)</li><li><a href="https://fire.ly/products/forge/">Forge</a>/<a href="https://fire.ly/products/simplifier-net/">Simplifier</a> และ <a href="https://www.lantanagroup.com/our-software-products/trifolia-on-fhir/">Trifolia-on-FHIR</a> เป็น form-based GUI ที่ช่วยทำให้การสร้าง FHIR profile หรือ Implementation Guide (IG) นั้นง่ายขึ้นมาก แต่การกรอกข้อมูลในแต่ละช่องของฟอร์มทีละหน้าอาจจะไม่เป็นที่ชื่นชอบสำหรับ developer เท่าใดนัก</li></ul><p><strong>FHIR Shorthand</strong> (<strong>FSH</strong> อ่านออกเสียงเป็น ฟิช) เป็นภาษาสคริปต์ที่ใช้สำหรับนิยาม FHIR artifacts ที่ใช้สำหรับสร้าง Profile และ Implementation Guide (IG)</p><p>FSH เป็นภาษาที่ออกแบบมาสำหรับการทำ profile และ IG ทำให้การสร้างและ maintenance FHIR profile และ IG นั้นสะดวก รวดเร็ว scalable และ developer-friendly มากกว่าวิธีอื่นๆ มีความคล่องตัวในการแก้ไขกว่าการใช้ GUI tools เช่น cut/copy/paste, search และ replace, spell checking และเนื่องจากเป็นมาตรฐานจาก HL7 FHIR เองจึงมั่นใจได้ในความเสถียรและการพัฒนาที่ต่อเนื่อง</p><p>เครื่องมือที่เป็น reference implementationใช้ในการแปลง FSH เป็น FHIR artifacts คือ <strong>SUSHI</strong> (อ่านออกเสียงเป็นซูชิ 🍣🤤 ย่อมาจาก <strong>S</strong>USHI <strong>U</strong>nshortens <strong>Sh</strong>ortHand <strong>I</strong>nputs) SUSHI สามารถติดตั้งและใช้งานในเครื่องของ developer ได้โดยตรง (<a href="https://fshschool.org/docs/sushi/installation/">วิธีการติดตั้ง</a> ผ่าน npm ต้องการ node.js)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yofSLpIxfnS06ONQbbIykw.png" /><figcaption>Image source: <a href="http://hl7.org/fhir/uv/shorthand/overview.html">hl7.org</a></figcaption></figure><p>สคริปต์ภาษา FSH เป็นไฟล์ข้อความธรรมดา (text file) ที่มี extension เป็น .fsh จึงสามารถแจกจ่าย สนับสนุนการทำงานเป็นทีม และ version-control tools เช่น GitHub เป็นอย่างดี สำหรับ code editor ยอดนิยมอย่าง Visual Studio Code นั้นมี <a href="https://marketplace.visualstudio.com/items?itemName=kmahalingam.vscode-language-fsh">extension</a> สำหรับ FSH syntax highlighting ใน marketplace อีกด้วย</p><p>เอกสาร (documentation) ของ SUSHI และ tutorial ของภาษา FSH จะแยกไปอยู่บน web site ต่างหากชื่อว่า FSH School (<a href="https://fshschool.org/">https://fshschool.org/</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SbPdroHL-UKmbemsig8pDg.png" /></figure><p>นอกจากนี้ บน FSH School ยังมี FSH Playground ให้ทดลอง FSH แบบ online ก่อนโดยไม่ต้องติดตั้ง SUSHI ไว้ในเครื่องแต่อย่างใด</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wopdGGeoH2yAcuilHbZE9Q.png" /></figure><h3>ทดลองสร้าง profile ด้วย FSH และ SUSHI</h3><p>ใน standard <a href="http://hl7.org/fhir/R4/patient.html#resource">Patient</a> resource เดิมกำหนด cardinality สำหรับ element gender และ maritalStatus เป็น 0..1 ทั้งคู่ ใน profile SILTHPatientProfile ที่จะสร้างจะบังคับให้ต้องมีข้อมูล gender และไม่ต้องมีข้อมูล maritalStatus ได้โดยการกำหนด ขอบเขต cardinality ใหม่ใน profile</p><p>หลังจากคลิกที่ Convert to JSON เพื่อสร้าง FHIR artifact จาก FSH, SUSHI จะสร้าง resource StructureDefinition ของ profile SILTHPatientProfile ในรูปแบบ JSON format</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cQ_IHuc2Y--g0RTHgamP6g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XRPq7Dokr6NShbHYauV-rg.png" /></figure><p>ตามข้อกำหนดของ FHIR อนุญาตให้กำหนด cardinality ของ element ใน resource โดยที่ขอบเขตไม่ขัดแย้งหรือกว้างกว่า cardinality ของ standard resource หรือ profile เดิมที่นำมาใช้เป็นฐาน เช่น cardinality เดิมของ element เป็น 0..1 หรือ 0..* จะสามารถกำหนด cardinality ใหม่ใน profile เป็น 0..0 (ไม่มี) หรือ 1..1 (ต้องมีและมีไม่เกิน 1 เท่านั้น) แต่ถ้า cardinality เดิมของ element เป็น 0..0 จะไม่สามารถกำหนดเป็น 0..1 หรือ 1..1 และเดิมเป็น 1..1 จะไม่สามารถกำหนดเป็น 0..0 หรือ 0..1 ได้ เช่นกัน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lEbOmFKLEOqhF4YxkdenEw.png" /></figure><p>ใน profile MyPatientProfile กำหนด cardinality ของ element maritalStatus กว้างกว่าใน profile SILTHPatientProfile ที่ใช้เป็นฐาน SUSHI จะแจ้ง error message ระบุความผิดพลาดที่เกิดขึ้น</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7NNTs1gQsKxks7Ag8xdB6g.png" /></figure><h3>ทดลองเพิ่ม Extension</h3><p>ใน FSH สามารถกำหนด extension ใหม่ได้โดยใช้ keyword Extension แต่โดยปกติก่อนที่จะสร้าง extension ขึ้นมาใหม่ ควรตรวจสอบดูก่อนว่า extension ที่ต้องการเคยมีการกำหนดไว้ขึ้นมาแล้วหรือไม่</p><p>ใน standard Patient resource เดิมมีแต่ element birthDate ที่มี data type เป็น date ไม่มี element สำหรับข้อมูลเวลาเกิดซึ่งอาจมีความจำเป็นต้องใช้หากเป็นข้อมูลสำหรับ Patient ที่เป็นเด็กแรกเกิด ก่อนที่จะสร้าง extension ขึ้นมาใหม่ สอบค้น extension ที่ต้องการ พบว่าใน HL7 FHIR มีการกำหนด extention <a href="https://www.hl7.org/fhir/extension-patient-birthtime.html">birthTime</a> ที่มี data type เป็น dateTime ไว้แล้ว จึงไม่จำเป็นต้องนิยาม extention ขึ้นมาใหม่ สามารถแทรก extention ที่ต้องการเข้าไปใน profile ได้เลย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tYJdKRTHRxN8xc0Zwl2Saw.png" /></figure><p>ดูรายละเอียดเพิ่มเติมของ FSH Language ได้ที่</p><ul><li><a href="http://hl7.org/fhir/uv/shorthand/overview.html#basics">Basics</a></li><li><a href="http://hl7.org/fhir/uv/shorthand/reference.html">Complete Language Reference</a></li><li><a href="https://fshschool.org/downloads/201118_Mark_Kramer_Introduction_To_FHIR_Shorthand.pdf">Introduction to FHIR Shorthand</a> @FHIR DevDays, November 2020 (<a href="https://youtu.be/RfmqpUA606U">YouTube</a>)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2bffc4a46458" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thai-fhir-sig/fhir-shorthand-2bffc4a46458">FHIR Shorthand</a> was originally published in <a href="https://medium.com/thai-fhir-sig">SIL-Thailand</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Manipulating FHIR Resource: HAPI FHIR API]]></title>
            <link>https://medium.com/thai-fhir-sig/manipulating-fhir-resource-hapi-fhir-api-4b96fcb24711?source=rss----40876970312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/4b96fcb24711</guid>
            <category><![CDATA[hapi]]></category>
            <category><![CDATA[demo]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[fhir]]></category>
            <category><![CDATA[crud]]></category>
            <dc:creator><![CDATA[SIL-Thailand]]></dc:creator>
            <pubDate>Fri, 17 Apr 2020 15:57:53 GMT</pubDate>
            <atom:updated>2020-09-17T16:27:16.571Z</atom:updated>
            <content:encoded><![CDATA[<p>จัดการ FHIR Resource ผ่าน Java Programming API: HAPI FHIR</p><p>ในตอนนี้จะเป็นการจัดการ FHIR resource ด้วย programming API ใน Java platform</p><h3>HAPI</h3><p>HAPI (HL7 API) project เป็น open-source implementation ของ HL7 specification ใน Java platform ตั้งแต่ HL7 ยังเป็นรุ่น 2.x เริ่มต้นโดย University Health Network (UHN) <a href="https://www.uhn.ca/">(https://www.uhn.ca/</a>) ซึ่งเป็นกลุ่มเครือข่ายโรงพยาบาลขนาดใหญ่หลายแห่งที่มีการสอนบุคลากรทางการแพทย์ในระดับคลินิก (teaching hospital) ในเมือง Toronto, ประเทศ Canada</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/221/1*0DeU_iFRF80rIHKnOeCTog.jpeg" /><figcaption>James Agnew</figcaption></figure><p>โดยมี James Agnew ซึ่งเป็น Lead Architect ของ Centre for Global eHealth Innovation ของ UHN และหนึ่งในสมาชิกของ FHIR Core Team เป็น project leader ของ HAPI project</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I8ndAhMepQDNecjnBRxvdg.jpeg" /><figcaption>James Agnew at Regional FHIR Workshop, ADB HQ, Manila, Philippines</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/266/1*J31aVNUKNr6agp7fv6PdAg.png" /><figcaption>New HAPI FHIR mascot</figcaption></figure><p>HAPI FHIR (<a href="https://hapifhir.io/">https://hapifhir.io</a>) เป็น library ที่เป็น open-source implementation ของมาตรฐาน HL7 FHIR บน Java platform</p><p>HAPI FHIR รุ่นล่าสุดคือรุ่น 4.2.0 สนับสนุน JDK ตั้งแต่รุ่น JDK8 ขึ้นมา และสนับสนุน FHIR ตั้งแต่รุ่น DSTU2, DSTU3, R4 (HL7 FHIR รุ่น DSTU3 เปลี่ยนชื่อเป็น STU3 ในเวลาต่อมา แต่ใน HAPI ยังใช้ DSTU3 อยู่ตามเดิม เพื่อให้ code เดิมยังใช้งานต่อได้)</p><p>HAPI FHIR มี class library สำหรับ resource และ data type ทุกประเภทที่กำหนดโดยข้อกำหนด FHIR ตัวอย่างเช่น class สำหรับ Patient resource หากดู <a href="https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-structures-r4/org/hl7/fhir/r4/model/Patient.html">JavaDoc</a> จะเห็น getters และ setters สำหรับ properties ต่างๆ ที่ประกอบขึ้นเป็น Patient resource</p><h4>FHIR Context</h4><p>ในการใช้งาน object ต่างๆ ที่สร้างขึ้นจาก class library นี้ จำเป็นต้องสร้าง FhirContext ขึ้นมาก่อน (<a href="https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-base/ca/uhn/fhir/context/FhirContext.html">JavaDoc</a>) FhirContext เป็นจุดเริ่มต้นสำหรับการใช้งาน HAPI และขึ้นอยู่กับรุ่นของ FHIR ที่ต้องการใช้งานในแอป</p><pre>// Create a context for DSTU3<br>FhirContext ctx = FhirContext.forDstu3();</pre><pre>// or create a context for R4<br>FhirContext ctx = FhirContext.forR4();</pre><p>FHIRContext เป็น object ที่ใช้ทรัพยากร จึงควรสร้าง object ไว้ครั้งเดียวและเก็บไว้ใช้งานตลอดทั้งแอปจนกว่าจะปิดแอป</p><h4>HAPI FHIR Modules</h4><p>Modules ที่สำคัญใน HAPI FHIR library สำหรับการใช้งาน ได้แก่</p><ul><li><strong>Core Library</strong>: hapi-fhir-base เป็น core HAPI FHIR library จำเป็นเสมอสำหรับการใช้งาน framework (<a href="https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-base/">JavaDoc</a>)</li><li><strong>Structure</strong>: เป็น library ของ model classes ต่างๆ จาก FHIR resources และ data types ขึ้นอยู่กับรุ่นของ FHIR ที่ต้องการสนับสนุน สำหรับรุ่น R4 คือ hapi-fhir-structures-r4 (<a href="https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-structures-r4/">JavaDoc</a>)</li><li><strong>Client Framework</strong>: hapi-fhir-client เป็น library ของ core FHIR client framework จำเป็นสำหรับการใช้งานฟังก์ชั่นต่างๆ ของ client ใน HAPI (<a href="https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-client/">JavaDoc</a>)</li><li><strong>Validation</strong>: เป็น library ของ FHIR Profile Validator ใช้เพื่อตรวจสอบความถูกต้องของข้อมูล Resources กับ FHIR Profiles</li><li><strong>Server</strong>: สำหรับใช้พัฒนา FHIR-compliant server กับ data storage ที่มีอยู่</li></ul><p>รายละเอียดของแต่ละ modules ดูได้จาก<a href="https://hapifhir.io/hapi-fhir/docs/introduction/modules.html">ที่นี่</a></p><h4>Importing HAPI FHIR</h4><p>วิธีที่ง่ายที่สุดในการใช้ HAPI FHIR คือการใช้ระบบ build system ที่จัดการ dependency โดยอัตโนมัติ ระบบจะช่วยดาวน์โหลดและเพิ่ม library ที่ต้องการใน classpath ในที่นี้จะใช้ระบบของ Apache <a href="http://maven.apache.org/">Maven</a></p><p>ใน Maven project file (pom.xml) ต้องมี HAPI FHIR core JAR และ Structure JAR (อย่างน้อย 1 รุ่นที่ต้องการ)</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;ca.uhn.hapi.fhir&lt;/groupId&gt;<br>    &lt;artifactId&gt;hapi-fhir-base&lt;/artifactId&gt;<br>    &lt;version&gt;4.2.0&lt;/version&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;ca.uhn.hapi.fhir&lt;/groupId&gt;<br>    &lt;artifactId&gt;hapi-fhir-structures-r4&lt;/artifactId&gt;<br>    &lt;version&gt;4.2.0&lt;/version&gt;<br>&lt;/dependency&gt;</pre><p>หากต้องการใช้งานฟังก์ชั่นของ client ใน HAPI เพิ่ม module client รวมเข้าไป</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;ca.uhn.hapi.fhir&lt;/groupId&gt;<br>    &lt;artifactId&gt;hapi-fhir-client&lt;/artifactId&gt;<br>    &lt;version&gt;4.2.0&lt;/version&gt;<br>&lt;/dependency&gt;</pre><p>ต่อไปจะอ่านข้อมูลเดิมที่เคยสร้างไว้ด้วย clinFHIR และเก็บไว้ที่ Public test server ของ HAPI (<a href="http://hapi.fhir.org/baseR4">http://hapi.fhir.org/baseR4</a>)</p><h3>Reading FHIR Resource with HAPI</h3><p>สร้าง FHIR Context และ Generic Client สำหรับอ่านข้อมูล resource จาก server ที่เก็บข้อมูล resource</p><pre>FhirContext ctx = FhirContext.forR4();                                                  </pre><pre>IGenericClient client = ctx.newRestfulGenericClient(&quot;http://hapi.fhir.org/baseR4&quot;);</pre><h4>Patient Resource</h4><p>อ่านข้อมูล Patient resource, Id 921009 เก็บไว้ใน Patient object สำหรับใช้งาน</p><pre>Patient patient = client.read().resource(Patient.class).withId(&quot;921009&quot;).execute();</pre><p>แสดงผลข้อมูล Patient resource ใน data element ที่ต้องการ</p><pre>System.out.printf(&quot;NAME: %s%n&quot;, patient.getNameFirstRep().getNameAsSingleString());</pre><pre>System.out.printf(&quot;BIRTHDATE: %tF%n&quot;, patient.getBirthDate());</pre><p>โมเดลข้อมูล FHIR นั้นสมบูรณ์เพียงพอที่จะรองรับกรณีใช้งานทั่วไป แต่บางครั้งความสมบูรณ์นั้นเพิ่มความซับซ้อน ตัวอย่างเช่น ผู้ป่วยอาจมีได้หลายชื่อ (ชื่อที่เป็นทางการ ชื่อเล่น ฯลฯ ) element name ใน Patient resource จึงมี cardinality เป็น 0..* ของ data type HumanName หากใช้ method getName() (<a href="https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-structures-r4/org/hl7/fhir/r4/model/Patient.html#getName()">JavaDoc</a>) ใน HAPI FHIR จะส่งค่ากลับมาเป็น List&lt;HumanName&gt; แต่ HAPI FHIR มี method ที่ช่วยอำนวยความสะดวกในการส่งค่า HumanName แรกใน element name คือ getNameFirstRep() (<a href="https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-structures-r4/org/hl7/fhir/r4/model/Patient.html#getNameFirstRep()">JavaDoc</a>)</p><h4>Condition Resource</h4><p>แสดง Problem list จาก list ของ object Condition ที่มี subject=921009</p><pre>Bundle conditionBundle = client.search().forResource(Condition.class)<br>    .where(Condition.SUBJECT.hasId(&quot;921009&quot;))<br>    .returnBundle(Bundle.class).execute();</pre><pre>if(conditionBundle.hasEntry()) {<br>    System.out.println(&quot;PROBLEM LIST:&quot;);</pre><pre>    List&lt;BundleEntryComponent&gt; entries = conditionBundle.getEntry();</pre><pre>    int i = 1;<br>    for (BundleEntryComponent ent : entries) {<br>        Condition c = (Condition)ent.getResource();</pre><pre>        System.out.printf(&quot;%3d. %-40s %-12s %n&quot;, <br>            i++,<br>            c.getCode().getText(),<br>            c.getSeverity().getText());<br>    }<br>}</pre><p>Method execute() จะส่งค่ากลับมาเป็น object ชนิดเดียวกับ object ที่เรียก method นี้ ในตัวอย่างแรก withId() ถูกเรียกจาก method resource(Patient.class) เมื่อเรียก method execute() ต่อจึงได้ค่ากลับมาเป็น Patient object ส่วนในตัวอย่างที่สอง returnBundle() ถูกเรียกจาก method forResource(Condition.class).where(…) เมื่อเรียก method execute() ต่อจึงได้ค่ากลับมาเป็น Bundle object ที่สามารถ cast entry ใน Bundle ไปเป็น Condition object ได้</p><p>(JavaDoc: class <a href="https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-structures-r4/org/hl7/fhir/r4/model/Condition.html">Condition</a>, method <a href="https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-base/ca/uhn/fhir/rest/gclient/IClientExecutable.html#execute()">execute()</a>, <a href="https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-base/ca/uhn/fhir/rest/gclient/IReadTyped.html#withId(java.lang.String)">withId()</a>, <a href="https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-base/ca/uhn/fhir/rest/gclient/IRead.html#resource(java.lang.Class)">resource()</a>, <a href="https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-base/undefined/ca/uhn/fhir/rest/gclient/IUntypedQuery.html#forResource(java.lang.Class)">forResource()</a>, <a href="https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-base/undefined/ca/uhn/fhir/rest/gclient/IQuery.html#returnBundle(java.lang.Class)">returnBundle()</a> )</p><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*IjtoJ5akWFMNyTEtiJyyWg.png" /></figure><h4>Encounter Resource</h4><p>ในประเทศไทยอาจจะคุ้นเคยกับคำว่า “visit” สำหรับเรียกการมารับบริการในแต่ละครั้ง แต่ HL7 จะเรียกตรงนี้ว่า “encounter” <a href="https://www.hl7.org/fhir/encounter.html">(https://www.hl7.org/fhir/encounter.html</a>)</p><p>ค้นหา Encounter resource ที่มี subject=921009</p><pre>Bundle encounterBundle = client.search().forResource(Encounter.class)<br>    .where(Encounter.SUBJECT.hasId(&quot;921009&quot;))<br>    .returnBundle(Bundle.class).execute();</pre><pre>if(encounterBundle.hasEntry()) {<br>    System.out.println(&quot;ENCOUNTER LIST:&quot;);</pre><pre>    List&lt;BundleEntryComponent&gt; entries = encounterBundle.getEntry();</pre><pre>    for (BundleEntryComponent ent : entries) {<br>        Encounter e = (Encounter)ent.getResource();</pre><pre>        System.out.printf(&quot;DATE: %tF  TYPE: %-15s  PARTICIPANT: %s %n&quot;,<br>            e.getPeriod().getStart(),<br>            e.getTypeFirstRep().getText(), <br>            e.getParticipantFirstRep().getIndividual().getDisplay());<br>    }<br>}</pre><p>(JavaDoc: class <a href="https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-structures-r4/org/hl7/fhir/r4/model/Encounter.html">Encounter</a>)</p><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*OwMb5mXtFkKpzrSvYsI3JQ.png" /></figure><p>Full code listing:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f270c1432308cd5ab99b5a2452ac14fb/href">https://medium.com/media/f270c1432308cd5ab99b5a2452ac14fb/href</a></iframe><h4>หมายเหตุ:</h4><ul><li>Java ที่ใช้ demo เป็นรุ่น Java 11 ซึ่งอาจมี syntax หรือ method ที่ไม่เหมือนกับ Java 8</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b96fcb24711" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thai-fhir-sig/manipulating-fhir-resource-hapi-fhir-api-4b96fcb24711">Manipulating FHIR Resource: HAPI FHIR API</a> was originally published in <a href="https://medium.com/thai-fhir-sig">SIL-Thailand</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Manipulating FHIR Resource: client-py API]]></title>
            <link>https://medium.com/thai-fhir-sig/manipulating-fhir-resource-client-py-api-662d7629e31d?source=rss----40876970312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/662d7629e31d</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[fhir]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[SIL-Thailand]]></dc:creator>
            <pubDate>Sun, 12 Apr 2020 04:22:32 GMT</pubDate>
            <atom:updated>2020-09-17T15:02:02.924Z</atom:updated>
            <content:encoded><![CDATA[<p>จัดการ FHIR Resource ด้วย Python Programming API: client-py</p><h3>client-py</h3><p>หลังจากที่ทดลอง operation ต่างๆ กับ FHIR resource ผ่าน RESTful APIs กันแล้ว ในตอนนี้ จะทำการอ่านข้อมูลของ Resource จาก FHIR server ผ่าน Programming APIs โดยใช้ Python</p><p>Open Source FHIR implementations ที่เป็น Python คือ client-py</p><p><a href="https://github.com/smart-on-fhir/client-py">smart-on-fhir/client-py</a></p><h4>Installation</h4><p>client-py ใน pip package ยังเป็นเวอร์ชั่น 3.2.0 หากต้องการเวอร์ชั่น 4.0.0 ต้องติดตั้งจาก GitHub โดยตรง โดยใช้ pip3 หรือ python3 -m pip</p><p>python3 -m pip install git+https://github.com/smart-on-fhir/client-py.git</p><p>ตรวจสอบ package ที่ติดตั้งโดยใช้</p><p>python3 -m pip list | grep fhirclient หรือ</p><p>python -m pip list | findstr fhirclient (Windows)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/424/1*jRBErwIKEFHboYNlz1D0Jw.png" /></figure><h4>Code</h4><p>ในการติดต่อกับ FHIR server จะใช้ class FHIRServer ที่อยู่ใน namespace fhirclient.server</p><p>from fhirclient.server import FHIRServer</p><p>และ class Patient อยู่ใน namespace fhirclient.models ที่เป็น Python implementation ของ Resource models ต่างๆ ตาม FHIR specifications</p><p>from fhirclient.models.patient import Patient</p><p>สร้าง server object โดยใช้ constructor ของ class FHIRServer ตามนิยาม</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*N5by7r5e3F5XMxDfKAQ3Ug.png" /><figcaption>Source: <a href="http://docs.smarthealthit.org/client-py/classfhirclient_1_1server_1_1_f_h_i_r_server.html">http://docs.smarthealthit.org/client-py/classfhirclient_1_1server_1_1_f_h_i_r_server.html</a></figcaption></figure><p>ในตอนนี้ยังไม่ได้สร้าง client object, parameter client จึงใส่ค่าเป็น None ไว้ก่อน parameter base_uri ใส่ค่าเป็น URL ของ FHIR Server ที่ต้องการใช้งาน</p><p>server = FHIRServer( None, &quot;http://hapi.fhir.org/baseR4&quot; )</p><p>อ่าน Patient resource จาก FHIR server โดยใช้ method read ใน FHIRAbstractResource ซึ่งเป็น base class ของ Patient resource</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*hYxSUe4mzEfMVF3-KTqOOg.png" /><figcaption>Source: <a href="http://docs.smarthealthit.org/client-py/classfhirclient_1_1models_1_1fhirabstractresource_1_1_f_h_i_r_abstract_resource.html#a5af139d800a3d05c0a9caf13b4dbb428">http://docs.smarthealthit.org/client-py/classfhirclient_1_1models_1_1fhirabstractresource_1_1_f_h_i_r_abstract_resource.html#a5af139d800a3d05c0a9caf13b4dbb428</a></figcaption></figure><p>parameter rem_id คือ id ของ resource บน server ที่ต้องการ read ในที่นี้คือ id ของ Patient resource ที่ต้องการ</p><p>p = Patient.read( &quot;921009&quot;, server )</p><p>เนื่องจาก models ต่างๆ ใน fhirclient.models เขียนขึ้นตาม FHIR specifications ดังนั้น attributes ต่างๆ รวมทั้ง Data types ของ Patient class ก็จะเป็นไปตาม elements ของ Patient resource</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*r1L6L2tCIm0vqVk_QZJzfw.png" /><figcaption>Source: <a href="http://docs.smarthealthit.org/client-py/classfhirclient_1_1models_1_1patient_1_1_patient.html">http://docs.smarthealthit.org/client-py/classfhirclient_1_1models_1_1patient_1_1_patient.html</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*0fC-rT0JLZpov4eFg2nL6Q.png" /><figcaption>Source: <a href="http://hl7.org/fhir/patient.html#resource">http://hl7.org/fhir/patient.html#resource</a></figcaption></figure><p>ทำให้เข้าถึง elements ต่างๆ ของ resource ได้โดยผ่าน attributes ของ class</p><pre>print( f&quot;NAME: {p.name[0].text}&quot; )<br>print( f&quot;BIRTHDATE: {p.birthDate.date.isoformat()}&quot; )</pre><ul><li>เนื่องจากนิยามของ element name ใน Patient resource มี Cardinality เป็น 0..* (มีได้มากกว่า 1) ใน Python implementation จึงเป็น Sequence</li><li>นอกจากนี้ element name ยังมี data type เป็นแบบ HumanName ซึ่งเป็น Complex data type เมื่อ output ออกมาทาง console จะเป็น object ของ class นั้นใน Python แต่ข้อดีของ FHIR specifications คือ มีการกำหนดให้แต่ละ resource มี Narrative/Text section ที่เป็น human-readable summary (<a href="https://medium.com/thai-fhir-sig/resource-part-3-ce17f1d6b108">https://medium.com/thai-fhir-sig/resource-part-3-ce17f1d6b108</a>) ใน resource HumanName มี element text ซึ่งมี data type เป็น string จึงสามารถ output ออกมาทาง console ได้โดยตรง</li><li>element birthDate มี data type ตาม FHIR specifications เป็น date ซึ่งเป็น Primitive data type แต่ใน Python implementation นี้ birthDate จะมี data type เป็น class FHIRDate ใน namespace fhirclient.models.fhirdate แทน</li><li>ใน class FHIRDate จะมี attribute date อีกทีหนึ่งซึ่งมี data type เป็น date class ของ Python ใน module datetime ทำให้สามารถเรียกใช้ method isoformat() ของ class date ซึ่งจะ return วันที่เป็น string ตามรูปแบบ ISO กลับมา</li></ul><p>ในครั้งก่อนนี้ ใช้ clinFHIR (<a href="http://clinfhir.com/">http://clinfhir.com</a>) ช่วยสร้าง Patient resource, นอกจาก Patient resource แล้ว clinFHIR ยังสร้างตัวอย่าง resource ต่างๆ เพื่อการศึกษาและทดลองใช้งาน FHIR ทางคลินิกให้อีกด้วย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*4PEUYhgJC0SEO7LCLLn9pA.png" /></figure><p>สร้าง Problem list ของผู้ป่วย จาก Condition resources</p><p>Import class ที่ต้องการใช้งานเพิ่มเติมได้แก่ Condition</p><pre>from fhirclient.models.condition import Condition</pre><p>ทำการค้นหา Condition resource ที่มี subject=921009 โดยใช้ class method where() ที่อยู่ใน base class FHIRAbstractResource ซึ่งจะ return ค่ากลับมาเป็น FHIRSearch object</p><p>srch = Condition.where( { “subject”: “921009” } )</p><p>เรียกใช้งาน method perform_resources() ของ FHIRSearch ซึ่งจะทำการค้นหา resource ที่ตรงกับ search parameter แล้ว return ค่ากลับมาเป็น list ของ resource นั้น</p><p>conditions = srch.perform_resources( server )</p><p>สามารถเขียน code แบบ method chaining ได้ ให้ code อยู่บรรทัดเดียวกัน</p><p>conditions = Condition.where( { “subject”: “921009” } ).perform_resources( server )</p><p>ถ้า list conditions ไม่ empty แสดงว่ามี Condition resource ที่มี subject=921009 แสดงผลการค้นหาแต่ละ Condition resource ที่ได้ ในที่นี้เลือกแสดงเฉพาะ condition และ severity</p><pre>if not conditions:<br>    print( &quot;PROBLEM LIST: None&quot; )<br>else:<br>    print( &quot;PROBLEM LIST:&quot; )<br>    i = 1<br>    for cond in conditions:<br>        print( f&quot;{i:&gt;3d}. {cond.code.text:&lt;40s} Severity: {cond.severity.text:&lt;12s}&quot; )<br>        i += 1</pre><h4>Full code listing:</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/be100851b90f992c45320c982d14dd94/href">https://medium.com/media/be100851b90f992c45320c982d14dd94/href</a></iframe><h4>Output:</h4><pre>----------------------------------------<br>Patient Information<br>----------------------------------------<br>NAME: Edward Melonseed<br>BIRTHDATE: 1988-03-25<br>PROBLEM LIST:<br>  1. high cholesterol                         Severity: Moderate    <br>  2. GERD                                     Severity: Moderate    <br>  3. onychomycosis                            Severity: severe      <br>  4. asthma                                   Severity: mild to moderate<br>  5. angina                                   Severity: Moderate    <br>  6. hypertension                             Severity: Mild        <br>  7. diabetes                                 Severity: moderate    <br>  8. neuropathic pain                         Severity: moderate    <br>  9. depression                               Severity: Moderate    <br> 10. rheumatoid arthritis - left elbow        Severity: Diagnosis   <br> 11. rheumatoid arthritis - both hands        Severity: Moderate</pre><h3>Official FHIR Implementation</h3><ul><li><strong>JAVA</strong>: <a href="https://github.com/jamesagnew/hapi-fhir">https://github.com/jamesagnew/hapi-fhir</a> โดย James Agnew / University Health Network (Canada) HAPI FHIR เริ่มโครงการตั้งแต่ปี 2001 มีความสมบูรณ์ที่สุดในเรื่อง implementation และเอกสารประกอบ (documentation) ศึกษารายละเอียดเพิ่มเติมได้ที่ <a href="https://hapifhir.io/">https://hapifhir.io/</a></li><li><strong>DotNET</strong> <a href="https://github.com/FirelyTeam/fhir-net-api">https://github.com/FirelyTeam/fhir-net-api</a> โดย Firely (Netherlands) เป็น implementation ที่มีความสมบูรณ์เช่นเดียวกับ HAPI FHIR เอกสารประกอบเป็นลักษณะแบบ tutorial ดูได้ที่ <a href="http://docs.simplifier.net/fhirnetapi/">http://docs.simplifier.net/fhirnetapi/</a> หากต้องการรายละเอียดเพิ่มเติมต้องติดต่อผู้พัฒนา</li><li><strong>Python </strong><a href="https://github.com/smart-on-fhir/client-py">https://github.com/smart-on-fhir/client-py</a> เอกสารประกอบดูได้ที่ <a href="http://docs.smarthealthit.org/client-py/">http://docs.smarthealthit.org/client-py/</a> เอกสารมีรายการ models และ class methods/attributes ครบถ้วน แต่ยังขาดรายละเอียดคำอธิบายค่อนข้างมาก ต้องเปิด FHIR specifications ควบคู่กันไปในการทำความเข้าใจ</li><li><strong>Swift</strong> <a href="https://github.com/smart-on-fhir/Swift-FHIR">https://github.com/smart-on-fhir/Swift-FHIR</a> เอกสารประกอบดูได้ที่ <a href="https://github.com/smart-on-fhir/Swift-SMART/wiki">https://github.com/smart-on-fhir/Swift-SMART/wiki</a> และ <a href="http://docs.smarthealthit.org/Swift-SMART/">http://docs.smarthealthit.org/Swift-SMART/</a></li><li>Implementation อื่นๆ ดูเพิ่มเติมได้ที่ <a href="https://confluence.hl7.org/display/FHIR/Open+Source+Implementations">https://confluence.hl7.org/display/FHIR/Open+Source+Implementations</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=662d7629e31d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thai-fhir-sig/manipulating-fhir-resource-client-py-api-662d7629e31d">Manipulating FHIR Resource: client-py API</a> was originally published in <a href="https://medium.com/thai-fhir-sig">SIL-Thailand</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Manipulating FHIR Resource: Search]]></title>
            <link>https://medium.com/thai-fhir-sig/manipulating-fhir-resource-search-9123ae377ce?source=rss----40876970312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/9123ae377ce</guid>
            <category><![CDATA[search]]></category>
            <category><![CDATA[fhir]]></category>
            <dc:creator><![CDATA[SIL-Thailand]]></dc:creator>
            <pubDate>Thu, 02 Apr 2020 16:01:01 GMT</pubDate>
            <atom:updated>2020-04-16T11:24:41.598Z</atom:updated>
            <content:encoded><![CDATA[<p>การค้นหา FHIR Resource. Using the REST paradigm, Search parameters and Returned results.</p><p>แต่ละ resource จะมีรายการ Search parameters ที่ถูกกำหนดไว้ในข้อกำหนด ซึ่งมักจะอยู่ด้านล่างๆ ของหน้าที่อธิบายรายละเอียดของแต่ละ resource</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZtZLXz9SOr8JgsmlOh5PMg.png" /><figcaption>ตัวอย่าง Search parameters ของ Patient resource</figcaption></figure><blockquote>FHIR server ไม่จำเป็นต้องสนับสนุน Search parameters เหล่านี้ทั้งหมดและ server สามารถกำหนด parameter การค้นหาของตนเองได้ รายการเหล่านี้เป็นรายการที่พบเห็นได้บ่อยหรือชัดเจนที่สุดซึ่งรวบรวมโดยคณะกรรมการที่จัดทำ resource</blockquote><p>FHIR server สามารถระบุใน Conformance resource ว่าสนับสนุน Search parameters ใดบ้างสำหรับแต่ละ resource</p><h3>การค้นหาขั้นพื้นฐานโดยใช้ GET method</h3><p>มี<strong>รูปแบบ</strong> ดังนี้:</p><p>GET [host]/[resourceType]/_search?[parameters]&amp;_format=[mime-type]</p><p>หรือ</p><p>GET [host]/[resourceType]?[parameters]&amp;_format=[mime-type]</p><p><strong>ตัวอย่าง</strong></p><p>GET <a href="http://hapi.fhir.org/baseR4/Patient?name=Edward">http://hapi.fhir.org/baseR4/Patient?name=Edward</a> จะได้ Bundle ที่เป็นรายการ Patient resource ที่มีส่วนของ name (ชื่อ) มีตัวอักษร ‘Edward’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IJUqmPSdSrjwxmO45LLfuQ.png" /></figure><p>GET <a href="http://hapi.fhir.org/baseR4/Patient?name=Edward&amp;_format=xml">http://hapi.fhir.org/baseR4/Patient?name=Edward&amp;_format=xml</a> จะได้ bundle ที่เป็นรายการ Patient resource ที่มีส่วนของ name (ชื่อ) มีตัวอักษร ‘Edward’ เช่นเดิม แต่ส่งกลับมาในรูปแบบ XML</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hW4EcBHeAOOh1rgYrnhiBg.png" /></figure><p>GET <a href="http://hapi.fhir.org/baseR4/Condition?subject=921009">http://hapi.fhir.org/baseR4/Condition?subject=921009</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4d-XgBznY6hrrjA-6I7TxQ.png" /></figure><p>จะได้ bundle ที่เป็นรายการ Condition resource ทั้งหมดสำหรับ Patient resource ที่ id=921009 ซึ่งก็คือ Problem list ของผู้ป่วยรายนี้นั่นเอง</p><h4>Parameters มาตรฐาน</h4><p>Parameters มาตรฐาน สำหรับทุก resource ได้แก่</p><p>_content, _has, _id, _lastupdated, _list, _profile, _security, _tag, _text, _type</p><p>นอกจากนี้ยังมี Search parameters พิเศษ คือ _query และ _filter ที่อนุญาตให้ค้นหาโดยใช้วิธีการอื่นที่แตกต่างไป และ _format และ _pretty ที่กำหนดไว้สำหรับ interaction ทั้งหมด</p><p>_id จะอ้างถึง logical id ของ resource และสามารถใช้เมื่อการค้นหาระบุชนิดของ resource</p><p>GET [host]/Patient?_id=921009</p><p>การค้นหานี้จะหา Patient resource ที่มี id ตรงกับที่ให้ไป เหมือนกับกระบวนการ Read GET [host]/Patient/921009 อย่างไรก็ตามการค้นหาด้วย parameter _id จะส่งคืนผลลัพธ์เป็น bundle ของ resource แทนที่จะได้กลับมาเป็น resource นั้นแบบกระบวนการ Read</p><h4>Modifiers</h4><p>เสมือนเป็นคำต่อท้าย (Suffixes) ของ Parameters คั่นด้วยเครื่องหมาย : (colon)</p><ul><li>:missing ใช้ได้กับทุก parameters เช่น gender:missing=true จะส่งผลลัพธ์กลับมาเป็น resource ทั้งหมดที่ไม่ได้ระบุ gender เอาไว้</li><li>:exact, :contain ใช้กับ parameters จำพวก string, :exact จะต้องตรงกันทุกตัวอักษรพอดี และ case-sensitive ในขณะที่ :contain ไม่ต้องตรงกันทุกตัวอักษรพอดี อาจจะมีอักษรเกินมาด้านหน้าหรือท้ายคำก็ได้และไม่ case-sensitive (Default ในการค้นหา string จะค้นหา string ใดก็ตามที่ขึ้นต้นด้วย string ที่ระบุ และไม่ case-sensitive เช่น name=eve จะ match ทั้ง “Eve”, “Evelyn”)</li><li>สำหรับ parameters จำพวก token, :text จะค้นหาบางส่วนในส่วน text ของชนิดข้อมูล CodeableConcept หรือส่วน display ของชนิดข้อมูล Coding (แทนการค้นหา default เริ่มต้นซึ่งค้นหาในส่วนที่เป็น code) เช่น GET [base]/Condition?code:text=headache จะค้นหา Condition ที่ code มีส่วน text หรือ display ของ code มีคำว่า headache อยู่ในนั้น</li><li>Modifiers อื่น ของ parameters ที่เป็น token คือ :in, :not-in, :above, :below สำหรับค้นหากับ code ใน ValueSet</li><li>:type ใช้กับ parameters จำพวก reference เพื่อระบุชื่อ resource ที่ต้องการค้นหาของ reference นั้น</li><li>สำหรับ parameters จำพวก uri, modifiers :below และ :above สามารถใช้ระบุว่าใช้การค้นหาที่ตรงกันเพียงบางส่วน ตัวอย่างเช่น:</li></ul><pre>GET [base]/ValueSet?url:below=http://acme.org/fhir/<br>GET [base]/ValueSet?url:above=http://acme.org/fhir/ValueSet/123/_history/5</pre><p>บรรทัดแรก การค้นหาจะส่งคืน ValueSet ใด ๆ ที่มี URL ที่ขึ้นต้นด้วย “<a href="http://acme.org/fhir/">http://acme.org/fhir/</a>&quot; ในขณะที่บรรทัดที่สอง จะค้นหา ValueSet ใด ๆ จาก URL ที่ระบุและจาก URL ที่เหนือขึ้นไป แต่ยังอยู่ใน <a href="http://acme.org/ValueSet/123">http://acme.org/fhir/ValueSet/123</a> สังเกตว่ามีกรณีการใช้งานไม่มากที่ modifier :above มีประโยชน์เมื่อเทียบกับ :below</p><h4>Prefixes</h4><p>คำนำหน้า (Prefixes) ของ parameters value ใช้เพื่อควบคุมลักษณะของการค้นหา parameters จำพวกที่สามารถเรียงลำดับได้ ได้แก่ number, date และ quantity</p><ul><li>eq Equal, ne Not equal</li><li>gt Greater than, lt Lesser than</li><li>ge Greater or equal, le Lesser or equal</li><li>sa Start after, eb End before ไม่ใช้กับค่าที่เป็นจำนวนเต็ม แต่ใช้กับค่าที่เป็นทศนิยม</li><li>ap Approximately อยู่ในช่วง 10% ของค่าที่ระบุไป (แต่สามารถเลือกตั้งค่าประมาณอื่นที่คิดว่าเหมาะสมแทนให้ระบบได้)</li></ul><p>ตัวอย่าง:</p><p>GET [base]/Encounter?length=gt20 ค้นหา Encounter ใดๆ ที่อยู่นานเกิน 20 วัน</p><p>GET [base]/Patient/23/Procedure?date=ge2010–01–01&amp;date=le2011–12–31 ค้นหา Procedure ของ Patient resource id=23 ที่ทำระหว่างวันที่ 1 ม.ค. 2010 ถึง 31 ธ.ค. 2011 (2 ปี)</p><p>รายละเอียดของ FHIR Search สามารถศึกษาเพิ่มเติมได้ใน FHIR Specification <a href="https://www.hl7.org/fhir/search.html">https://www.hl7.org/fhir/search.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9123ae377ce" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thai-fhir-sig/manipulating-fhir-resource-search-9123ae377ce">Manipulating FHIR Resource: Search</a> was originally published in <a href="https://medium.com/thai-fhir-sig">SIL-Thailand</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Manipulating FHIR Resource: Update & Delete]]></title>
            <link>https://medium.com/thai-fhir-sig/manipulating-fhir-resource-update-delete-60e9118b003?source=rss----40876970312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/60e9118b003</guid>
            <category><![CDATA[fhir]]></category>
            <category><![CDATA[crud]]></category>
            <category><![CDATA[delete]]></category>
            <category><![CDATA[updates]]></category>
            <dc:creator><![CDATA[SIL-Thailand]]></dc:creator>
            <pubDate>Wed, 25 Mar 2020 15:28:11 GMT</pubDate>
            <atom:updated>2020-04-16T11:29:10.425Z</atom:updated>
            <content:encoded><![CDATA[<p>จัดการ FHIR Resource: แก้ไข และลบ Resource</p><p>ในตอนนี้จะใช้ clinFHIR ช่วยสร้าง Patient resource โดยเข้าไปใช้งาน clinFHIR Launcher ได้ที่ <a href="http://clinfhir.com/">http://clinfhir.com</a></p><blockquote>clinfhir.com พัฒนาโดย <a href="https://nz.linkedin.com/in/david-hay-423a519">Dr David Hay</a> แพทย์และผู้เชี่ยวชาญ FHIR ชาว New Zealand เป็น online tools ที่ช่วยในการสร้างตัวอย่างต่างๆ สำหรับการใช้งาน FHIR ทางคลินิกเพื่อการศึกษาและทดลอง FHIR</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FmwtmXZz7acNXNMdOzBQHQ.png" /><figcaption>http://clinfhir.com</figcaption></figure><p>เราสามารถเปลี่ยน FHIR Server ที่ต้องการใช้งานใน clinFHIR ได้โดยคลิก Edit</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wgQCulc1M86H6NBgyQIq3g.png" /><figcaption>Edit Current servers</figcaption></figure><p>แล้วเลือก FHIR Server ที่ต้องการ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/282/1*GW0902L2E84mguyiRsV6yw.png" /></figure><p>หรือจะเพิ่ม FHIR Server อื่นๆ ที่ต้องการได้โดยคลิกที่ Add Server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/1*Ts3CCh56DkIxe6TAIk67KQ.png" /><figcaption>Add Server</figcaption></figure><p>ใส่รายละเอียดของ FHIR Server ที่ต้องการ Add เสร็จแล้วกด Test</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LFdrbdh2Dx3Vxj8nEwiNSA.png" /><figcaption>Add new server and Test</figcaption></figure><p>ถ้าทดสอบ Conformance testing ผ่านจะสามารถกด Add ได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/321/1*6rHvAmrTLtIcn32qhvL7Vw.png" /></figure><p>กลับออกมาที่หน้า clinFHIR Launcher เลือก server ทุกตัวให้สอดคล้องกัน แล้วกด Save</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/347/1*F3H_ff4PJilRV3mWdHt-vg.png" /><figcaption>Save Current servers</figcaption></figure><p>หลังจากนั้น คลิกที่ Patient Viewer เพื่อไปที่ http://clinfhir.com/patientViewer.html คลิก Select Patient → Add new patient</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eNPy2qfhTJpH2MXrJqy7rA.png" /><figcaption>clinfhir.com</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yu5gT5Hr97yrdrFoFLLZHg.png" /><figcaption>Patient Viewer</figcaption></figure><p>ใส่รายละเอียดของ Patient resource ตามต้องการ กด Add patient</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UC0OvP-xLg9aeQo5RwjvBg.png" /><figcaption>Add new Patient</figcaption></figure><p>clinFHIR จะสร้าง Patient resource ตามรายละเอียดที่กำหนด รวมทั้ง sample resources อื่นๆ ที่ใช้งานทางคลินิกเพื่อเป็นตัวอย่างให้ทดลอง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yG-P4hBoovklIajJBnDM3A.png" /></figure><p>สังเกต URL ที่เก็บ resource และ resource id เพื่อใช้ในการจัดการ resource เหล่านี้ต่อไป</p><p>ลอง read Patient resource ที่สร้างขึ้นมาด้วยแอป Postman โดยใช้ method GET และ URI ของ resource ที่สร้างตาม &lt;host&gt;/&lt;resourceType&gt;/&lt;id&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5fiHEnthjB2d31qNKP3eVA.png" /><figcaption>Postman</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ms8iS_GMefOkiSWjyA-SWg.png" /></figure><p>Copy หรือ save XML ที่ server response กลับมาเป็นไฟล์เพื่อแก้ไขเพิ่มเติมต่อไป</p><h3>Update Resource</h3><p>แก้ไข XML โดยเพิ่มเติมในส่วนของชื่อเรียกไม่เป็นทางการ เบอร์โทรศัพท์และที่อยู่ที่ทำงาน</p><pre>&lt;Patient xmlns=&quot;<a href="http://hl7.org/fhir">http://hl7.org/fhir</a>&quot;&gt;<br>   &lt;id value=&quot;921009&quot;/&gt;<br>   &lt;meta&gt;<br>      &lt;versionId value=&quot;1&quot;/&gt;<br>      &lt;lastUpdated value=&quot;2020-03-25T11:06:22.714+00:00&quot;/&gt;<br>      &lt;source value=&quot;#Qd0xJZ3qBIgz4rlV&quot;/&gt;<br>   &lt;/meta&gt;<br>   &lt;text&gt;<br>      &lt;status value=&quot;generated&quot;/&gt;<br>      &lt;div xmlns=&quot;<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>&quot;&gt;Edward Melonseed&lt;/div&gt;<br>   &lt;/text&gt;<br>   &lt;!-- ORIGINAL NAME --&gt;<br>   &lt;name&gt;<br>      &lt;use value=&quot;official&quot;/&gt;<br>      &lt;text value=&quot;Edward Melonseed&quot;/&gt;<br>      &lt;family value=&quot;Melonseed&quot;/&gt;<br>      &lt;given value=&quot;Edward&quot;/&gt;<br>   &lt;/name&gt;<br>   &lt;!-- ADDED NAME --&gt;<br>   &lt;name&gt;<br>      &lt;use value=&quot;usual&quot;/&gt;<br>      &lt;text value=&quot;Ed Melonseed&quot;/&gt;<br>      &lt;family value=&quot;Melonseed&quot;/&gt;<br>      &lt;given value=&quot;Ed&quot;/&gt;<br>   &lt;/name&gt;<br>   &lt;!-- MOBILE PHONE --&gt;<br>   &lt;telecom&gt;<br>      &lt;system value=”phone”/&gt;<br>      &lt;value value=”(08)97654321&quot;/&gt;<br>      &lt;use value=”mobile”/&gt;<br>   &lt;/telecom&gt;<br>   &lt;gender value=&quot;male&quot;/&gt;<br>   &lt;birthDate value=&quot;1988-03-25&quot;/&gt;<br>   &lt;!-- WORK ADDRESS --&gt;<br>   &lt;address&gt;<br>      &lt;use value=”work”/&gt;<br>      &lt;type value=”postal”/&gt;<br>      &lt;text value=”88/20 Tiwanon Road, Talad Kwan, Muang, Nonthaburi, 11000, Thailand”/&gt;<br>      &lt;line value=”88/20 Tiwanon Road”/&gt;<br>      &lt;city value=”Talad Kwan”/&gt;<br>      &lt;district value=”Muang”/&gt;<br>      &lt;state value=”Nonthaburi”/&gt;<br>      &lt;postalCode value=”11000&quot;/&gt;<br>      &lt;country value=”TH”/&gt;<br>   &lt;/address&gt;<br>&lt;/Patient&gt;</pre><p>Update Patient resource เดิมด้วยแอป Postman โดยใช้ method PUT และ URL ของ resource วาง XML ที่แก้ไขแล้วลงในส่วน Request Body</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LwqXVDgWSHfcbGCQzYoxbA.png" /></figure><p>ถ้า update สำเร็จ server จะทำการเพิ่มข้อมูลที่แก้ไขและคืนค่า Response Status code เป็น 200 กลับมา ค่าของ Content-Location ในส่วนของ Response Header ควรแสดงเป็นเลข version history ที่เพิ่มขึ้นจากเดิม</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j0DD2qGJ78XxxhlYXZ_IOw.png" /></figure><h4>Notes:</h4><ul><li>ถ้าใช้ PUT method แต่ URI ที่ request resource นั้นไม่มีอยู่ server จะยังคงจัดเก็บข้อมูลที่ส่งไปให้แต่ Response Status code ที่ส่งกลับมาจะเป็น 201</li><li>เราสามารถเรียกดู version ต่างๆ ของ resource ได้โดยใช้ version-specific URI เช่น ในกรณีนี้จะเรียกดู resource version ก่อนหน้าได้โดยใช้ URI http://hapi.fhir.org/baseR4/Patient/921009/_history/1</li><li>เราสามารถเรียกดูรายการ version ทั้งหมดของ resource ได้โดยใช้ _history ต่อท้าย URI ของ resource นั้น เช่น http://hapi.fhir.org/baseR4/Patient/921009/_history</li></ul><h3>Delete Resource</h3><p>เราสามารถลบ resource ได้โดยใช้ DELETE method กับ URI ของ resource นั้น</p><p>DELETE &lt;host&gt;/&lt;resourceType&gt;/&lt;id&gt;</p><p>ถ้า delete สำเร็จ server จะส่ง Status code 204 (No content) กลับมา แต่ถ้า delete ไม่ได้ ค่า Status code ที่ส่งกลับมาจะเป็นได้ทั้ง 404 (Not found), 405 (Method not allowed) หรือ 409 (Conflict)</p><p>การลบ resource หมายถึง server จะไม่ส่งข้อมูลของ resource นั้นกลับมาตามปกติจาก request ที่ใช้ GET method และ Status code ที่ได้กลับมา คือ 410 (Gone) ซึ่งแตกต่างกับกรณีส่ง request กับ resource ที่ไม่เคยมีอยู่ใน server จะได้ Status code เป็น 404</p><p>Version ต่างๆ ของ resource จะยังคงไม่หายไปไหน สามารถเข้าถึงได้โดย request ผ่าน version-specific URI</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60e9118b003" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thai-fhir-sig/manipulating-fhir-resource-update-delete-60e9118b003">Manipulating FHIR Resource: Update &amp; Delete</a> was originally published in <a href="https://medium.com/thai-fhir-sig">SIL-Thailand</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Manipulating FHIR Resource: Read]]></title>
            <link>https://medium.com/thai-fhir-sig/manipulating-fhir-resource-read-6677a56abe52?source=rss----40876970312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/6677a56abe52</guid>
            <category><![CDATA[fhir]]></category>
            <category><![CDATA[crud]]></category>
            <dc:creator><![CDATA[SIL-Thailand]]></dc:creator>
            <pubDate>Tue, 10 Mar 2020 14:00:01 GMT</pubDate>
            <atom:updated>2020-04-16T11:30:19.994Z</atom:updated>
            <content:encoded><![CDATA[<p>จัดการ FHIR Resource: เรียกดูข้อมูล Resource</p><p>ในการเรียกข้อมูลของ resource ที่มีอยู่ ต้องทราบ URI ของ resource นั้น ในครั้งนี้จะ Read FHIR resource ที่ได้สร้างไว้เมื่อครั้งก่อน (<a href="https://medium.com/thai-fhir-sig/manipulating-fhir-resource-crud-operation-6c6f35a0bd9c">https://medium.com/thai-fhir-sig/manipulating-fhir-resource-crud-operation-6c6f35a0bd9c</a>)</p><h3>GET request โดยใช้แอป Postman</h3><ul><li>ระบุ URI เต็ม (resource location + ID) ของ resource ที่ต้องการ (ในที่นี้ จะใช้ ID ของ resource เดิมที่เคยสร้างไว้ครั้งก่อนคือ <a href="http://test.fhir.org/r4/Patient/1254100639">http://test.fhir.org/r4/Patient/1254100639</a> )</li><li>ระบุรูปแบบข้อมูลที่ต้องการใน Headers เมื่อตอนสร้าง resource ครั้งก่อน ข้อมูลที่ส่งไปเป็นรูปแบบ XML ครั้งนี้จะ request ข้อมูลกลับมาเป็นรูปแบบ JSON โดยระบุ <em>Accept</em> header เป็น <em>application/fhir+json</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dBbNWiK6A49ZK3qoShUFLg.png" /></figure><p>รอ server ประมวล request แล้วส่งผลลัพธ์กลับมา Status code = 200 หมายถึง ทุกอย่างเรียบร้อยดี</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dM3AGGa9AJHN50BGhgO_pg.png" /></figure><p>ได้ผลลัพธ์กลับมาในรูปแบบ JSON ตามที่ต้องการ</p><h3>GET request โดยใช้ Web browser</h3><ul><li>วาง URI ของ resource ที่ต้องการที่ address bar ของ web browser โดยตรง ในที่นี้ใช้ test server <a href="http://test.fhir.org/r4">http://test.fhir.org/r4</a> ของ Health Intersections โดย Grahame Grieve ผู้นำทีมพัฒนาข้อกำหนดมาตรฐาน HL7 FHIR หรือ Father of FHIR</li><li>Server ของ Health Intersections จะ wrap ข้อมูลของ resource นั้น อยู่ใน UI ของ web page ซึ่งจะไม่เหมือนกันกับกรณีที่เรียกข้อมูลโดยตรงโดยใช้แอป Postman</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lmByR4TzpmUTAvZdpz_6Nw.png" /></figure><h3>GET request โดยใช้ HAPI-FHIR Web UI</h3><p>ลองเรียกข้อมูลผ่าน web อื่นที่เป็นตัวกลาง ในที่นี้จะใช้ HAPI-FHIR Web UI (HAPI-FHIR เป็น Java Implementation ของ HL7 FHIR specification นำทีมพัฒนาโดย James Agnew) โดยไปเข้าใช้งานที่ <a href="http://hapi.fhir.org/">http://hapi.fhir.org</a> หรือ <a href="https://fhirtest.uhn.ca/">https://fhirtest.uhn.ca</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w88D0tttDvU-dvSvxv5M1w.png" /></figure><ol><li>เลือก server ที่ต้องการเชื่อมต่อ เปลี่ยนจาก server ของ UHN เป็น server ของ Health Intersections ที่เคยสร้าง resource ไว้</li><li>เลือก resource ที่ต้องการ ในที่นี้ คือ Patient</li><li>เลือก CRUD Operations</li><li>ระบุ ID ที่ต้องการ แล้วกด Read</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pJOt-5DVpMFNlMrhrD7dcw.png" /></figure><p>รอ server ประมวลผลแล้วส่งผลลัพธ์กลับมา</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rOSPOqH4o_RSfKMYVxbV2w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ew_d9D_MDL2qBnde4dFQZg.png" /></figure><p>รูปแบบของข้อมูลที่ส่งกลับมามีค่า Default เป็น XML แต่สามารถเรียกขอข้อมูลในรูปแบบ JSON ได้ โดยเลือก Options → Encoding = JSON</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7rn7nt6nMMRkXfyXwf1cpw.png" /></figure><p>ตัวอย่างที่กล่าวมาเป็นไอเดียในการเรียกข้อมูล FHIR resource เพื่อใช้งานและแสดงผลในรูปแบบต่างๆ กัน</p><p>Thai FHIR Interest Group</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6677a56abe52" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thai-fhir-sig/manipulating-fhir-resource-read-6677a56abe52">Manipulating FHIR Resource: Read</a> was originally published in <a href="https://medium.com/thai-fhir-sig">SIL-Thailand</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Manipulating FHIR Resource: CRUD Operation]]></title>
            <link>https://medium.com/thai-fhir-sig/manipulating-fhir-resource-crud-operation-6c6f35a0bd9c?source=rss----40876970312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/6c6f35a0bd9c</guid>
            <category><![CDATA[fhir]]></category>
            <category><![CDATA[crud]]></category>
            <dc:creator><![CDATA[SIL-Thailand]]></dc:creator>
            <pubDate>Tue, 03 Mar 2020 11:01:01 GMT</pubDate>
            <atom:updated>2020-04-16T11:31:22.556Z</atom:updated>
            <content:encoded><![CDATA[<p>จัดการ FHIR Resource: CRUD Operation</p><h3>REST</h3><p>REST หรือ REpresentational State Transfer เป็น protocol ที่สร้างขึ้นมาบน HTTP (HyperText Transfer Protocol) ซึ่งเป็น request/response protocol</p><p>REST ใช้แนวคิดในแง่ของ Resource แต่ละ resource สามารถระบุ identity ได้โดย Uniform Resource Identifier (URI) และระบุตำแหน่งของ resource โดยไม่ซ้ำกัน และจำเพาะเจาะจงกับ server ที่ใช้งาน</p><h3>CRUD: Create, Read, Update and Delete</h3><h4>Method ต่างๆ ที่ใช้จัดการกับ resource</h4><ul><li>POST สร้าง resource ที่ต้องการขึ้นใหม่ (Create), server จะกำหนด id ให้, id รวมกับที่อยู่ของ server จะกลายเป็น URI ของ resource นั้น</li><li>GET (Read) ดึงข้อมูล resource ที่ต้องการตาม URI (server + id) ที่ระบุ, FHIR ใช้ GET method ทั้งในการดึงข้อมูล resource เดียวและในการค้นหาซึ่งอาจจะได้ ผลลัพธ์เป็นจำนวนหลาย resource กลับมา</li><li>PUT (Update) ใช้ปรับปรุงข้อมูล resource ที่มีอยู่แล้ว จึงจำเป็นต้องรู้ URI ของ resource นั้น, ใน FHIR นั้น PUT method จะสร้าง version ใหม่ของ resource นั้นขึ้นมา</li><li>DELETE (Remove) ใช้ลบ resource จาก URI ที่ระบุ แต่ยังเข้าถึงสำเนาของ resource นั้นได้ จาก history</li></ul><p>(OPTIONS เป็น method พิเศษใน FHIR ซึ่งให้ผลลัพธ์เป็น Conformance resource ที่บอกถึงความสามารถหรือ capabilities ของ server นั้น)</p><h4>Headers</h4><ul><li><em>Content-type</em> header ระบุว่าเนื้อหาข้อมูลของ resource อยู่ในรูปแบบ XML หรือ JSON</li><li><em>Location</em> header ใช้แจ้ง client ระบุ URI ของ resource ที่เพิ่งสร้างขึ้นใหม่</li><li><em>Accept</em> header ใช้แจ้ง server ถึงรูปแบบข้อมูล (XML/JSON) ที่ client ต้องการ เมื่อ client เรียกข้อมูลจาก server โดยใช้ GET method</li></ul><p>ในที่นี้จะใช้แอป Postman สำหรับรับ-ส่ง HTTP requests เพื่อระบุ content, HTTP method, request header และดู response header, Status code และ response body ที่ server ส่งกลับมา</p><h3>รายชื่อ FHIR Test Server ที่เปิดสาธารณะ (public)</h3><p><a href="https://confluence.hl7.org/pages/viewpage.action?pageId=35718859#PublicTestServers-Servers">Public Test Servers</a></p><p>ในตอนแรกนี้จะใช้ http://test.fhir.org/r4 เป็น Test Server</p><h3>สร้าง Resource ใหม่ (Create)</h3><p>ลองส่ง Patient resource ที่ต้องการสร้างไปที่ FHIR server โดยใช้ POST method ส่ง request ไปที่ FHIR Test Server</p><h4>ตัวอย่าง Patient Resource ที่จะส่งไปสร้างขึ้นใหม่บน server</h4><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;Patient xmlns=&quot;http://hl7.org/fhir&quot;&gt;<br>    &lt;text&gt;<br>        &lt;status value=&quot;generated&quot;/&gt;<br>        &lt;div xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;John Melonseed&lt;/div&gt;<br>    &lt;/text&gt;<br>    &lt;identifier&gt;<br>        &lt;system value=&quot;http://clinfhir.com/fhir/NamingSystem/identifier&quot;/&gt;<br>        &lt;value value=&quot;1234567890&quot;/&gt;<br>    &lt;/identifier&gt;<br>    &lt;name&gt;<br>        &lt;use value=&quot;official&quot;/&gt;<br>        &lt;text value=&quot;John Melonseed&quot;/&gt;<br>        &lt;family value=&quot;Melonseed&quot;/&gt;<br>        &lt;given value=&quot;John&quot;/&gt;<br>        &lt;prefix value=&quot;Mr.&quot;/&gt;<br>    &lt;/name&gt;<br>    &lt;telecom&gt;<br>        &lt;system value=&quot;phone&quot;/&gt;<br>        &lt;value value=&quot;(08) 9765 4321&quot;/&gt;<br>        &lt;use value=&quot;mobile&quot;/&gt;<br>    &lt;/telecom&gt;<br>    &lt;gender value=&quot;male&quot;/&gt;<br>    &lt;birthDate value=&quot;2000-01-01&quot;/&gt;<br>    &lt;address&gt;<br>        &lt;use value=&quot;home&quot;/&gt;<br>        &lt;type value=&quot;both&quot;/&gt;<br>        &lt;text value=&quot;88/20 Tiwanon Road, Talad Kwan, Muang,  Nonthaburi, 11000, TH&quot;/&gt;<br>        &lt;line value=&quot;88/20 Tiwanon Road&quot;/&gt;<br>        &lt;city value=&quot;Talad Kwan&quot;/&gt;<br>        &lt;district value=&quot;Muang&quot;/&gt;<br>        &lt;state value=&quot;Nonthaburi&quot;/&gt;<br>        &lt;postalCode value=&quot;11000&quot;/&gt;<br>        &lt;country value=&quot;TH&quot;/&gt;<br>    &lt;/address&gt;<br>&lt;/Patient&gt;</pre><p>รายละเอียดของแต่ละ element และ Data type ที่เกี่ยวข้องใน Patient resource ดูรายละเอียดได้จาก <a href="http://hl7.org/fhir/patient.html#resource">http://hl7.org/fhir/patient.html#resource</a></p><ul><li>identifier: Identifier ตามแต่ละ system ที่ใช้งานในแต่ละแห่ง เช่น เลขประจำตัวประชาชน เลขประกันสังคม หมายเลขใบอนุญาตขับรถ ตัวอย่าง เช่น <a href="http://hl7.org/fhir/identifier-registry.html#4.6">http://hl7.org/fhir/identifier-registry.html#4.6</a></li><li>name: HumanName ระบุชื่อ ชื่อสกุล คำนำหน้า และอื่นๆ ตาม <a href="http://hl7.org/fhir/datatypes.html#humanname">http://hl7.org/fhir/datatypes.html#humanname</a></li><li>telecom: ContactPoint ระบุรายละเอียด รูปแบบและชนิดของ ContactPoint ตาม <a href="http://hl7.org/fhir/datatypes.html#contactpoint">http://hl7.org/fhir/datatypes.html#contactpoint</a></li><li>address: Address ที่อยู่ ตาม <a href="http://hl7.org/fhir/datatypes.html#address">http://hl7.org/fhir/datatypes.html#address</a></li></ul><p>ระบุ Content-type ใน Headers ให้ตรงกับรูปแบบข้อมูลที่จะส่งไป ในที่นี้ คือ <em>application/fhir+xml</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8VDRqmf0zmtrD-TOvv-Vxg.png" /></figure><p>ในส่วนของ Body วางเนื้อหาของ resource ที่จะส่ง ระบุ server ที่ต้องการส่งข้อมูล (http://test.fhir.org/r4/Patient) ตั้ง method เป็น POST แล้วกด Send</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RWtX73_YjGbt7W9zWlKKNg.png" /></figure><p>รอ server ประมวลผล request ที่ส่งไป และส่ง response กลับมา Status code = 201 หมายถึง สร้าง resource สำเร็จ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f_txmNjAZfkoOXPN0xjrpA.png" /></figure><p>สังเกตเลข ID ที่ถูก assigned ให้กับ resource ที่สร้างใหม่นี้ ใน Headers ของ response ที่ server ส่งกลับมา</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pKGKblpAmeZVSY88N9eVXA.png" /></figure><p>ID นี้จะถูกสร้างขึ้นใหม่ตามระบบของ server ที่ส่ง request ไปใช้งาน เปรียบได้กับ HN ที่ได้ขึ้นมาใหม่หลังจากลงทะเบียนผู้ป่วยใหม่ในระบบโรงพยาบาล</p><p>Resource นี้ มี <em>_history/1</em> เนื่องจากเป็น version แรกของ resource นี้</p><p>เลข ID นี้ รวมกับที่อยู่ของ server คือ URI ที่ใช้ในการ GET (Read) และ method อื่นๆ กับ resource นี้ต่อไป</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c6f35a0bd9c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thai-fhir-sig/manipulating-fhir-resource-crud-operation-6c6f35a0bd9c">Manipulating FHIR Resource: CRUD Operation</a> was originally published in <a href="https://medium.com/thai-fhir-sig">SIL-Thailand</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bundles]]></title>
            <link>https://medium.com/thai-fhir-sig/bundles-300c70adc877?source=rss----40876970312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/300c70adc877</guid>
            <dc:creator><![CDATA[SIL-Thailand]]></dc:creator>
            <pubDate>Tue, 24 Dec 2019 05:58:34 GMT</pubDate>
            <atom:updated>2019-12-23T10:51:01.112Z</atom:updated>
            <content:encoded><![CDATA[<p>มีหลายสถานการณ์ที่เราต้องการใช้งาน Resource ที่รวมเป็นกลุ่ม (collection) เช่น</p><ul><li>ผลลัพธ์ของการค้นหา</li><li>รุ่นต่างๆ (versions) ของ Resource อันใดอันหนึ่งเป็นเฉพาะที่สนใจ (Resource history)</li><li>การจัดชุด Resource รวมเป็นกลุ่มประกอบเป็น Clinical document</li><li>การส่งชุด Resource ไปในการแลกเปลี่ยน message</li><li>ชุดของ Resource ที่กำลังถูกประมวลผลใน 1 operation (Create/Update/Delete)</li></ul><p>Bundle หนึ่งๆ ประกอบด้วยข้อมูล ส่วน header และตามด้วย Resources จำนวนที่ต้องการ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*qMn5mS0e8WA6JTpbpmGAOA.jpeg" /><figcaption><a href="https://www.hl7.org/fhir/bundle.html">https://www.hl7.org/fhir/bundle.html</a></figcaption></figure><p>ส่วน header ประกอบด้วย</p><ul><li>id ของ Bundle</li><li>เวลาที่สร้าง instant</li><li>link element(s) บอก application ที่สร้าง Bundle และ URL รายละเอียดอ้างอิงสำหรับ link นี้</li></ul><p>แต่ละ entry มี</p><ul><li>id เป็น absolute URI ที่ชี้ไปยัง logicalId ของ Resource ใน entry</li><li>Resource</li><li>ข้อมูลที่สัมพันธ์กับการค้นหา</li><li>ข้อมูลเพิ่มเติมเกี่ยวกับการดำเนินการ (transaction/batch/history)</li><li>ผลลัพธ์ของการดำเนินการ</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=300c70adc877" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thai-fhir-sig/bundles-300c70adc877">Bundles</a> was originally published in <a href="https://medium.com/thai-fhir-sig">SIL-Thailand</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Types]]></title>
            <link>https://medium.com/thai-fhir-sig/data-types-e041b585fb2b?source=rss----40876970312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/e041b585fb2b</guid>
            <dc:creator><![CDATA[SIL-Thailand]]></dc:creator>
            <pubDate>Sat, 21 Dec 2019 11:14:03 GMT</pubDate>
            <atom:updated>2020-04-16T11:33:27.758Z</atom:updated>
            <content:encoded><![CDATA[<p>แต่ละ element ใน resource หนึ่งๆ จะมี data type หรือประเภทข้อมูล โดยเฉพาะ</p><p>Data type ใน FHIR มี 4 ประเภท</p><ol><li>Simple/<a href="https://www.hl7.org/fhir/datatypes.html#primitive">Primitive types</a> ซึ่งเป็น element เดี่ยวๆ</li><li><a href="https://www.hl7.org/fhir/datatypes.html#complex">Complex types</a> ซึ่งเป็นกลุ่มของ element</li><li>Metadata types สำหรับใช้กับ metadata resources</li><li>Special Purpose Data types สำหรับการใช้งานเฉพาะด้าน</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rgC0deBh504GYbsZa9wLwQ.png" /><figcaption><a href="https://www.hl7.org/fhir/datatypes.html">https://www.hl7.org/fhir/datatypes.html</a></figcaption></figure><p>Data Types บางตัวที่มีการใช้งานประจำ เช่น</p><h4>Code</h4><p>ใช้เมื่อระบบจำเป็นต้องสร้างตัวเลือกที่มีพื้นฐานบนรหัส (code) เช่น มีขั้นตอนการทำงานที่สัมพันธ์กับ resource อย่างเช่น อาจใช้ สถานะ (status) ของ Condition Resource กำหนดว่าจะแสดง condition (สภาวะการเจ็บป่วย) นั้น ในรายการสภาวะผู้ป่วย (patient’s list of conditions) หรือไม่</p><h4>CodeableConcept</h4><p>เป็นชนิดข้อมูลที่ใช้บ่อยที่สุดสำหรับข้อมูลที่เป็นรหัส แสดงค่าที่มักจะได้จากการอ้างอิงระบบคำศัพท์เฉพาะทาง (Terminology) หนึ่งระบบหรือมากกว่า แต่อาจถูกกำหนดค่าเป็นข้อความได้เช่นกัน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sU5GM485gSkc4WXbr53bSg.jpeg" /><figcaption><a href="http://hl7.org/fhir/datatypes.html#codeableconcept">http://hl7.org/fhir/datatypes.html#codeableconcept</a></figcaption></figure><p>ลักษณะเด่นที่สำคัญของ CodeableConcept ได้แก่</p><ul><li>สนับสนุนรหัสหลายๆ รหัส หรือ “การแปลงค่า (Translation)” ซึ่งยินยอมให้ resource กรณีตัวอย่างเดียวกัน (common resource instance) ถูกใช้ในสถานการณ์ที่ผู้รับที่แตกต่างกันอาจต้องการรหัสที่ไม่เหมือนกัน</li><li>ยินยอมให้มีการโยกย้าย (Migration) ระหว่างระบบรหัสเมื่อเวลาผ่านไป</li></ul><p>การใช้งานทั่วไปของ CodeableConcept ที่พบประจำคือการส่งรหัสของ concept ที่เป็น local code พร้อมกับ translation อย่างน้อยหนึ่งรายการไปยังระบบรหัสสาธารณะเช่น LOINC หรือ SNOMED CT ตัวอย่างเช่น ผลทดสอบทางห้องปฏิบัติการที่เป็นเชิง qualitative สมมติระบบ Lab ของโรงพยาบาล Acme ใช้ local code = “NEG” และ translation กับรหัสมาตรฐาน SNOMED-CT</p><pre>&quot;valueCodeableConcept&quot;: {<br>    &quot;coding&quot;: [{<br>        &quot;system&quot;: &quot;http://snomed.info/sct&quot;,<br>	&quot;code&quot;: &quot;260385009&quot;,<br>	&quot;display&quot;: &quot;Negative&quot;<br>    }, {<br>        &quot;system&quot;: &quot;https://acme.lab/resultcodes&quot;,<br>	&quot;code&quot;: &quot;NEG&quot;,<br>	&quot;display&quot;: &quot;Negative&quot;<br>    }],<br>    &quot;text&quot;: &quot;Negative for Chlamydia Trachomatis rRNA&quot;<br>}</pre><ul><li>สนับสนุนการสื่อใจความของ concept ซึ่งสำคัญสำหรับสถานการณ์ที่ไม่มีรหัสที่เหมาะสมอยู่ หรือในกรณีที่ผู้รับไม่รู้จักระบบรหัส (code system) หรือต้องการดูรายละเอียดเดิมของ concept ซึ่งไม่สามารถแสดงให้เห็นโดย code นั้นได้</li></ul><pre>&quot;valueCodeableConcept&quot;: {<br>    &quot;text&quot;: &quot;uncoded free text result&quot;<br>}</pre><h4>Reference/Resource reference</h4><p>Reference เป็น data type พิเศษ ให้ resource หนึ่งอ้างถึงอีก resource หนึ่งได้ ตัวอย่างเช่น resource ทางคลินิกอย่าง Problem หรือ Observation จำเป็นต้องอ้างถึง Patient resource</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PR-B0PR-QkvTpkucvNDRwg@2x.jpeg" /><figcaption><a href="https://www.hl7.org/fhir/references.html#2.3.0">https://www.hl7.org/fhir/references.html</a></figcaption></figure><h4>Contained Resources</h4><p>Contained Resource เป็นการอ้าง resource อีกแบบ​ โดย resource ที่ถูกอ้างถึงถูกบรรจุอยู่ใน “parent” resource จริงๆ</p><p>Contained Resource จะไม่มี identity เป็นของตัวเอง นั่นก็คือ มันไม่ได้ถูกจัดเก็บบน server ในที่ๆ เป็นอิสระจาก resource ที่บรรจุมัน</p><pre>{<br>    &quot;resourceType&quot; : &quot;Condition&quot;,<br>    &quot;contained&quot;: [{<br>        &quot;resourceType&quot; : &quot;Practitioner&quot;,<br>        &quot;id&quot; : &quot;p1&quot;,<br>        &quot;name&quot; : [{<br>            &quot;family&quot; : &quot;Person&quot;,<br>            &quot;given&quot; : [&quot;Patricia&quot;]<br>        }]<br>    }],<br>    &quot;asserter&quot; : {<br>        &quot;reference&quot; : &quot;#p1&quot;<br>    }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e041b585fb2b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thai-fhir-sig/data-types-e041b585fb2b">Data Types</a> was originally published in <a href="https://medium.com/thai-fhir-sig">SIL-Thailand</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Resource (Part 3)]]></title>
            <link>https://medium.com/thai-fhir-sig/resource-part-3-ce17f1d6b108?source=rss----40876970312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/ce17f1d6b108</guid>
            <dc:creator><![CDATA[SIL-Thailand]]></dc:creator>
            <pubDate>Tue, 17 Dec 2019 16:47:09 GMT</pubDate>
            <atom:updated>2019-12-17T16:49:04.731Z</atom:updated>
            <content:encoded><![CDATA[<h3>Key Parts of a Resource</h3><p>Resource มีส่วนประกอบหลัก 4 ส่วน</p><ol><li>Identity และ Metadata<br><strong><em>Identity</em></strong> จะถูกตรึงไว้ตลอดอายุขัยของ resource การเปลี่ยนแปลงที่เกิดกับ resource จะไม่เปลี่ยน identity<br><strong><em>Metadata</em></strong> เป็นลักษณะแง่มุมต่างๆ ที่เกี่ยวกับตัว resource เองมากกว่าเนื้อหาของ resource หรือ element ข้างใน</li><li><strong><em>Narrative</em></strong>/Text section เป็นส่วนที่สรุปให้คนอ่านเข้าใจเนื้อหาของ resource นี้ได้ (Human readable summary)</li><li><strong><em>Extension</em></strong>(s) เป็นส่วนที่ให้ implementer เพิ่ม element ที่ต้องการแต่ไม่ปรากฏอยู่ใน Core Dataset</li><li><strong><em>Core Dataset</em></strong> เป็นรายการของ elements ที่ปรากฏในเกณฑ์คุณลักษณะ หลักทั่วไป คือ <strong>elements ที่อยู่ใน dataset นี้จะครอบคลุมคุณสมบัติ (property) 80% ของข้อมูลที่ต้องใช้งานในระบบปัจจุบัน</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*MKd2dF62lUURQskI2mAzrw.png" /><figcaption><a href="https://www.hl7.org/fhir/resource.html">https://www.hl7.org/fhir/resource.html</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*Ci9kk5-ujyD6sDkOAiY9Lg.png" /><figcaption><a href="https://www.hl7.org/fhir/domainresource.html">https://www.hl7.org/fhir/domainresource.html</a></figcaption></figure><p>FHIR Resource ส่วนใหญ่ จะสืบทอด (derived) มาจาก <a href="https://www.hl7.org/fhir/domainresource.html">DomainResource</a></p><p>Next: <a href="https://medium.com/thai-fhir-sig/extension-19ceec5557bc">Extension</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce17f1d6b108" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thai-fhir-sig/resource-part-3-ce17f1d6b108">Resource (Part 3)</a> was originally published in <a href="https://medium.com/thai-fhir-sig">SIL-Thailand</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>