빠른 시작: Text Analytics for Health 클라이언트 라이브러리 및 REST API 사용

이 문서에는 지원되는 클라이언트 라이브러리, C#, Java, NodeJS 및 Python을 사용하고 REST API를 사용하는 데 도움이 되는 상태 빠른 시작에 대한 Text Analytics가 포함되어 있습니다.

Language Studio를 사용하여 코드를 작성하지 않고도 Language Service 기능을 사용해 볼 수 있습니다.

참조 설명서 | 추가 샘플 | 패키지(NuGet) | 라이브러리 소스 코드

이 빠른 시작을 사용하여 .NET용 클라이언트 라이브러리를 사용하여 Text Analytics for Health 애플리케이션을 만듭니다. 다음 예제에서는 텍스트에 표시되는 의료 엔터티, 관계어설션을 식별할 수 있는 C# 애플리케이션을 만듭니다.

필수 조건

  • Azure 구독 - 체험 구독 만들기
  • Visual Studio IDE
  • Azure 구독이 있으면 Azure Portal에서 언어 리소스를 만들어 키와 엔드포인트를 가져옵니다. 배포 후 리소스로 이동을 선택합니다.
    • 애플리케이션을 API에 연결하려면 만든 리소스의 키와 엔드포인트가 필요합니다. 이 빠른 시작의 뒷부분에 나오는 코드에 키와 엔드포인트를 붙여넣습니다.
    • 무료 가격 책정 계층(Free F0)을 사용하여 서비스를 체험하고(각각 5000개의 텍스트 레코드 - 1000자 제공) 나중에 프로덕션용 Standard S 가격 책정 계층으로 업그레이드할 수 있습니다. 또한 가격 책정 계층으로 Standard S 시작하여 요금이 청구되기 전에 동일한 초기 할당량(5,000개 텍스트 레코드)을 무료로 받을 수 있습니다. 가격 책정에 대한 자세한 내용은 언어 서비스 가격 책정을 참조하세요.

설정

환경 변수 만들기

API 요청을 보내려면 애플리케이션을 인증해야 합니다. 프로덕션의 경우 자격 증명을 안전하게 저장하고 액세스하는 방법을 사용합니다. 이 예제에서는 애플리케이션을 실행하는 로컬 컴퓨터의 환경 변수에 자격 증명을 작성합니다.

코드에 키를 직접 포함하지 말고 공개적으로 게시하지 마세요. Azure Key Vault와 같은 추가 인증 옵션은 Azure AI 서비스 보안 문서를 참조하세요.

Language 리소스 키에 대한 환경 변수를 설정하려면 콘솔 창을 열고 운영 체제 및 개발 환경에 대한 지침을 따릅니다.

  1. LANGUAGE_KEY 환경 변수를 설정하려면 your-key를 리소스에 대한 키 중 하나로 바꿉니다.
  2. LANGUAGE_ENDPOINT 환경 변수를 설정하려면 your-endpoint를 리소스에 대한 엔드포인트로 바꿉니다.
setx LANGUAGE_KEY your-key
setx LANGUAGE_ENDPOINT your-endpoint

참고 항목

현재 실행 중인 콘솔에서만 환경 변수에 액세스해야 하는 경우 환경 변수를 setx 대신 set으로 설정할 수 있습니다.

환경 변수가 추가되면 콘솔 창을 포함하여 환경 변수를 읽어야 하는 실행 중인 프로그램을 다시 시작해야 할 수 있습니다. 예를 들어 편집기로 Visual Studio를 사용하는 경우 Visual Studio를 다시 시작한 후 예제를 실행합니다.

새 .NET Core 애플리케이션 만들기

Visual Studio IDE를 사용하여 새 .NET Core 콘솔 앱을 만듭니다. 이렇게 하면 program.cs라는 단일 C# 원본 파일이 포함된 "Hello World" 프로젝트가 생성됩니다.

솔루션 탐색기에서 솔루션을 마우스 오른쪽 단추로 클릭하고 NuGet 패키지 관리를 선택하여 클라이언트 라이브러리를 설치합니다. 열리는 패키지 관리자에서 찾아보기를 선택하고 Azure.AI.TextAnalytics를 검색합니다. 5.2.0 버전, 설치를 차례로 선택합니다. 패키지 관리자 콘솔을 사용할 수도 있습니다.

코드 예

program.cs 파일에 다음 코드를 복사합니다. 그런 다음 코드를 실행합니다.

Important

Azure Portal로 이동합니다. 필수 구성 요소 섹션에서 만든 언어 리소스가 성공적으로 배포된 경우 다음 단계 아래에서 리소스로 이동 단추를 클릭합니다. 리소스 관리에서 리소스의 키 및 엔드포인트 페이지로 이동하여 키와 엔드포인트를 찾을 수 있습니다.

Important

완료되면 코드에서 키를 제거하고 공개적으로 게시하지 마세요. 프로덕션의 경우 Azure Key Vault와 같은 자격 증명을 안전하게 저장하고 액세스하는 방법을 사용합니다. 자세한 내용은 Azure AI 서비스 보안 문서를 참조하세요.

using Azure;
using System;
using Azure.AI.TextAnalytics;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Example
{
    class Program
    {
        // This example requires environment variables named "LANGUAGE_KEY" and "LANGUAGE_ENDPOINT"
        private static readonly AzureKeyCredential credentials = new (Environment.GetEnvironmentVariable("LANGUAGE_KEY"));
        private static readonly Uri endpoint = new (Environment.GetEnvironmentVariable("LANGUAGE_ENDPOINT"));
        
        // Example method for extracting information from healthcare-related text 
        static async Task healthExample(TextAnalyticsClient client)
        {
            string document = "Prescribed 100mg ibuprofen, taken twice daily.";

            List<string> batchInput = new List<string>()
            {
                document
            };
            AnalyzeHealthcareEntitiesOperation healthOperation = await client.StartAnalyzeHealthcareEntitiesAsync(batchInput);
            await healthOperation.WaitForCompletionAsync();

            await foreach (AnalyzeHealthcareEntitiesResultCollection documentsInPage in healthOperation.Value)
            {
                Console.WriteLine($"Results of Azure Text Analytics for health async model, version: \"{documentsInPage.ModelVersion}\"");
                Console.WriteLine("");

                foreach (AnalyzeHealthcareEntitiesResult entitiesInDoc in documentsInPage)
                {
                    if (!entitiesInDoc.HasError)
                    {
                        foreach (var entity in entitiesInDoc.Entities)
                        {
                            // view recognized healthcare entities
                            Console.WriteLine($"  Entity: {entity.Text}");
                            Console.WriteLine($"  Category: {entity.Category}");
                            Console.WriteLine($"  Offset: {entity.Offset}");
                            Console.WriteLine($"  Length: {entity.Length}");
                            Console.WriteLine($"  NormalizedText: {entity.NormalizedText}");
                        }
                        Console.WriteLine($"  Found {entitiesInDoc.EntityRelations.Count} relations in the current document:");
                        Console.WriteLine("");

                        // view recognized healthcare relations
                        foreach (HealthcareEntityRelation relations in entitiesInDoc.EntityRelations)
                        {
                            Console.WriteLine($"    Relation: {relations.RelationType}");
                            Console.WriteLine($"    For this relation there are {relations.Roles.Count} roles");

                            // view relation roles
                            foreach (HealthcareEntityRelationRole role in relations.Roles)
                            {
                                Console.WriteLine($"      Role Name: {role.Name}");

                                Console.WriteLine($"      Associated Entity Text: {role.Entity.Text}");
                                Console.WriteLine($"      Associated Entity Category: {role.Entity.Category}");
                                Console.WriteLine("");
                            }
                            Console.WriteLine("");
                        }
                    }
                    else
                    {
                        Console.WriteLine("  Error!");
                        Console.WriteLine($"  Document error code: {entitiesInDoc.Error.ErrorCode}.");
                        Console.WriteLine($"  Message: {entitiesInDoc.Error.Message}");
                    }
                    Console.WriteLine("");
                }
            }
        }

        static async Task Main(string[] args)
        {
            var client = new TextAnalyticsClient(endpoint, credentials);
            await healthExample(client);
        }

    }
}

