Prompt Template Design:

1. Task Description:  
   Provide a detailed description of the task, including the background and the type of task (e.g., named entity recognition). 

2. Schema Definition:  
   List the key concepts that should be extracted, and provide clear definitions for each one. **Must define "entity_text"** which will be used to recognize the entity.

3. Output Format Definition:  
   The output should be a JSON list, where each element is a dictionary representing a frame (an entity along with its attributes). **Each dictionary must include a key "entity_text" and a key "attr"**. The attributes are placed in the "attr" (e.g., {"entity_text": "<entity_text>", "attr": {"attr1": "<attr1>", "attr2": "<attr2>"}}).

4. Optional: Hints:  
   Provide itemized hints for the information extractors to guide the extraction process. Remind the prompted agent to be truthful. Emphasize that the prompted agent is supposed to perform the task instead of writting code or instruct other agents to do it.

5. Optional: Examples:  
   Include examples in the format:  
    Input: ...  
    Output: ...

6. Context:  
   The template must include a placeholder in the format {{<placeholder_name>}} for the context. The placeholder name can be customized as needed.
   

Example 1 (single entity type with attributes):

    ### Task description
    The paragraph below is from the Food and Drug Administration (FDA) Clinical Pharmacology Section of Labeling for Human Prescription Drug and Biological Products, Adverse reactions section. Please carefully review it and extract the adverse reactions and percentages. Note that each adverse reaction is nested under a clinical trial and potentially an arm. Your output should take that into consideration.

    ### Schema definition
    Your output should contain: 
        "entity_text" which is the name of the clinical trial as spelled in the document, 
        If applicable, "Arm" which is the arm within the clinical trial, 
        "AdverseReaction" which is the name of the adverse reaction,
        If applicable, "Percentage" which is the occurance of the adverse reaction within the trial and arm,
        "Evidence" which is the EXACT sentence in the text where you found the AdverseReaction from

    ### Output format definition
    Your output should follow JSON format, for example:
    [
        {"entity_text": "<Clinical trial name or number>", "attr": {"Arm": "<name of arm>", "AdverseReaction": "<Adverse reaction text>", "Percentage": "<a percent>", "Evidence": "<exact sentence from the text>"}},
        {"entity_text": "<Clinical trial name or number>", "attr": {"Arm": "<name of arm>", "AdverseReaction": "<Adverse reaction text>", "Percentage": "<a percent>", "Evidence": "<exact sentence from the text>"}}
    ]

    ### Additional hints
    - Your output should be 100% based on the provided content. DO NOT output fake numbers. 
    - You are expected to generate the output instead of writting code or insturcting other agents to do so. 
    - If there is no specific arm, just omit the "Arm" key. If the percentage is not reported, just omit the "Percentage" key. The "Evidence" should always be provided.

    ### Context
    Below is full text from the Adverse reactions section:
    "{{input}}"


Example 2 (multiple entity types):

    ### Task description
    This is a named entity recognition task. Given a medical note, annotate the Drug, Form, Strength, Frequency, Route, Dosage, Reason, ADE, and Duration.

    ### Schema definition
    Your output should contain: 
        "entity_text": the exact wording as mentioned in the note.
        "entity_type": type of the entity. It should be one of the "Drug", "Form", "Strength", "Frequency", "Route", "Dosage", "Reason", "ADE", or "Duration".

    ### Output format definition
    Your output should follow JSON format, 
    if there are one of the entity mentions: Drug, Form, Strength, Frequency, Route, Dosage, Reason, ADE, or Duration:
        [
            {"entity_text": "<Exact entity mentions as in the note>", "attr": {"entity_type": "<entity type as listed above>"}},
            {"entity_text": "<Exact entity mentions as in the note>", "attr": {"entity_type": "<entity type as listed above>"}}
        ]
    if there is no entity mentioned in the given note, just output an empty list:
        []

    I am only interested in the extracted contents in []. Do NOT explain your answer.

    ### Examples
    Below are some examples:

    Input: Acetaminophen 650 mg PO BID 5.
    Output: [
                {"entity_text": "Acetaminophen", "attr": {"entity_type": "Drug"}}, 
                {"entity_text": "650 mg", "attr": {"entity_type": "Strength"}}, 
                {"entity_text": "attr": {"PO", "entity_type": "Route"}}, 
                {"entity_text": "BID", "attr": {"entity_type": "Frequency"}}
            ]

    Input: Mesalamine DR 1200 mg PO BID 2.
    Output: [
                {"entity_text": "Mesalamine DR", "attr": {"entity_type": "Drug"}}, 
                {"entity_text": "1200 mg", "attr": {"entity_type": "Strength"}}, 
                {"entity_text": "BID", "attr": {"entity_type": "Frequency"}}, 
                {"entity_text": "PO", "attr": {"entity_type": "Route"}}
            ]


    ### Context
    Below is the full text from the medical note:
    "{{input}}"


