|
| 1 | +# iris-fhirserver-template について |
| 2 | +FHIR サーバとして IRIS for Health Community Edition を使用するための開発テンプレートです。 |
| 3 | + |
| 4 | +開発テンプレートの中では、FHIR サーバの設定、テストデータのインポート、REST API の使用例を含む簡単な Web ページが用意されます。 |
| 5 | + |
| 6 | + |
| 7 | +## 前提条件 |
| 8 | +このテンプレートを利用するために、[git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) と [Docker desktop](https://www.docker.com/products/docker-desktop) のインストールが必要です。 |
| 9 | + |
| 10 | + |
| 11 | +## インストール方法 |
| 12 | + |
| 13 | +clone/git pull を使用してローカルディレクトリにリポジトリをダウンロードします。 |
| 14 | + |
| 15 | +``` |
| 16 | +$ git clone https://github.com/intersystems-community/iris-fhir-template.git |
| 17 | +``` |
| 18 | + |
| 19 | +clone したディレクトリでターミナルを開き、以下実行します。 |
| 20 | + |
| 21 | +``` |
| 22 | +$ docker-compose up -d |
| 23 | +``` |
| 24 | + |
| 25 | +## Patient data |
| 26 | +このテンプレートでは、[/fhirdata](https://github.com/intersystems-community/iris-fhir-server-template/tree/master/fhirdata) フォルダに5人の患者データのサンプルを用意していて、[docker build](https://github.com/intersystems-community/iris-fhir-server-template/blob/8bd2932b34468f14530a53d3ab5125f9077696bb/iris.script#L26) のときにロードしています。 |
| 27 | + |
| 28 | +また、[synthea-loader.sh](/synthea-loader.sh) を使用して任意数の患者データを生成できます。 |
| 29 | +ターミナルを開き、git clone で生成されたディレクトリに移動し以下実行します(Windowsで実行する場合は、synthea-loader.bat をご利用ください。)。 |
| 30 | + |
| 31 | +``` |
| 32 | +#./synthea-loader.sh 5 |
| 33 | +``` |
| 34 | + |
| 35 | +上記実行により、5人の患者データ用ファイルが data/fhir 以下に追加されます。 |
| 36 | +IRIS のターミナルを開き、FHIRSERVER へ移動します。 |
| 37 | + |
| 38 | +``` |
| 39 | +docker-compose exec iris iris session iris -U FHIRServer |
| 40 | +``` |
| 41 | + |
| 42 | +FHIRSERVER のプロンプトが表示されたら以下実行します。 |
| 43 | + |
| 44 | +``` |
| 45 | +FHIRSERVER>do ##class(fhirtemplate.Setup).LoadPatientData("/irisdev/app/output/fhir","FHIRSERVER","/fhir/r4") |
| 46 | +``` |
| 47 | + |
| 48 | +より多くの患者データサンプルを作成されたい場合は、こちら [following project](https://github.com/intersystems-community/irisdemo-base-synthea) をご利用ください。 |
| 49 | + |
| 50 | + |
| 51 | +## FHIR R4 API のテスト方法 |
| 52 | + |
| 53 | +開発テンプレートが提供する FHIR サーバの Capability Statement をご参照ください。 |
| 54 | +以下 URL から FHIR サーバの Capability Statement を参照できます。 |
| 55 | + |
| 56 | +http://localhost:32783/fhir/r4/metadata |
| 57 | + |
| 58 | + |
| 59 | +## Postman を利用して Capability Statement を参照する |
| 60 | +FHIR リソースのメタ情報を取得するには、以下の GET要求を実行します。 |
| 61 | + |
| 62 | +GET http://localhost:32783/fhir/r4/metadata |
| 63 | + |
| 64 | +<img width="881" alt="Screenshot 2020-08-07 at 17 42 04" src="https://user-images.githubusercontent.com/2781759/89657453-c7cdac00-d8d5-11ea-8fed-71fa8447cc45.png"> |
| 65 | + |
| 66 | + |
| 67 | +Postman で以下のGET要求を実行するとリソース ID=1 の患者リソースを取得できます。 |
| 68 | + |
| 69 | +http://localhost:32783/fhir/r4/Patient/1 |
| 70 | + |
| 71 | +<img width="884" alt="Screenshot 2020-08-07 at 17 42 26" src="https://user-images.githubusercontent.com/2781759/89657252-71606d80-d8d5-11ea-957f-041dbceffdc8.png"> |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | +## 簡単な フロントエンドアプリから FHIR API の呼び出しをテストする方法 |
| 76 | + |
| 77 | +Patient と Observation の FHIR リソースを検索し、結果を参照する非常に基本的なフロントエンドアプリは、以下 URL で参照できます。 |
| 78 | + |
| 79 | +http://localhost:32783/csp/user/fhirUI/FHIRAppDemo.html |
| 80 | + |
| 81 | +VSCode ObjectScript メニューからも開くことができます: |
| 82 | +<img width="616" alt="Screenshot 2020-08-07 at 17 34 49" src="https://user-images.githubusercontent.com/2781759/89657546-ea5fc500-d8d5-11ea-97ed-6fbbf84da655.png"> |
| 83 | + |
| 84 | +ページを開くと、貧血の症状を持つ女性患者の検索結果を参照できます。 |
| 85 | +また、特定の患者IDを指定すると、ヘモグロビン値のグラフを参照できます。 |
| 86 | + |
| 87 | +<img width="484" alt="Screenshot 2020-08-06 at 18 51 22" src="https://user-images.githubusercontent.com/2781759/89657718-2b57d980-d8d6-11ea-800f-d09dfb48f8bc.png"> |
| 88 | + |
| 89 | + |
| 90 | +## 参考情報 |
| 91 | +[InterSystems IRIS FHIR Documentation](https://docs.intersystems.com/irisforhealth20203/csp/docbook/Doc.View.cls?KEY=HXFHIR) |
| 92 | + |
| 93 | +[FHIR API](http://hl7.org/fhir/resourcelist.html) |
| 94 | + |
| 95 | +[Developer Community FHIR section(US版)](https://community.intersystems.com/tags/fhir) |
| 96 | + |
| 97 | +[Developer Community FHIR section(日本版)](https://jp.community.intersystems.com/tags/fhir) |
| 98 | + |
| 99 | + |
| 100 | +## コーディングの開始方法(ObjectScript) |
| 101 | +このGitリポジトリは、ObjectScript のプラグイン使用して VSCode でコーディングする準備が整っています。 |
| 102 | +[VSCode](https://code.visualstudio.com/), [Docker](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker) [ObjectScript](https://marketplace.visualstudio.com/items?itemName=daimor.vscode-objectscript) プラグインインストールします。あとは、VSCoed でリポジトリのフォルダを開くだけです。 |
| 103 | + |
| 104 | +/src/cls/PackageSample/ObjectScript.cls を開き何か変更を加えてみてください。Ctrl+Sで保存すると実行中の IRIS docker コンテナでコンパイルされます。 |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | +PackageSample フォルダはサンプルです。ObjectScript 練習用として、編集、削除などお好みで行ってください。 |
| 109 | +もし、新規でクラスを作成する場合は /src 以下にパッケージ名のフォルダを作成し、その下にクラス名のファイル(例:Classname.cls)を配置してください。 |
| 110 | +例) /src/Package/Classname.cls |
| 111 | + |
| 112 | +ご参考:[Read more about folder setup for InterSystems ObjectScript](https://community.intersystems.com/post/simplified-objectscript-source-folder-structure-package-manager) |
| 113 | + |
| 114 | + |
| 115 | +## リポジトリの中身について |
| 116 | + |
| 117 | +### Dockerfile |
| 118 | + |
| 119 | +IRIS を起動し、開発テンプレートに必要なファイルのコピー([/src](https://github.com/intersystems-community/iris-fhir-server-template/tree/master/src) 、[/fhirdata](https://github.com/intersystems-community/iris-fhir-server-template/tree/master/fhirdata)、[/fhirUI](https://github.com/intersystems-community/iris-fhir-server-template/tree/master/fhirUI) 、[/iris.script](https://github.com/intersystems-community/iris-fhir-server-template/tree/master/iris.script) )と iris.script の実行を行います。 |
| 120 | + |
| 121 | +関連する docker-compose.yml を使用して、ポート番号やホストフォルダをマップする場所などの追加パラメータを簡単に設定します。 |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | +### .vscode/settings.json |
| 126 | + |
| 127 | +[VSCode ObjectScript プラグイン](https://marketplace.visualstudio.com/items?itemName=daimor.vscode-objectscript)を使って VSCode ですぐにコーディングできるようにするための設定ファイルです。 |
| 128 | + |
| 129 | +### .vscode/launch.json |
| 130 | +VSCode ObjectScript でデバッグしたい場合の設定ファイルです。 |
| 131 | + |
| 132 | + |
| 133 | +## トラブルシューティング |
| 134 | + |
| 135 | +### ERROR #5001: Error -28 Creating Directory /usr/irissys/mgr/FHIRSERVER/ |
| 136 | +このエラーが出る場合、docker の空き容量を使い果たしてしまった可能性があります。以下のコマンドを利用して未使用のイメージ、キャッシュ、コンテナを削除することができます。 |
| 137 | +(-f オプションを指定しない場合、確認用のプロンプトが出力されます) |
| 138 | + |
| 139 | +``` |
| 140 | +$ docker system prune -f |
| 141 | +``` |
| 142 | + |
| 143 | +上記コマンド実行後、キャッシュを使用しないイメージの再構築を行います。 |
| 144 | + |
| 145 | +``` |
| 146 | +$ docker-compose build --no-cache |
| 147 | +``` |
| 148 | + |
| 149 | +上記コマンド実行後、コンテナを開始します。 |
| 150 | + |
| 151 | +``` |
| 152 | +$ docker-compose up -d |
| 153 | +``` |
| 154 | + |
| 155 | +この他のヒントについては、[dev.md](/dev.md) をご参照ください。 |
| 156 | + |
0 commit comments