출력

Results of Azure Text Analytics for health async model, version: "2022-03-01"

  Entity: 100mg
  Category: Dosage
  Offset: 11
  Length: 5
  NormalizedText:
  Entity: ibuprofen
  Category: MedicationName
  Offset: 17
  Length: 9
  NormalizedText: ibuprofen
  Entity: twice daily
  Category: Frequency
  Offset: 34
  Length: 11
  NormalizedText:
  Found 2 relations in the current document:

    Relation: DosageOfMedication
    For this relation there are 2 roles
      Role Name: Dosage
      Associated Entity Text: 100mg
      Associated Entity Category: Dosage

      Role Name: Medication
      Associated Entity Text: ibuprofen
      Associated Entity Category: MedicationName


    Relation: FrequencyOfMedication
    For this relation there are 2 roles
      Role Name: Medication
      Associated Entity Text: ibuprofen
      Associated Entity Category: MedicationName

      Role Name: Frequency
      Associated Entity Text: twice daily
      Associated Entity Category: Frequency

FHIR(전자 의료 기록 교환) 구조화는 Language REST API를 사용하여 미리 볼 수 있습니다. 클라이언트 라이브러리는 현재 지원되지 않습니다. API 호출에서 FHIR 구조화를 사용하는 방법에 대해 자세히 알아봅니다.

참조 설명서 | 추가 샘플 | 패키지(Maven) | 라이브러리 소스 코드

이 빠른 시작을 사용하여 Java용 클라이언트 라이브러리를 사용하여 Text Analytics for Health 애플리케이션을 만듭니다. 다음 예제에서는 텍스트에 표시되는 의료 엔터티, 관계어설션을 식별할 수 있는 Java 애플리케이션을 만듭니다.

필수 조건

  • Azure 구독 - 체험 구독 만들기
  • JDK(Java Development Kit) 버전 8 이상
  • Azure 구독이 있으면 Azure Portal에서 언어 리소스를 만들어 키와 엔드포인트를 가져옵니다. 배포 후 리소스로 이동을 선택합니다.
    • 애플리케이션을 API에 연결하려면 만든 리소스의 키와 엔드포인트가 필요합니다. 이 빠른 시작의 뒷부분에 나오는 코드에 키와 엔드포인트를 붙여넣습니다.
    • 무료 가격 책정 계층(Free F0)을 사용하여 서비스를 체험하고(각각 5000개의 텍스트 레코드 - 1000자 제공) 나중에 프로덕션용 Standard S 가격 책정 계층으로 업그레이드할 수 있습니다. 또한 가격 책정 계층으로 Standard S 시작하여 요금이 청구되기 전에 동일한 초기 할당량(5,000개 텍스트 레코드)을 무료로 받을 수 있습니다. 가격 책정에 대한 자세한 내용은 언어 서비스 가격 책정을 참조하세요.

설정

환경 변수 만들기

API 요청을 보내려면 애플리케이션을 인증해야 합니다. 프로덕션의 경우 자격 증명을 안전하게 저장하고 액세스하는 방법을 사용합니다. 이 예제에서는 애플리케이션을 실행하는 로컬 컴퓨터의 환경 변수에 자격 증명을 작성합니다.

코드에 키를 직접 포함하지 말고 공개적으로 게시하지 마세요. Azure Key Vault와 같은 추가 인증 옵션은 Azure AI 서비스 보안 문서를 참조하세요.

Language 리소스 키에 대한 환경 변수를 설정하려면 콘솔 창을 열고 운영 체제 및 개발 환경에 대한 지침을 따릅니다.

  1. LANGUAGE_KEY 환경 변수를 설정하려면 your-key를 리소스에 대한 키 중 하나로 바꿉니다.
  2. LANGUAGE_ENDPOINT 환경 변수를 설정하려면 your-endpoint를 리소스에 대한 엔드포인트로 바꿉니다.
setx LANGUAGE_KEY your-key
setx LANGUAGE_ENDPOINT your-endpoint

참고 항목

현재 실행 중인 콘솔에서만 환경 변수에 액세스해야 하는 경우 환경 변수를 setx 대신 set으로 설정할 수 있습니다.

환경 변수가 추가되면 콘솔 창을 포함하여 환경 변수를 읽어야 하는 실행 중인 프로그램을 다시 시작해야 할 수 있습니다. 예를 들어 편집기로 Visual Studio를 사용하는 경우 Visual Studio를 다시 시작한 후 예제를 실행합니다.

클라이언트 라이브러리 추가

선호하는 IDE 또는 개발 환경에서 Maven 프로젝트를 만듭니다. 그런 다음, 프로젝트의 pom.xml 파일에 다음 종속성을 추가합니다. 온라인에서 다른 빌드 도구용 구현 구문을 찾을 수 있습니다.

<dependencies>
     <dependency>
        <groupId>com.azure</groupId>
        <artifactId>azure-ai-textanalytics</artifactId>
        <version>5.2.0</version>
    </dependency>
</dependencies>

코드 예

EntityLinking.java라는 Java 파일을 만듭니다. 파일을 열고 아래 코드를 복사합니다. 그런 다음 코드를 실행합니다.

Important

Azure Portal로 이동합니다. 필수 구성 요소 섹션에서 만든 언어 리소스가 성공적으로 배포된 경우 다음 단계 아래에서 리소스로 이동 단추를 클릭합니다. 리소스 관리에서 리소스의 키 및 엔드포인트 페이지로 이동하여 키와 엔드포인트를 찾을 수 있습니다.

Important

완료되면 코드에서 키를 제거하고 공개적으로 게시하지 마세요. 프로덕션의 경우 Azure Key Vault와 같은 자격 증명을 안전하게 저장하고 액세스하는 방법을 사용합니다. 자세한 내용은 Azure AI 서비스 보안 문서를 참조하세요.