Example 3 (multiple entity types with corresponding attributes):

    ### Task description
    This is a named entity recognition task. Given a medical note, annotate the events (EVENT) and time expressions (TIMEX3):

    ### Schema definition
    Your output should contain: 
        "entity_text": the exact wording as mentioned in the note.
        "entity_type": type of the entity. It should be one of the "EVENT" or "TIMEX3".
        if entity_type is "EVENT",
            "type": the event type as one of the "TEST", "PROBLEM", "TREATMENT", "CLINICAL_DEPT", "EVIDENTIAL", or "OCCURRENCE".
            "polarity": whether an EVENT is positive ("POS") or negative ("NAG"). For example, in “the patient reports headache, and denies chills”, the EVENT [headache] is positive in its polarity, and the EVENT [chills] is negative in its polarity.
            "modality": whether an EVENT actually occurred or not. Must be one of the "FACTUAL", "CONDITIONAL", "POSSIBLE", or "PROPOSED".

        if entity_type is "TIMEX3",
            "type": the type as one of the "DATE", "TIME", "DURATION", or "FREQUENCY".
            "val": the numeric value 1) DATE: [YYYY]-[MM]-[DD], 2) TIME: [hh]:[mm]:[ss], 3) DURATION: P[n][Y/M/W/D]. So, “for eleven days” will be 
    represented as “P11D”, meaning a period of 11 days. 4)  R[n][duration], where n denotes the number of repeats. When the n is omitted, the expression denotes an unspecified amount of repeats. For example, “once a day for 3 days” is “R3P1D” (repeat the time interval of 1 day (P1D) for 3 times (R3)), twice every day is “RP12H” (repeat every 12 hours)
            "mod": additional information regarding the temporal value of a time expression. Must be one of the:
                “NA”: the default value, no relevant modifier is present;  
                “MORE”, means “more than”, e.g. over 2 days (val = P2D, mod = MORE);  
                “LESS”, means “less than”, e.g. almost 2 months (val = P2M, mod=LESS); 
                “APPROX”, means “approximate”, e.g. nearly a week (val = P1W, mod=APPROX);  
                “START”, describes the beginning of a period of time, e.g.  Christmas morning, 2005 (val= 2005-12-25, mod= START).  
                “END”, describes the end of a period of time, e.g. late last year, (val = 2010, mod = END)
                “MIDDLE”, describes the middle of a period of time, e.g. mid-September 2001 (val = 2001-09, mod = MIDDLE) 

    ### Output format definition
    Your output should follow JSON format. Each element in the list is a dictionary with an "entity_text" key and an "attr" key. The "attr" dictionary contains all other attributes, including "entity_type".

    For example:
    If there are EVENT or TIMEX3 entity mentions:
        [
            {"entity_text": "<Exact entity mentions as in the note>", "attr": {"entity_type": "EVENT", "type": "<event type>", "polarity": "<event polarity>", "modality": "<event modality>"}},
            {"entity_text": "<Exact entity mentions as in the note>", "attr": {"entity_type": "TIMEX3", "type": "<TIMEX3 type>", "val": "<time value>", "mod": "<additional information>"}}
            ...
        ]
    If there is no entity mentioned in the given note, just output an empty list:
        []

    I am only interested in the extracted contents in []. Do NOT explain your answer.

    ### Examples
    Below are some examples:

    Input: At 9/7/93 , 1:00 a.m. , intravenous fluids rate was decreased to 50 cc&apos;s per hour , total fluids given during the first 24 hours were 140 to 150 cc&apos;s per kilo per day .
    Output: [
            {"entity_text": "intravenous fluids", "attr": {"entity_type": "EVENT", "type": "TREATMENT", "polarity": "POS", "modality": "FACTUAL"}},
            {"entity_text": "decreased", "attr": {"entity_type": "EVENT", "type": "OCCURRENCE", "polarity": "POS", "modality": "FACTUAL"}},
            {"entity_text": "total fluids", "attr": {"entity_type": "EVENT", "type": "TREATMENT", "polarity": "POS", "modality": "FACTUAL"}}, 
            {"entity_text": "9/7/93 , 1:00 a.m.", "attr": {"entity_type": "TIMEX3", "type": "TIME", "val": "1993-09-07T01:00", "mod": "NA"}},
            {"entity_text": "24 hours", "attr": {"entity_type": "TIMEX3", "type": "DURATION", "val": "PT24H", "mod": "NA"}}
        ]

    Input: At that time it appeared well adhered to the underlying skin .
    Output: [
            {"entity_text": "it", "attr": {"entity_type": "EVENT", "type": "TREATMENT", "polarity": "POS", "modality": "FACTUAL"}},
            {"entity_text": "well adhered", "attr": {"entity_type": "EVENT", "type": "OCCURRENCE", "polarity": "POS", "modality": "FACTUAL"}}
        ]

    ### Context
    Below is the medical note:
    "{{input}}"