ComprehendMedical / Client / infer_rx_norm

infer_rx_norm#

ComprehendMedical.Client.infer_rx_norm(**kwargs)#

InferRxNorm detects medications as entities listed in a patient record and links to the normalized concept identifiers in the RxNorm database from the National Library of Medicine. Amazon Comprehend Medical only detects medical entities in English language texts.

See also: AWS API Documentation

Request Syntax

response = client.infer_rx_norm(
    Text='string'
)
Parameters:

Text (string) –

[REQUIRED]

The input text used for analysis.

Return type:

dict

Returns:

Response Syntax

{
    'Entities': [
        {
            'Id': 123,
            'Text': 'string',
            'Category': 'MEDICATION',
            'Type': 'BRAND_NAME'|'GENERIC_NAME',
            'Score': ...,
            'BeginOffset': 123,
            'EndOffset': 123,
            'Attributes': [
                {
                    'Type': 'DOSAGE'|'DURATION'|'FORM'|'FREQUENCY'|'RATE'|'ROUTE_OR_MODE'|'STRENGTH',
                    'Score': ...,
                    'RelationshipScore': ...,
                    'Id': 123,
                    'BeginOffset': 123,
                    'EndOffset': 123,
                    'Text': 'string',
                    'Traits': [
                        {
                            'Name': 'NEGATION'|'PAST_HISTORY',
                            'Score': ...
                        },
                    ]
                },
            ],
            'Traits': [
                {
                    'Name': 'NEGATION'|'PAST_HISTORY',
                    'Score': ...
                },
            ],
            'RxNormConcepts': [
                {
                    'Description': 'string',
                    'Code': 'string',
                    'Score': ...
                },
            ]
        },
    ],
    'PaginationToken': 'string',
    'ModelVersion': 'string'
}

Response Structure

  • (dict) –

    • Entities (list) –

      The medication entities detected in the text linked to RxNorm concepts. If the action is successful, the service sends back an HTTP 200 response, as well as the entities detected.

      • (dict) –

        The collection of medical entities extracted from the input text and their associated information. For each entity, the response provides the entity text, the entity category, where the entity text begins and ends, and the level of confidence that Amazon Comprehend Medical has in the detection and analysis. Attributes and traits of the entity are also returned.

        • Id (integer) –

          The numeric identifier for the entity. This is a monotonically increasing id unique within this response rather than a global unique identifier.

        • Text (string) –

          The segment of input text extracted from which the entity was detected.

        • Category (string) –

          The category of the entity. The recognized categories are GENERIC or BRAND_NAME.

        • Type (string) –

          Describes the specific type of entity. For InferRxNorm, the recognized entity type is MEDICATION.

        • Score (float) –

          The level of confidence that Amazon Comprehend Medical has in the accuracy of the detected entity.

        • BeginOffset (integer) –

          The 0-based character offset in the input text that shows where the entity begins. The offset returns the UTF-8 code point in the string.

        • EndOffset (integer) –

          The 0-based character offset in the input text that shows where the entity ends. The offset returns the UTF-8 code point in the string.

        • Attributes (list) –

          The extracted attributes that relate to the entity. The attributes recognized by InferRxNorm are DOSAGE, DURATION, FORM, FREQUENCY, RATE, ROUTE_OR_MODE, and STRENGTH.

          • (dict) –

            The extracted attributes that relate to this entity. The attributes recognized by InferRxNorm are DOSAGE, DURATION, FORM, FREQUENCY, RATE, ROUTE_OR_MODE.

            • Type (string) –

              The type of attribute. The types of attributes recognized by InferRxNorm are BRAND_NAME and GENERIC_NAME.

            • Score (float) –

              The level of confidence that Amazon Comprehend Medical has that the segment of text is correctly recognized as an attribute.

            • RelationshipScore (float) –

              The level of confidence that Amazon Comprehend Medical has that the attribute is accurately linked to an entity.

            • Id (integer) –

              The numeric identifier for this attribute. This is a monotonically increasing id unique within this response rather than a global unique identifier.

            • BeginOffset (integer) –

              The 0-based character offset in the input text that shows where the attribute begins. The offset returns the UTF-8 code point in the string.

            • EndOffset (integer) –

              The 0-based character offset in the input text that shows where the attribute ends. The offset returns the UTF-8 code point in the string.

            • Text (string) –

              The segment of input text which corresponds to the detected attribute.

            • Traits (list) –

              Contextual information for the attribute. InferRxNorm recognizes the trait NEGATION for attributes, i.e. that the patient is not taking a specific dose or form of a medication.

              • (dict) –

                The contextual information for the entity. InferRxNorm recognizes the trait NEGATION, which is any indication that the patient is not taking a medication.

                • Name (string) –

                  Provides a name or contextual description about the trait.

                • Score (float) –

                  The level of confidence that Amazon Comprehend Medical has in the accuracy of the detected trait.

        • Traits (list) –

          Contextual information for the entity.

          • (dict) –

            The contextual information for the entity. InferRxNorm recognizes the trait NEGATION, which is any indication that the patient is not taking a medication.

            • Name (string) –

              Provides a name or contextual description about the trait.

            • Score (float) –

              The level of confidence that Amazon Comprehend Medical has in the accuracy of the detected trait.

        • RxNormConcepts (list) –

          The RxNorm concepts that the entity could refer to, along with a score indicating the likelihood of the match.

          • (dict) –

            The RxNorm concept that the entity could refer to, along with a score indicating the likelihood of the match.

            • Description (string) –

              The description of the RxNorm concept.

            • Code (string) –

              RxNorm concept ID, also known as the RxCUI.

            • Score (float) –

              The level of confidence that Amazon Comprehend Medical has that the entity is accurately linked to the reported RxNorm concept.

    • PaginationToken (string) –

      If the result of the previous request to InferRxNorm was truncated, include the PaginationToken to fetch the next page of medication entities.

    • ModelVersion (string) –

      The version of the model used to analyze the documents, in the format n.*n*.*n* You can use this information to track the model used for a particular batch of documents.

Exceptions

  • ComprehendMedical.Client.exceptions.InternalServerException

  • ComprehendMedical.Client.exceptions.ServiceUnavailableException

  • ComprehendMedical.Client.exceptions.TooManyRequestsException

  • ComprehendMedical.Client.exceptions.InvalidRequestException

  • ComprehendMedical.Client.exceptions.InvalidEncodingException

  • ComprehendMedical.Client.exceptions.TextSizeLimitExceededException