import com.azure.core.credential.AzureKeyCredential;
import com.azure.ai.textanalytics.models.*;
import com.azure.ai.textanalytics.TextAnalyticsClientBuilder;
import com.azure.ai.textanalytics.TextAnalyticsClient;

import java.util.List;
import java.util.Arrays;
import com.azure.core.util.Context;
import com.azure.core.util.polling.SyncPoller;

import com.azure.ai.textanalytics.util.*;


public class Example {

    // This example requires environment variables named "LANGUAGE_KEY" and "LANGUAGE_ENDPOINT"
    private static String KEY = System.getenv("LANGUAGE_KEY");
    private static String ENDPOINT = System.getenv("LANGUAGE_ENDPOINT");

    public static void main(String[] args) {
        TextAnalyticsClient client = authenticateClient(languageKey, languageEndpoint);
        healthExample(client);
    }

    // Method to authenticate the client object with your key and endpoint
    static TextAnalyticsClient authenticateClient(String key, String endpoint) {
        return new TextAnalyticsClientBuilder()
                .credential(new AzureKeyCredential(key))
                .endpoint(endpoint)
                .buildClient();
    }

    // Example method for extracting information from healthcare-related text 
    static void healthExample(TextAnalyticsClient client){
        List<TextDocumentInput> documents = Arrays.asList(
                new TextDocumentInput("0",
                        "Prescribed 100mg ibuprofen, taken twice daily."));

        AnalyzeHealthcareEntitiesOptions options = new AnalyzeHealthcareEntitiesOptions().setIncludeStatistics(true);

        SyncPoller<AnalyzeHealthcareEntitiesOperationDetail, AnalyzeHealthcareEntitiesPagedIterable>
                syncPoller = client.beginAnalyzeHealthcareEntities(documents, options, Context.NONE);

        System.out.printf("Poller status: %s.%n", syncPoller.poll().getStatus());
        syncPoller.waitForCompletion();

        // Task operation statistics
        AnalyzeHealthcareEntitiesOperationDetail operationResult = syncPoller.poll().getValue();
        System.out.printf("Operation created time: %s, expiration time: %s.%n",
                operationResult.getCreatedAt(), operationResult.getExpiresAt());
        System.out.printf("Poller status: %s.%n", syncPoller.poll().getStatus());

        for (AnalyzeHealthcareEntitiesResultCollection resultCollection : syncPoller.getFinalResult()) {
            // Model version
            System.out.printf(
                    "Results of Azure Text Analytics for health entities\" Model, version: %s%n",
                    resultCollection.getModelVersion());

            for (AnalyzeHealthcareEntitiesResult healthcareEntitiesResult : resultCollection) {
                System.out.println("Document ID = " + healthcareEntitiesResult.getId());
                System.out.println("Document entities: ");
                // Recognized healthcare entities
                for (HealthcareEntity entity : healthcareEntitiesResult.getEntities()) {
                    System.out.printf(
                            "\tText: %s, normalized name: %s, category: %s, subcategory: %s, confidence score: %f.%n",
                            entity.getText(), entity.getNormalizedText(), entity.getCategory(),
                            entity.getSubcategory(), entity.getConfidenceScore());
                }
                // Recognized healthcare entity relation groups
                for (HealthcareEntityRelation entityRelation : healthcareEntitiesResult.getEntityRelations()) {
                    System.out.printf("Relation type: %s.%n", entityRelation.getRelationType());
                    for (HealthcareEntityRelationRole role : entityRelation.getRoles()) {
                        HealthcareEntity entity = role.getEntity();
                        System.out.printf("\tEntity text: %s, category: %s, role: %s.%n",
                                entity.getText(), entity.getCategory(), role.getName());
                    }
                }
            }
        }
    }
}

출력

Poller status: IN_PROGRESS.
Operation created time: 2022-09-15T19:06:11Z, expiration time: 2022-09-16T19:06:11Z.
Poller status: SUCCESSFULLY_COMPLETED.
Results of Azure Text Analytics for health entities" Model, version: 2022-03-01
Document ID = 0
Document entities: 
	Text: 100mg, normalized name: null, category: Dosage, subcategory: null, confidence score: 0.980000.
	Text: ibuprofen, normalized name: ibuprofen, category: MedicationName, subcategory: null, confidence score: 1.000000.
	Text: twice daily, normalized name: null, category: Frequency, subcategory: null, confidence score: 1.000000.
Relation type: DosageOfMedication.
	Entity text: 100mg, category: Dosage, role: Dosage.
	Entity text: ibuprofen, category: MedicationName, role: Medication.
Relation type: FrequencyOfMedication.
	Entity text: ibuprofen, category: MedicationName, role: Medication.
	Entity text: twice daily, category: Frequency, role: Frequency.

FHIR(전자 의료 기록 교환) 구조화는 Language REST API를 사용하여 미리 볼 수 있습니다. 클라이언트 라이브러리는 현재 지원되지 않습니다. API 호출에서 FHIR 구조화를 사용하는 방법에 대해 자세히 알아봅니다.

참조 설명서 | 추가 샘플 | 패키지(npm) | 라이브러리 소스 코드

이 빠른 시작을 사용하여 Node.js용 클라이언트 라이브러리를 사용하여 Text Analytics for Health 애플리케이션을 만듭니다. 다음 예제에서는 텍스트에 표시되는 의료 엔터티, 관계어설션을 식별할 수 있는 JavaScript 애플리케이션을 만듭니다.

필수 조건

  • Azure 구독 - 체험 구독 만들기
  • Node.js v14 LTS 이상
  • Azure 구독이 있으면 Azure Portal에서 언어 리소스를 만들어 키와 엔드포인트를 가져옵니다. 배포 후 리소스로 이동을 선택합니다.
    • 애플리케이션을 API에 연결하려면 만든 리소스의 키와 엔드포인트가 필요합니다. 이 빠른 시작의 뒷부분에 나오는 코드에 키와 엔드포인트를 붙여넣습니다.
    • 무료 가격 책정 계층(Free F0)을 사용하여 서비스를 체험하고(각각 5000개의 텍스트 레코드 - 1000자 제공) 나중에 프로덕션용 Standard S 가격 책정 계층으로 업그레이드할 수 있습니다. 또한 가격 책정 계층으로 Standard S 시작하여 요금이 청구되기 전에 동일한 초기 할당량(5,000개 텍스트 레코드)을 무료로 받을 수 있습니다. 가격 책정에 대한 자세한 내용은 언어 서비스 가격 책정을 참조하세요.

설정

환경 변수 만들기

API 요청을 보내려면 애플리케이션을 인증해야 합니다. 프로덕션의 경우 자격 증명을 안전하게 저장하고 액세스하는 방법을 사용합니다. 이 예제에서는 애플리케이션을 실행하는 로컬 컴퓨터의 환경 변수에 자격 증명을 작성합니다.

