Nouvelle publication

Rechercher

Résumé
· Mai 13, 2024

【週間ダイジェスト】 5/06 ~ 5/12 の開発者コミュニティへの投稿

Question
· Mai 13, 2024

SQL LOAD DATA ISSUES

Hello Community,

I'm trying to load a file by execute this LOAD DATA SQL command in both studio and SQL-SMP I got the below error.

///sample executed queries
ClassMethod ExecutedQueries()
{
    /// executed queries - 1
 LOAD DATA FROM FILE 'C:\\FHIRFILE\mycont.csv' COLUMNS ( C_COUNTRY VARCHAR ( 40 ) , C_CODE VARCHAR ( 20 ) ) INTO SAMPLE . COUNTRIES ( COUNTRY , CODE ) VALUES ( C_COUNTRY , C_CODE )
    /// executed queries - 2
LOAD DATA FROM FILE 'C:\FHIRFILE\mycont.csv' INTO SAMPLE . COUNTRIES ( COUNTRY , CODE )
    
}

sample data

4 Comments
Discussion (4)2
Connectez-vous ou inscrivez-vous pour continuer
Article
· Mai 12, 2024 5m de lecture

IRIS AI Studio: A playground to explore the Generative AI & Vector Embedding capabilities

 

Problem

Do you resonate with this - A capability and impact of a technology being truly discovered when it's packaged in a right way to it's audience. Finest example would be, how the Generative AI took off when ChatGPT was put in the public for easy access and not when Transformers/RAG's capabilities were identified. At least a much higher usage came in, when the audience were empowered to explore the possibilities.  

 

Motivation

Recently I got to participate in MIT Grand Hack, Boston where during my conversation with other participants, I noticed immense interest from physicians and non-technical veterans to explore the Generative AI capabilities in their domain. In one of the talks, a finest example, that showcased how the EHR's have a complicated UI being compared with a sleek UI of ChatGPT. Though they both address different needs and comes with it's own pros and cons, my key takeaway was, "The world is not going back towards, complicated user interfaces, or slow systems. And the future lies in systems characterized by intuitive design and optimized performance".

For the non-technical stakeholders who wanted to explore the Generative AI capabilities, is there a way to do it without much of technical hassle. Indeed, Co-lab/Jupyter notebooks have significantly simplified the process of running code. However, can we further streamline this to resemble the intuitive interfaces of platforms like OpenAI's Playground or Azure/Vertex AI Studio? Such a user-friendly environment would empower non-technical stakeholders to grasp the capabilities and constraints of Vector DB effortlessly. 

⚡️ How might we enable non-technical individuals, to evaluate IRIS vector DB potential use cases for their products/services, without exhausting developer resources?

 

Solution 

IRIS AI Studio— A no-code/low-code platform to explore the capabilities of vector embeddings in IRIS DB. User can seamlessly load data from various sources as vector embeddings into IRIS DB and then retrieve the information through multiple channels. Here, the loading of data is called Connectors and retrieval part can be done through Playground. At its core, IRIS AI Studio simplifies the process of working with vector embeddings and let user visualize the power of AI being harnessed for diverse applications.

Connectors

In connectors, the user starts with choosing the data source where they wanted to get the data from to load into IRIS DB as vector embeddings. They can upload files from their local system or retrieve data from cloud storage services as well. This feature has the potential to function as a data pipeline with the addition of CRON job capabilities. 

Initially I have added 4 different data sources - Local Storage, AWS S3, Airtable and Azure Blob Storage.

After choosing the data source, user needs to input the concerned additional information, like client id and secret key for AWS S3 storage. Then, user can configure the embeddings, by choosing the indexing type, model they wanted to use, dimensions and enter the data table name in IRIS, this data needs to be loaded into. Currently indexing from OpenAI and Cohere embeddings are supported, but just with few lines of code, we could add support for many other embeddings. 

After finishing the two steps, the data from the source is converted as vector embeddings and added to the IRIS data table. 

Playground

Now that we have the vector embedded data in IRIS DB, letting user retrieve the contents in their preferred channels can be done from Playground. Here are few examples how that's done. 

In Semantic Search user needs to enter the configurations that they've used to load the data and the semantic search query that they wanted to get executed on the vector embeddings. This will retrieve the contents from IRIS DB and return the results in a natural language format.

 

 

In the Chat with Docs user needs to enter the configurations that they've used to load the data and the chat query they wanted to make. The chat option gets differed from the query option significantly due to the context awareness. Also, in chat with docs we could plug in with many different LLM options to retrieve the contents and need not stick to the chosen indexing options (Currently OpenAI's GPT 3.5 turbo is added as default)

 

Settings

