HEX
Server: Apache
System: Linux vps-cdc32557.vps.ovh.ca 5.15.0-156-generic #166-Ubuntu SMP Sat Aug 9 00:02:46 UTC 2025 x86_64
User: hanode (1017)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //lib/python3/dist-packages/awscli/examples/comprehendmedical/detect-phi.rst
**Example 1: To detect protected health information (PHI) directly from text**

The following ``detect-phi`` example displays the detected protected health information (PHI) entities directly from input text. ::

    aws comprehendmedical detect-phi \
        --text "Patient Carlos Salazar presented with rash on his upper extremities and dry cough. He lives at 100 Main Street, Anytown, USA where he works from his home as a carpenter."

Output::

    {
        "Entities": [
            {
                "Id": 0,
                "BeginOffset": 8,
                "EndOffset": 21,
                "Score": 0.9914507269859314,
                "Text": "Carlos Salazar",
                "Category": "PROTECTED_HEALTH_INFORMATION",
                "Type": "NAME",
                "Traits": []
            },
            {
                "Id": 1,
                "BeginOffset": 94,
                "EndOffset": 109,
                "Score": 0.871849775314331,
                "Text": "100 Main Street, Anytown, USA",
                "Category": "PROTECTED_HEALTH_INFORMATION",
                "Type": "ADDRESS",
                "Traits": []
            },
            {
                "Id": 2,
                "BeginOffset": 145,
                "EndOffset": 154,
                "Score": 0.8302185535430908,
                "Text": "carpenter",
                "Category": "PROTECTED_HEALTH_INFORMATION",
                "Type": "PROFESSION",
                "Traits": []
            }
        ],
        "ModelVersion": "0.0.0"
    }

For more information, see `Detect PHI <https://docs.aws.amazon.com/comprehend/latest/dg/how-medical-phi.html>`__ in the *Amazon Comprehend Medical Developer Guide*.

**Example 2: To detect protect health information (PHI) directly from a file path**

The following ``detect-phi`` example shows the detected protected health information (PHI) entities from a file path. ::

    aws comprehendmedical detect-phi \
        --text file://phi.txt

Contents of ``phi.txt``::

    "Patient Carlos Salazar presented with a rash on his upper extremities and a dry cough. He lives at 100 Main Street, Anytown, USA, where he works from his home as a carpenter."

Output::

    {
        "Entities": [
            {
                "Id": 0,
                "BeginOffset": 8,
                "EndOffset": 21,
                "Score": 0.9914507269859314,
                "Text": "Carlos Salazar",
                "Category": "PROTECTED_HEALTH_INFORMATION",
                "Type": "NAME",
                "Traits": []
            },
            {
                "Id": 1,
                "BeginOffset": 94,
                "EndOffset": 109,
                "Score": 0.871849775314331,
                "Text": "100 Main Street, Anytown, USA",
                "Category": "PROTECTED_HEALTH_INFORMATION",
                "Type": "ADDRESS",
                "Traits": []
            },
            {
                "Id": 2,
                "BeginOffset": 145,
                "EndOffset": 154,
                "Score": 0.8302185535430908,
                "Text": "carpenter",
                "Category": "PROTECTED_HEALTH_INFORMATION",
                "Type": "PROFESSION",
                "Traits": []
            }
        ],
        "ModelVersion": "0.0.0"
    }

For more information, see `Detect PHI <https://docs.aws.amazon.com/comprehend/latest/dg/how-medical-phi.html>`__ in the *Amazon Comprehend Medical Developer Guide*.