코드에 키를 직접 포함하지 말고 공개적으로 게시하지 마세요. Azure Key Vault와 같은 추가 인증 옵션은 Azure AI 서비스 보안 문서를 참조하세요.

Language 리소스 키에 대한 환경 변수를 설정하려면 콘솔 창을 열고 운영 체제 및 개발 환경에 대한 지침을 따릅니다.

  1. LANGUAGE_KEY 환경 변수를 설정하려면 your-key를 리소스에 대한 키 중 하나로 바꿉니다.
  2. LANGUAGE_ENDPOINT 환경 변수를 설정하려면 your-endpoint를 리소스에 대한 엔드포인트로 바꿉니다.
setx LANGUAGE_KEY your-key
setx LANGUAGE_ENDPOINT your-endpoint

참고 항목

현재 실행 중인 콘솔에서만 환경 변수에 액세스해야 하는 경우 환경 변수를 setx 대신 set으로 설정할 수 있습니다.

환경 변수가 추가되면 콘솔 창을 포함하여 환경 변수를 읽어야 하는 실행 중인 프로그램을 다시 시작해야 할 수 있습니다. 예를 들어 편집기로 Visual Studio를 사용하는 경우 Visual Studio를 다시 시작한 후 예제를 실행합니다.

새 Node.js 애플리케이션 만들기

콘솔 창(예: cmd, PowerShell 또는 Bash)에서 앱에 대한 새 디렉터리를 만들고 이 디렉터리로 이동합니다.

mkdir myapp 

cd myapp

package.json 파일을 사용하여 노드 애플리케이션을 만들려면 npm init 명령을 실행합니다.

npm init

클라이언트 라이브러리 설치

npm 패키지를 설치합니다.

npm install @azure/ai-language-text

코드 예

파일을 열고 아래 코드를 복사합니다. 그런 다음 코드를 실행합니다.

Important

Azure Portal로 이동합니다. 필수 구성 요소 섹션에서 만든 언어 리소스가 성공적으로 배포된 경우 다음 단계 아래에서 리소스로 이동 단추를 클릭합니다. 리소스 관리에서 리소스의 키 및 엔드포인트 페이지로 이동하여 키와 엔드포인트를 찾을 수 있습니다.

Important

완료되면 코드에서 키를 제거하고 공개적으로 게시하지 마세요. 프로덕션의 경우 Azure Key Vault와 같은 자격 증명을 안전하게 저장하고 액세스하는 방법을 사용합니다. 자세한 내용은 Azure AI 서비스 보안 문서를 참조하세요.

"use strict";

const { TextAnalyticsClient, AzureKeyCredential } = require("@azure/ai-text-analytics");
// This example requires environment variables named "LANGUAGE_KEY" and "LANGUAGE_ENDPOINT"
const key = process.env.LANGUAGE_KEY;
const endpoint = process.env.LANGUAGE_ENDPOINT;

const documents = ["Patient does not suffer from high blood pressure."];
  
  async function main() {
    console.log("== Text analytics for health sample ==");
  
    const client = new TextAnalysisClient(endpoint, new AzureKeyCredential(key));
    const actions = [
      {
        kind: "Healthcare",
      },
    ];
    const poller = await client.beginAnalyzeBatch(actions, documents, "en");
  
    poller.onProgress(() => {
      console.log(
        `Last time the operation was updated was on: ${poller.getOperationState().modifiedOn}`
      );
    });
    console.log(`The operation was created on ${poller.getOperationState().createdOn}`);
    console.log(`The operation results will expire on ${poller.getOperationState().expiresOn}`);
  
    const results = await poller.pollUntilDone();
  
    for await (const actionResult of results) {
      if (actionResult.kind !== "Healthcare") {
        throw new Error(`Expected a healthcare results but got: ${actionResult.kind}`);
      }
      if (actionResult.error) {
        const { code, message } = actionResult.error;
        throw new Error(`Unexpected error (${code}): ${message}`);
      }
      for (const result of actionResult.results) {
        console.log(`- Document ${result.id}`);
        if (result.error) {
          const { code, message } = result.error;
          throw new Error(`Unexpected error (${code}): ${message}`);
        }
        console.log("\tRecognized Entities:");
        for (const entity of result.entities) {
          console.log(`\t- Entity "${entity.text}" of type ${entity.category}`);
          if (entity.dataSources.length > 0) {
            console.log("\t and it can be referenced in the following data sources:");
            for (const ds of entity.dataSources) {
              console.log(`\t\t- ${ds.name} with Entity ID: ${ds.entityId}`);
            }
          }
        }
        if (result.entityRelations.length > 0) {
          console.log(`\tRecognized relations between entities:`);
          for (const relation of result.entityRelations) {
            console.log(
              `\t\t- Relation of type ${relation.relationType} found between the following entities:`
            );
            for (const role of relation.roles) {
              console.log(`\t\t\t- "${role.entity.text}" with the role ${role.name}`);
            }
          }
        }
      }
    }
  }
  
  main().catch((err) => {
    console.error("The sample encountered an error:", err);
  });

출력

== Text analytics for health sample ==
The operation was created on Mon Feb 13 2023 13:12:10 GMT-0800 (Pacific Standard Time)
The operation results will expire on Tue Feb 14 2023 13:12:10 GMT-0800 (Pacific Standard Time)
Last time the operation was updated was on: Mon Feb 13 2023 13:12:10 GMT-0800 (Pacific Standard Time)
- Document 0
    Recognized Entities:
    - Entity "high blood pressure" of type SymptomOrSign
        and it can be referenced in the following data sources:
            - UMLS with Entity ID: C0020538
            - AOD with Entity ID: 0000023317
            - BI with Entity ID: BI00001
            - CCPSS with Entity ID: 1017493
            - CCS with Entity ID: 7.1
            - CHV with Entity ID: 0000015800
            - COSTAR with Entity ID: 397
            - CSP with Entity ID: 0571-5243
            - CST with Entity ID: HYPERTENS
            - DXP with Entity ID: U002034
            - HPO with Entity ID: HP:0000822
            - ICD10 with Entity ID: I10-I15.9
            - ICD10AM with Entity ID: I10-I15.9
            - ICD10CM with Entity ID: I10
            - ICD9CM with Entity ID: 997.91
            - ICPC2ICD10ENG with Entity ID: MTHU035456
            - ICPC2P with Entity ID: K85004
            - LCH with Entity ID: U002317
            - LCH_NW with Entity ID: sh85063723
            - LNC with Entity ID: LA14293-7
            - MDR with Entity ID: 10020772
            - MEDCIN with Entity ID: 33288
            - MEDLINEPLUS with Entity ID: 34
            - MSH with Entity ID: D006973
            - MTH with Entity ID: 005
            - MTHICD9 with Entity ID: 997.91
            - NANDA-I with Entity ID: 00905
            - NCI with Entity ID: C3117
            - NCI_CPTAC with Entity ID: C3117
            - NCI_CTCAE with Entity ID: E13785
            - NCI_CTRP with Entity ID: C3117
            - NCI_FDA with Entity ID: 1908
            - NCI_GDC with Entity ID: C3117
            - NCI_NCI-GLOSS with Entity ID: CDR0000458091
            - NCI_NICHD with Entity ID: C3117
            - NCI_caDSR with Entity ID: C3117
            - NOC with Entity ID: 060808
            - OMIM with Entity ID: MTHU002068
            - PCDS with Entity ID: PRB_11000.06
            - PDQ with Entity ID: CDR0000686951
            - PSY with Entity ID: 23830
            - RCD with Entity ID: XE0Ub
            - SNM with Entity ID: F-70700
            - SNMI with Entity ID: D3-02000
            - SNOMEDCT_US with Entity ID: 38341003
            - WHO with Entity ID: 0210