In the settings section, user could add multiple IRIS instance configurations which will be stored in the browser's local storage and user could choose which of them they wanted to actively engage with. This will make their work easier on managing multiple instances and choosing preferred ones to use. Also, here the LLM service's API Keys can be added (will be saved to browser's session storage) and automatically picked up during indexing or retrieval purposes. None of this information is being saved and it's been taken to the backend only for processing purposes.

 

Try it out

Clone the project repository from the following GitHub link: https://github.com/ikram-shah/iris-ai-studio.

Follow the provided instructions to set up the project locally on your machine. Please note, as on May 12, 2024 for some modules, development is still in-progress, but the functionality discussed above should work like a charm 💪🏻 Let know if something doesn’t work as expected through DM or issues section in Github.

Tech Stack

Frontend: VueJS, TailwindCSS, Flowbite

Backend: Python, Flask

Database: InterSystems IRIS

Frameworks/Libraries/Services: Llama-Index, SQLalchemy-iris, OpenAI, Cohere

Infrastructure: Vercel (frontend hosting), Render (backend hosting)

 

Credits

Thanks to the detailed documentation on Vector Search by InterSystems

Thanks to IRIS Vector Search template for simplifying the modules and capabilities by @Alvin Ryanputra 

Thanks to llama-iris library by @Dmitry Maslennikov 

 

Thoughts and Feedback

I come from Product Innovation and Engineering background, and for over a year now, I've been exploring the technological advancements in the healthcare sector. I'm here learning more from the ISC developers community and I am positive that this AI Studio platform would be of help in your work, say developers could share it with Program Managers / Physicians to get their inputs on the quality of data thats been retrieved and many others use cases. If this article resonated with you or sparked any thoughts, please give it a thumbs up 👍 and feel free to share your thoughts in the comments section below. I'd love to connect with anyone interested in discussing further!

🚀 Vote for this application in Vector Search, GenAI and ML contest, if you find it promising!

I will share few more posts that does technical deep dive of this platform. 

6 Comments
Discussion (6)1
Connectez-vous ou inscrivez-vous pour continuer
Article
· Mai 12, 2024 6m de lecture

IRIS BI開発者向けチュートリアルを試してみる(9)

はじめに

IRIS BIチュートリアル試してみたシリーズの9回目です。
今回は、チュートリアル全6ページのうちの5ページ目、「サブジェクト領域の作成」について試していきます。
「サブジェクト領域」という新しい概念が出てきますが、どんなものかを触りながら理解していきます。
では、早速はじめていきましょう。

サブジェクト領域の作成

最初に、サブジェクト領域とは何かを理解するところから始めましょう。チュートリアルでは以下のような説明があります。

”サブジェクト領域は、オプションによる項目名のオーバーライドを持つサブキューブです。サブジェクト領域を定義すると、セキュリティ上の理由およびその他の理由により、より小さなデータ・セットに焦点を当てることができます。”

うーん、分かったような、分からないような。。実例を基に説明してみます。
6回目の記事で郵便番号と市区町村の階層を作成しました。郵便番号→市区町村という階層構造になっていましたよね。以下の図が、郵便番号と市区町村の関連を表したものです。
 
現状、チュートリアルで使用しているキューブには上記5つの郵便番号を持つデータが格納されています。
これを、特定の郵便番号のデータだけを扱えるサブセットに分割したい要件があったとします。例えば配達員の担当地域ごとに分割するとか。
そのような場合に用いられるのがサブジェクト領域です。チュートリアルでは、以下の2つのサブジェクト領域を作成します。

サブジェクト領域名 コンテンツ
Patient Set A 郵便番号 32006、32007、または 36711 に居住する患者
Patient Set B 郵便番号 34577、または 38928 に居住する患者


では、実際に作成していきます。作業はアーキテクト画面から行いますので、アーキテクト画面を開きます。
画面上部の [新規] ボタンをクリックし、新規作成のダイアログを表示します。表示されたダイアログに、以下のように設定します。

  • 定義タイプ:サブジェクト領域
  • サブジェクト領域の名前:Patient Set A
  • ベースキューブ:Tutorial
  • サブジェクト領域のクラス名:Tutorial.SubjectA

 
ベースキューブは [参照] ボタンから選択することもできます。

 
[OK] で終了すると、以下のような画面が表示されます。キューブ作成と同様に、ここに設定を施していくことになります。

ではここに、郵便番号のフィルタ条件を追加していきます。それに必要な情報を取得するために、別ウィンドウでアナライザ画面を立ち上げ、Tutorialキューブを開きます。
HomeD ディメンジョン配下の ZIP Code レベルを [フィルタ] にド
ラッグ&ドロップします。こんな画面になります。

ピボット・プレビュー領域のすぐ上に表示された ZIP Code の虫眼鏡アイコンをクリックします。
Patient Set Aの条件である、郵便番号=32006、32007、36711をチェックし、✓をクリックして終了します。


フィルタが適用され、件数が変わりました。
※注意:サンプルデータはランダムに作成されるため、こちらの画面表示とみなさまの実行結果は一致しないことがあります。

この状態で [クエリ表示] アイコンをクリックします。ピボット・ビルダ領域の [列] の上あたりにあるアイコンです。
   
MDXクエリが表示されます。

 
MDXクエリって何??という方もいらっしゃるかもしれません。これはOLAPデータベースに対する標準クエリ言語で、RDBにおけるSQLのようなものです。
このクエリ構文から、%FILTER より後ろにある条件の部分をコピーしておきます。コピーしたら、ダイアログは [OK] で閉じます。

%OR({[HOMED].[H1].[ZIP CODE].&[32006],[HOMED].[H1].[ZIP CODE].&[32007],[HOMED].[H1].[ZIP CODE].&[36711]})

では、再びアーキテクト画面に戻り、Patient Set Aの行をクリックして選択し、詳細ペインの [フィルタ] にコピーしたフィルタ式を貼り付けます。

 貼り付けたら [保存] ボタンをクリックして、サブジェクト領域を保存します。以下のダイアログで [OK] をクリックします。
  
保存が完了したら、続いてコンパイルします。

 

これで Patient Set A については作成できました。同様にPatient Set Bも作成します。

先ほどとの相違点のみ記載します。作成のダイアログで、名前を Patient Set B 、クラス名を Tutorial.SubjectB とします。
 
設定するフィルタ条件は、郵便番号=34577、38928 の2つになります。

%OR({[HOMED].[H1].[ZIP Code].&[34577],[HOMED].[H1].[ZIP Code].&[38928]})

保存、コンパイルまで完了したら、これで2つのサブジェクト領域は完成です。思ったよりもシンプルな作業ですね。

サブジェクト領域の検証

では、作成したサブジェクト領域が意図した通りに動作するかを確認します。
アナライザ画面で キューブの変更 アイコンをクリックします。作成した2つのサブジェクト領域が表示されますね。Patient Set A を選択して開きます。

 
[行] に ZIP Code をドラッグ&ドロップします。フィルタ設定した3つの郵便番号のみが表示されます。

 
同様に Patient Set B についても確認します。こちらもフィルタ設定した2つの郵便番号のみが表示されます。

 

一般的なフィルタ式

もう少しMDXクエリについて学んでみたいと思います。アナライザ画面で Tutorial キューブを開きます。
何も条件を設定しない状態で、先ほどの [クエリ表示] アイコンをクリックします。
 
Tutorial キューブが選択されていて、フィルタ条件などは一切無い状態です。
ではここに、ColorD ディメンジョン配下 Favorite Color レベルから Orange メンバを [フィルタ] にドラッグ&ドロップします。カウントが変わりましたね。

この状態で [クエリ表示] アイコンをクリックします。
 
フィルタ条件の構文、 %FILTER [ColorD].[H1].[Favorite Color].&[Orange] が追加されました。
では、いま設定したフィルタ条件を × で削除し、今度は Favorite Color レベルを [フィルタ] にセットします。その後にフィルタ・ボックスから Orange と Purple の2つを選択します。
 この状態でクエリ表示をしてみます。Orange だけの場合と異なり、 %OR で Orange と Purple の条件が囲まれています。
  
では次に、Favorite Color フィルタを Orange だけに設定し、AllerD ディメンジョン配下の Allergies レベルから mold メンバを [フィルタ] に追加します。以下のような設定になります。


この状態で [クエリ表示] アイコンをクリックします。
 
今度は2つの条件の組み合わせ(AND条件)になりますので、NONEMPTYCROSSJOIN という関数でフィルタ指定した2つのメンバが囲まれています。
ここでは、フィルタ条件を中心にMDXクエリについて確認しました。MDXについて詳しいことが知りたい場合は、オンラインドキュメントの以下のページを参考にしてください。

おわりに

今回はサブジェクト領域の作成を行いながら、その後ろ側で使用されているMDXクエリについて簡単に学びました。
部門ごとに参照可能なデータを制限したい、などデータを特定の条件でフィルタして公開したいというユースケースはよくあるかと思います。そのような場合に別々のキューブを作らずに対応できるサブジェクト領域は有用であると考えます。
次回からは、いよいよ最終ページ「ピボット・テーブルおよびダッシュボードの作成とパッケージ化」について取り上げます。お楽しみに!

Discussion (0)1
Connectez-vous ou inscrivez-vous pour continuer