FHIR(전자 의료 기록 교환) 구조화는 Language REST API를 사용하여 미리 볼 수 있습니다. 클라이언트 라이브러리는 현재 지원되지 않습니다. API 호출에서 FHIR 구조화를 사용하는 방법에 대해 자세히 알아봅니다.

참조 설명서 | 추가 샘플 | 패키지(PyPi) | 라이브러리 소스 코드

이 빠른 시작을 사용하여 Python용 클라이언트 라이브러리를 사용하여 Text Analytics for Health 애플리케이션을 만듭니다. 다음 예제에서는 텍스트에 표시되는 의료 엔터티, 관계어설션을 식별할 수 있는 Python 애플리케이션을 만듭니다.

필수 조건

  • Azure 구독 - 체험 구독 만들기
  • Python 3.8 이상
  • Azure 구독이 있으면 Azure Portal에서 언어 리소스를 만들어 키와 엔드포인트를 가져옵니다. 배포 후 리소스로 이동을 선택합니다.
    • 애플리케이션을 API에 연결하려면 만든 리소스의 키와 엔드포인트가 필요합니다. 이 빠른 시작의 뒷부분에 나오는 코드에 키와 엔드포인트를 붙여넣습니다.
    • 무료 가격 책정 계층(Free F0)을 사용하여 서비스를 체험하고(각각 5000개의 텍스트 레코드 - 1000자 제공) 나중에 프로덕션용 Standard S 가격 책정 계층으로 업그레이드할 수 있습니다. 또한 가격 책정 계층으로 Standard S 시작하여 요금이 청구되기 전에 동일한 초기 할당량(5,000개 텍스트 레코드)을 무료로 받을 수 있습니다. 가격 책정에 대한 자세한 내용은 언어 서비스 가격 책정을 참조하세요.

설정

환경 변수 만들기

API 요청을 보내려면 애플리케이션을 인증해야 합니다. 프로덕션의 경우 자격 증명을 안전하게 저장하고 액세스하는 방법을 사용합니다. 이 예제에서는 애플리케이션을 실행하는 로컬 컴퓨터의 환경 변수에 자격 증명을 작성합니다.

코드에 키를 직접 포함하지 말고 공개적으로 게시하지 마세요. Azure Key Vault와 같은 추가 인증 옵션은 Azure AI 서비스 보안 문서를 참조하세요.

Language 리소스 키에 대한 환경 변수를 설정하려면 콘솔 창을 열고 운영 체제 및 개발 환경에 대한 지침을 따릅니다.

  1. LANGUAGE_KEY 환경 변수를 설정하려면 your-key를 리소스에 대한 키 중 하나로 바꿉니다.
  2. LANGUAGE_ENDPOINT 환경 변수를 설정하려면 your-endpoint를 리소스에 대한 엔드포인트로 바꿉니다.
setx LANGUAGE_KEY your-key
setx LANGUAGE_ENDPOINT your-endpoint

참고 항목

현재 실행 중인 콘솔에서만 환경 변수에 액세스해야 하는 경우 환경 변수를 setx 대신 set으로 설정할 수 있습니다.

환경 변수가 추가되면 콘솔 창을 포함하여 환경 변수를 읽어야 하는 실행 중인 프로그램을 다시 시작해야 할 수 있습니다. 예를 들어 편집기로 Visual Studio를 사용하는 경우 Visual Studio를 다시 시작한 후 예제를 실행합니다.

클라이언트 라이브러리 설치

Python을 설치한 후, 다음을 사용하여 클라이언트 라이브러리를 설치할 수 있습니다.

pip install azure-ai-textanalytics==5.2.0

코드 예

새 Python 파일을 만들고 아래 코드를 복사합니다. 그런 다음 코드를 실행합니다.

Important

Azure Portal로 이동합니다. 필수 구성 요소 섹션에서 만든 언어 리소스가 성공적으로 배포된 경우 다음 단계 아래에서 리소스로 이동 단추를 클릭합니다. 리소스 관리에서 리소스의 키 및 엔드포인트 페이지로 이동하여 키와 엔드포인트를 찾을 수 있습니다.

Important

완료되면 코드에서 키를 제거하고 공개적으로 게시하지 마세요. 프로덕션의 경우 Azure Key Vault와 같은 자격 증명을 안전하게 저장하고 액세스하는 방법을 사용합니다. 자세한 내용은 Azure AI 서비스 보안 문서를 참조하세요.

# This example requires environment variables named "LANGUAGE_KEY" and "LANGUAGE_ENDPOINT"
key = os.environ.get('LANGUAGE_KEY')
endpoint = os.environ.get('LANGUAGE_ENDPOINT')

from azure.ai.textanalytics import TextAnalyticsClient
from azure.core.credentials import AzureKeyCredential

# Authenticate the client using your key and endpoint 
def authenticate_client():
    ta_credential = AzureKeyCredential(key)
    text_analytics_client = TextAnalyticsClient(
            endpoint=endpoint, 
            credential=ta_credential)
    return text_analytics_client

client = authenticate_client()

# Example function for extracting information from healthcare-related text 
def health_example(client):
    documents = [
        """
        Patient needs to take 50 mg of ibuprofen.
        """
    ]

    poller = client.begin_analyze_healthcare_entities(documents)
    result = poller.result()

    docs = [doc for doc in result if not doc.is_error]

    for idx, doc in enumerate(docs):
        for entity in doc.entities:
            print("Entity: {}".format(entity.text))
            print("...Normalized Text: {}".format(entity.normalized_text))
            print("...Category: {}".format(entity.category))
            print("...Subcategory: {}".format(entity.subcategory))
            print("...Offset: {}".format(entity.offset))
            print("...Confidence score: {}".format(entity.confidence_score))
        for relation in doc.entity_relations:
            print("Relation of type: {} has the following roles".format(relation.relation_type))
            for role in relation.roles:
                print("...Role '{}' with entity '{}'".format(role.name, role.entity.text))
        print("------------------------------------------")
health_example(client)

출력

Entity: 50 mg
...Normalized Text: None
...Category: Dosage
...Subcategory: None
...Offset: 31
...Confidence score: 1.0
Entity: ibuprofen
...Normalized Text: ibuprofen
...Category: MedicationName
...Subcategory: None
...Offset: 40
...Confidence score: 1.0
Relation of type: DosageOfMedication has the following roles
...Role 'Dosage' with entity '50 mg'
...Role 'Medication' with entity 'ibuprofen'

FHIR(전자 의료 기록 교환) 구조화는 Language REST API를 사용하여 미리 볼 수 있습니다. 클라이언트 라이브러리는 현재 지원되지 않습니다. API 호출에서 FHIR 구조화를 사용하는 방법에 대해 자세히 알아봅니다.

참조 설명서

이 빠른 시작을 사용하여 REST API를 통해 언어 감지 요청을 보냅니다. 다음 예제에서는 cURL을 사용하여 텍스트에 표시되는 의료 엔터티, 관계어설션을 식별합니다.

필수 조건

  • 현재 버전의 cURL입니다.
  • Azure 구독 - 체험 구독 만들기
  • Azure 구독이 있으면 Azure Portal에서 언어 리소스를 만들어 키와 엔드포인트를 가져옵니다. 배포 후 리소스로 이동을 선택합니다.
    • 애플리케이션을 API에 연결하려면 만든 리소스의 키와 엔드포인트가 필요합니다. 이 빠른 시작의 뒷부분에 나오는 코드에 키와 엔드포인트를 붙여넣습니다.
    • 무료 가격 책정 계층(Free F0)을 사용하여 서비스를 체험하고(각각 5000개의 텍스트 레코드 - 1000자 제공) 나중에 프로덕션용 Standard S 가격 책정 계층으로 업그레이드할 수 있습니다. 또한 가격 책정 계층으로 Standard S 시작하여 요금이 청구되기 전에 동일한 초기 할당량(5,000개 텍스트 레코드)을 무료로 받을 수 있습니다. 가격 책정에 대한 자세한 내용은 언어 서비스 가격 책정을 참조하세요.

참고 항목

  • 다음 BASH 예제에서는 \ 줄 연속 문자를 사용합니다. 콘솔 또는 터미널에서 다른 줄 연속 문자를 사용하는 경우 해당 문자를 사용하세요.
  • GitHub에서 언어별 샘플을 찾을 수 있습니다.
  • Azure Portal로 이동하여 필수 구성 요소에서 만든 언어 리소스에 대한 키와 엔드포인트를 찾습니다. 리소스의 키 및 엔드포인트 페이지의 리소스 관리 아래에 있습니다. 그런 다음, 아래 코드의 문자열을 키와 엔드포인트로 바꿉니다. API를 호출하려면 다음 정보가 필요합니다.

설정

환경 변수 만들기

API 요청을 보내려면 애플리케이션을 인증해야 합니다. 프로덕션의 경우 자격 증명을 안전하게 저장하고 액세스하는 방법을 사용합니다. 이 예제에서는 애플리케이션을 실행하는 로컬 컴퓨터의 환경 변수에 자격 증명을 작성합니다.

코드에 키를 직접 포함하지 말고 공개적으로 게시하지 마세요. Azure Key Vault와 같은 추가 인증 옵션은 Azure AI 서비스 보안 문서를 참조하세요.

Language 리소스 키에 대한 환경 변수를 설정하려면 콘솔 창을 열고 운영 체제 및 개발 환경에 대한 지침을 따릅니다.

  1. LANGUAGE_KEY 환경 변수를 설정하려면 your-key를 리소스에 대한 키 중 하나로 바꿉니다.
  2. LANGUAGE_ENDPOINT 환경 변수를 설정하려면 your-endpoint를 리소스에 대한 엔드포인트로 바꿉니다.
setx LANGUAGE_KEY your-key
setx LANGUAGE_ENDPOINT your-endpoint

참고 항목

현재 실행 중인 콘솔에서만 환경 변수에 액세스해야 하는 경우 환경 변수를 setx 대신 set으로 설정할 수 있습니다.

환경 변수가 추가되면 콘솔 창을 포함하여 환경 변수를 읽어야 하는 실행 중인 프로그램을 다시 시작해야 할 수 있습니다. 예를 들어 편집기로 Visual Studio를 사용하는 경우 Visual Studio를 다시 시작한 후 예제를 실행합니다.

parameter 설명
-X POST <endpoint> API에 액세스하기 위한 엔드포인트를 지정합니다.
-H Content-Type: application/json JSON 데이터를 보내기 위한 콘텐츠 형식.
-H "Ocp-Apim-Subscription-Key:<key> API에 액세스하기 위한 키를 지정합니다.
-d <documents> 보내려는 문서가 포함된 JSON.

다음 cURL 명령은 BASH 셸에서 실행됩니다. 사용자 고유의 리소스 이름, 리소스 키 및 JSON 값을 사용하여 이 명령을 편집합니다.

Text Analytics for health

  1. 명령을 텍스트 편집기에 복사합니다.
  2. 필요한 경우 명령에서 다음 내용을 변경합니다.
    1. <your-language-resource-key> 값을 키로 바꿉니다.
    2. 요청 URL <your-language-resource-endpoint>의 첫 번째 부분을 고유한 엔드포인트 URL로 바꿉니다.
  3. 명령 프롬프트 창을 엽니다.
  4. 텍스트 편집기에서 명령 프롬프트 창으로 명령을 붙여넣은 후 명령을 실행합니다.
curl -i -X POST $LANGUAGE_ENDPOINT/language/analyze-text/jobs?api-version=2022-05-15-preview \
-H "Content-Type: application/json" \
-H "Ocp-Apim-Subscription-Key: $LANGUAGE_KEY" \
-d '{"analysisInput":{"documents": [{"text": "The doctor prescried 200mg Ibuprofen.","language": "en","id": "1"}]},"tasks":[{"taskId": "analyze 1","kind": "Healthcare","parameters": {"fhirVersion": "4.0.1"}}]}'

응답 헤더에서 operation-location을 가져옵니다. 이 값은 다음 URL과 유사합니다.

https://your-resource.cognitiveservices.azure.com/language/analyze-text/jobs/{JOB-ID}?api-version=2022-05-15-preview

요청 결과를 가져오려면 다음 cURL 명령을 사용합니다. {JOB-ID}를 이전 operation-location 응답 헤더에서 받은 숫자 ID 값으로 바꾸어야 합니다.

curl -X GET  $LANGUAGE_ENDPOINT/language/analyze-text/jobs/{JOB-ID}?api-version=2022-05-15-preview \
-H "Content-Type: application/json" \
-H "Ocp-Apim-Subscription-Key: $LANGUAGE_KEY"

JSON 응답

{
    "jobId": "{JOB-ID}",
    "lastUpdatedDateTime": "2022-06-27T22:04:39Z",
    "createdDateTime": "2022-06-27T22:04:38Z",
    "expirationDateTime": "2022-06-28T22:04:38Z",
    "status": "succeeded",
    "errors": [],
    "tasks": {
        "completed": 1,
        "failed": 0,
        "inProgress": 0,
        "total": 1,
        "items": [
            {
                "kind": "HealthcareLROResults",
                "lastUpdateDateTime": "2022-06-27T22:04:39.7086762Z",
                "status": "succeeded",
                "results": {
                    "documents": [
                        {
                            "id": "1",
                            "entities": [
                                {
                                    "offset": 4,
                                    "length": 6,
                                    "text": "doctor",
                                    "category": "HealthcareProfession",
                                    "confidenceScore": 0.76
                                },
                                {
                                    "offset": 21,
                                    "length": 5,
                                    "text": "200mg",
                                    "category": "Dosage",
                                    "confidenceScore": 0.99
                                },
                                {
                                    "offset": 27,
                                    "length": 9,
                                    "text": "Ibuprofen",
                                    "category": "MedicationName",
                                    "confidenceScore": 1.0,
                                    "name": "ibuprofen",
                                    "links": [
                                        {
                                            "dataSource": "UMLS",
                                            "id": "C0020740"
                                        },
                                        {
                                            "dataSource": "AOD",
                                            "id": "0000019879"
                                        },
                                        {
                                            "dataSource": "ATC",
                                            "id": "M01AE01"
                                        },
                                        {
                                            "dataSource": "CCPSS",
                                            "id": "0046165"
                                        },
                                        {
                                            "dataSource": "CHV",
                                            "id": "0000006519"
                                        },
                                        {
                                            "dataSource": "CSP",
                                            "id": "2270-2077"
                                        },
                                        {
                                            "dataSource": "DRUGBANK",
                                            "id": "DB01050"
                                        },
                                        {
                                            "dataSource": "GS",
                                            "id": "1611"
                                        },
                                        {
                                            "dataSource": "LCH_NW",
                                            "id": "sh97005926"
                                        },
                                        {
                                            "dataSource": "LNC",
                                            "id": "LP16165-0"
                                        },
                                        {
                                            "dataSource": "MEDCIN",
                                            "id": "40458"
                                        },
                                        {
                                            "dataSource": "MMSL",
                                            "id": "d00015"
                                        },
                                        {
                                            "dataSource": "MSH",
                                            "id": "D007052"
                                        },
                                        {
                                            "dataSource": "MTHSPL",
                                            "id": "WK2XYI10QM"
                                        },
                                        {
                                            "dataSource": "NCI",
                                            "id": "C561"
                                        },
                                        {
                                            "dataSource": "NCI_CTRP",
                                            "id": "C561"
                                        },
                                        {
                                            "dataSource": "NCI_DCP",
                                            "id": "00803"
                                        },
                                        {
                                            "dataSource": "NCI_DTP",
                                            "id": "NSC0256857"
                                        },
                                        {
                                            "dataSource": "NCI_FDA",
                                            "id": "WK2XYI10QM"
                                        },
                                        {
                                            "dataSource": "NCI_NCI-GLOSS",
                                            "id": "CDR0000613511"
                                        },
                                        {
                                            "dataSource": "NDDF",
                                            "id": "002377"
                                        },
                                        {
                                            "dataSource": "PDQ",
                                            "id": "CDR0000040475"
                                        },
                                        {
                                            "dataSource": "RCD",
                                            "id": "x02MO"
                                        },
                                        {
                                            "dataSource": "RXNORM",
                                            "id": "5640"
                                        },
                                        {
                                            "dataSource": "SNM",
                                            "id": "E-7772"
                                        },
                                        {
                                            "dataSource": "SNMI",
                                            "id": "C-603C0"
                                        },
                                        {
                                            "dataSource": "SNOMEDCT_US",
                                            "id": "387207008"
                                        },
                                        {
                                            "dataSource": "USP",
                                            "id": "m39860"
                                        },
                                        {
                                            "dataSource": "USPMG",
                                            "id": "MTHU000060"
                                        },
                                        {
                                            "dataSource": "VANDF",
                                            "id": "4017840"
                                        }
                                    ]
                                }
                            ],
                            "relations": [
                                {
                                    "relationType": "DosageOfMedication",
                                    "entities": [
                                        {
                                            "ref": "#/results/documents/0/entities/1",
                                            "role": "Dosage"
                                        },
                                        {
                                            "ref": "#/results/documents/0/entities/2",
                                            "role": "Medication"
                                        }
                                    ]
                                }
                            ],
                            "warnings": [],
                            "fhirBundle": {
                                "resourceType": "Bundle",
                                "id": "95d61191-402a-48c6-9657-a1e4efbda877",
                                "meta": {
                                    "profile": [
                                        "http://hl7.org/fhir/4.0.1/StructureDefinition/Bundle"
                                    ]
                                },
                                "identifier": {
                                    "system": "urn:ietf:rfc:3986",
                                    "value": "urn:uuid:95d61191-402a-48c6-9657-a1e4efbda877"
                                },
                                "type": "document",
                                "entry": [
                                    {
                                        "fullUrl": "Composition/34b666d3-45e7-474d-a398-d3b0329541ad",
                                        "resource": {
                                            "resourceType": "Composition",
                                            "id": "34b666d3-45e7-474d-a398-d3b0329541ad",
                                            "status": "final",
                                            "type": {
                                                "coding": [
                                                    {
                                                        "system": "http://loinc.org",
                                                        "code": "11526-1",
                                                        "display": "Pathology study"
                                                    }
                                                ],
                                                "text": "Pathology study"
                                            },
                                            "subject": {
                                                "reference": "Patient/68dd21ce-58ae-4e59-9445-8331f99899ed",
                                                "type": "Patient"
                                            },
                                            "encounter": {
                                                "reference": "Encounter/90c75fea-4526-4e94-82f8-8df3bc983a14",
                                                "type": "Encounter",
                                                "display": "unknown"
                                            },
                                            "date": "2022-06-27",
                                            "author": [
                                                {
                                                    "reference": "Practitioner/a8ef1526-d4ce-41df-96df-e9d03428c840",
                                                    "type": "Practitioner",
                                                    "display": "Unknown"
                                                }
                                            ],
                                            "title": "Pathology study",
                                            "section": [
                                                {
                                                    "title": "General",
                                                    "code": {
                                                        "coding": [
                                                            {
                                                                "system": "",
                                                                "display": "Unrecognized Section"
                                                            }
                                                        ],
                                                        "text": "General"
                                                    },
                                                    "text": {
                                                        "div": "<div>\r\n\t\t\t\t\t\t\t<h1>General</h1>\r\n\t\t\t\t\t\t\t<p>The doctor prescried 200mg Ibuprofen.</p>\r\n\t\t\t\t\t</div>"
                                                    },
                                                    "entry": [
                                                        {
                                                            "reference": "List/c8ca6757-1d7c-4c49-94e9-ef5263cb943c",
                                                            "type": "List",
                                                            "display": "General"
                                                        }
                                                    ]
                                                }
                                            ]
                                        }
                                    },
                                    {
                                        "fullUrl": "Practitioner/a8ef1526-d4ce-41df-96df-e9d03428c840",
                                        "resource": {
                                            "resourceType": "Practitioner",
                                            "id": "a8ef1526-d4ce-41df-96df-e9d03428c840",
                                            "extension": [
                                                {
                                                    "extension": [
                                                        {
                                                            "url": "offset",
                                                            "valueInteger": -1
                                                        },
                                                        {
                                                            "url": "length",
                                                            "valueInteger": 7
                                                        }
                                                    ],
                                                    "url": "http://hl7.org/fhir/StructureDefinition/derivation-reference"
                                                }
                                            ],
                                            "name": [
                                                {
                                                    "text": "Unknown",
                                                    "family": "Unknown"
                                                }
                                            ]
                                        }
                                    },
                                    {
                                        "fullUrl": "Patient/68dd21ce-58ae-4e59-9445-8331f99899ed",
                                        "resource": {
                                            "resourceType": "Patient",
                                            "id": "68dd21ce-58ae-4e59-9445-8331f99899ed",
                                            "gender": "unknown"
                                        }
                                    },
                                    {
                                        "fullUrl": "Encounter/90c75fea-4526-4e94-82f8-8df3bc983a14",
                                        "resource": {
                                            "resourceType": "Encounter",
                                            "id": "90c75fea-4526-4e94-82f8-8df3bc983a14",
                                            "meta": {
                                                "profile": [
                                                    "http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter"
                                                ]
                                            },
                                            "status": "finished",
                                            "class": {
                                                "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
                                                "display": "unknown"
                                            },
                                            "subject": {
                                                "reference": "Patient/68dd21ce-58ae-4e59-9445-8331f99899ed",
                                                "type": "Patient"
                                            }
                                        }
                                    },
                                    {
                                        "fullUrl": "MedicationStatement/17aeee32-1189-47fc-9223-8abe174f1292",
                                        "resource": {
                                            "resourceType": "MedicationStatement",
                                            "id": "17aeee32-1189-47fc-9223-8abe174f1292",
                                            "extension": [
                                                {
                                                    "extension": [
                                                        {
                                                            "url": "offset",
                                                            "valueInteger": 27
                                                        },
                                                        {
                                                            "url": "length",
                                                            "valueInteger": 9
                                                        }
                                                    ],
                                                    "url": "http://hl7.org/fhir/StructureDefinition/derivation-reference"
                                                }
                                            ],
                                            "status": "active",
                                            "medicationCodeableConcept": {
                                                "coding": [
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls",
                                                        "code": "C0020740",
                                                        "display": "ibuprofen"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/aod",
                                                        "code": "0000019879"
                                                    },
                                                    {
                                                        "system": "http://www.whocc.no/atc",
                                                        "code": "M01AE01"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/ccpss",
                                                        "code": "0046165"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/chv",
                                                        "code": "0000006519"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/csp",
                                                        "code": "2270-2077"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/drugbank",
                                                        "code": "DB01050"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/gs",
                                                        "code": "1611"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/lch_nw",
                                                        "code": "sh97005926"
                                                    },
                                                    {
                                                        "system": "http://loinc.org",
                                                        "code": "LP16165-0"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/medcin",
                                                        "code": "40458"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/mmsl",
                                                        "code": "d00015"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/msh",
                                                        "code": "D007052"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/mthspl",
                                                        "code": "WK2XYI10QM"
                                                    },
                                                    {
                                                        "system": "http://ncimeta.nci.nih.gov",
                                                        "code": "C561"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/nci_ctrp",
                                                        "code": "C561"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/nci_dcp",
                                                        "code": "00803"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/nci_dtp",
                                                        "code": "NSC0256857"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/nci_fda",
                                                        "code": "WK2XYI10QM"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/nci_nci-gloss",
                                                        "code": "CDR0000613511"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/nddf",
                                                        "code": "002377"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/pdq",
                                                        "code": "CDR0000040475"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/rcd",
                                                        "code": "x02MO"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
                                                        "code": "5640"
                                                    },
                                                    {
                                                        "system": "http://snomed.info/sct",
                                                        "code": "E-7772"
                                                    },
                                                    {
                                                        "system": "http://snomed.info/sct/900000000000207008",
                                                        "code": "C-603C0"
                                                    },
                                                    {
                                                        "system": "http://snomed.info/sct/731000124108",
                                                        "code": "387207008"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/usp",
                                                        "code": "m39860"
                                                    },
                                                    {
                                                        "system": "http://www.nlm.nih.gov/research/umls/uspmg",
                                                        "code": "MTHU000060"
                                                    },
                                                    {
                                                        "system": "http://hl7.org/fhir/ndfrt",
                                                        "code": "4017840"
                                                    }
                                                ],
                                                "text": "Ibuprofen"
                                            },
                                            "subject": {
                                                "reference": "Patient/68dd21ce-58ae-4e59-9445-8331f99899ed",
                                                "type": "Patient"
                                            },
                                            "context": {
                                                "reference": "Encounter/90c75fea-4526-4e94-82f8-8df3bc983a14",
                                                "type": "Encounter",
                                                "display": "unknown"
                                            },
                                            "dosage": [
                                                {
                                                    "text": "200mg",
                                                    "doseAndRate": [
                                                        {
                                                            "doseQuantity": {
                                                                "value": 200
                                                            }
                                                        }
                                                    ]
                                                }
                                            ]
                                        }
                                    },
                                    {
                                        "fullUrl": "List/c8ca6757-1d7c-4c49-94e9-ef5263cb943c",
                                        "resource": {
                                            "resourceType": "List",
                                            "id": "c8ca6757-1d7c-4c49-94e9-ef5263cb943c",
                                            "status": "current",
                                            "mode": "snapshot",
                                            "title": "General",
                                            "subject": {
                                                "reference": "Patient/68dd21ce-58ae-4e59-9445-8331f99899ed",
                                                "type": "Patient"
                                            },
                                            "encounter": {
                                                "reference": "Encounter/90c75fea-4526-4e94-82f8-8df3bc983a14",
                                                "type": "Encounter",
                                                "display": "unknown"
                                            },
                                            "entry": [
                                                {
                                                    "item": {
                                                        "reference": "MedicationStatement/17aeee32-1189-47fc-9223-8abe174f1292",
                                                        "type": "MedicationStatement",
                                                        "display": "Ibuprofen"
                                                    }
                                                }
                                            ]
                                        }
                                    }
                                ]
                            }
                        }
                    ],
                    "errors": [],
                    "modelVersion": "2022-03-01"
                }
            }
        ]
    }
}

FHIR(전자 의료 기록 교환) 구조화는 Language REST API를 사용하여 미리 볼 수 있습니다. 클라이언트 라이브러리는 현재 지원되지 않습니다. API 호출에서 FHIR 구조화를 사용하는 방법에 대해 자세히 알아봅니다.

리소스 정리

Azure AI 서비스 구독을 정리하고 제거하려면 리소스 또는 리소스 그룹을 삭제할 수 있습니다. 리소스 그룹을 삭제하면 해당 리소스 그룹에 연결된 다른 모든 리소스가 함께 삭제됩니다.

다음 단계