AI Medical Scribe

Step-by-Step Tutorial on Creating a Personalized Template for Describing Multiple Gunshot Wounds Artificial intelligence (AI) has the potential to speed up the writing of autopsy reports, especially in complex cases, e.g., involving multiple gunshot wounds. By utilizing AI, pathologists can improve the consistency and readability of their documentation. In this comprehensive, step-by-step tutorial, I will guide you through the creation of an AI-assisted template specifically designed for describing multiple gunshot ...

By Iana Lesnikova

Step-by-Step Tutorial on Creating a Personalized Template for Describing Multiple Gunshot Wounds

Artificial intelligence (AI) has the potential to speed up the writing of autopsy reports, especially in complex cases, e.g., involving multiple gunshot wounds. By utilizing AI, pathologists can improve the consistency and readability of their documentation. In this comprehensive, step-by-step tutorial, I will guide you through the creation of an AI-assisted template specifically designed for describing multiple gunshot wounds in autopsy reports.

This guide is intended for individuals with little to no programming experience.

Introduction

In this tutorial, we’ll create a template to guide an AI scribe in generating consistent and accurate autopsy reports for cases involving multiple gunshot wounds. The template ensures all necessary details are included and formatted correctly, minimizing errors and omissions.


DOWNLOAD TEMPLATE HERE

Understanding the Template Structure

The autopsy report template consists of several key sections:

  1. General Instructions and Human Language Prompts: Detailed instructions written in plain language to guide the AI in generating consistent and accurate reports.
  2. Summary of Gunshot Wounds: A brief overview of each wound, including its nature, range, location, direction, recovery of the projectile, and associated findings.
  3. Detailed Descriptions: An in-depth description of each wound, covering specifics like the nature, range, location, direction, presence of abrasion, soot, stippling, muzzle imprint, and whether the projectile was recovered.

DOWNLOAD TEMPLATE HERE

Setting Up the Environment

For this tutorial, we will use a combination of English and Python prompting due to their simplicity and widespread use in data processing and AI applications.

Prerequisites

  • Python Installation: Install Python on your computer. You can download it from the official website.
  • Text Editor or IDE: Use a text editor or Integrated Development Environment (IDE) like Visual Studio Code or Notepad++.

DOWNLOAD TEMPLATE HERE

Defining the Data Structure

We will start by defining how to store information about each gunshot wound.

Step 1: Create a List of Dictionaries

Each wound will be represented as a dictionary containing all relevant details.

python

Copy code

# Define the list to hold all wounds

wounds = []

Step 2: Define the Details for Each Wound

Here’s how you can represent a single wound with the new fields:

python

Copy code

# Example of a single wound dictionary

wound = {

    “wound_type”: “Perforating”,  # or “Penetrating”

    “wound_range”: “intermediate-range”,

    “wound_location”: “chest”,

    “wound_label”: “A”,

    “entrance_wound_label”: “3”,

    “entrance_wound_location”: “upper aspect of the left side of the chest”,

    “entrance_wound_details”: “31 centimeters below the top of the head and 7.0 centimeters to the

    “abrasion_ring_present”: True,

    “abrasion_ring_size”: “1.1”,

    “abrasion_ring_start”: “12”,

    “abrasion_ring_end”: “10”,

    “soot_present”: False,

    “stippling_present”: False,

    “muzzle_imprint_present”: False,

    “exit_wound_label”: “1”,

    “exit_wound_location”: “upper aspect of the right side of the back”,

    “exit_wound_details”: “29 centimeters below the top of the head and 12 centimeters to the left of the posterior midline”, left of the anterior midline”,

“wound_path_description”: “The projectile passed through the left 2nd rib, upper lobe of the left lung, aortic arch, trachea, right lung, and right 5th rib.”, }

    “associated_findings”: “fractures of the left 2nd rib and right 5th rib”,

    “wound_path_direction”: “left to right, front to back, and upward”,

    “projectile_path_tissue”: “left 2nd rib, upper lobe of the left lung, aortic arch, trachea, right lung, and right 5th rib”  

 “projectile_recovered”: False,

  “projectile_details”: “”,

“projectile_recovered_location”: “”,

    }

DOWNLOAD TEMPLATE HERE

Explanation of Fields:

  • projectile_recovered: Boolean indicating if the projectile was recovered.
  • abrasion_ring_present, soot_present, stippling_present, muzzle_imprint_present: Booleans indicating the presence or absence of these features.
  • abrasion_ring_size, abrasion_ring_start, abrasion_ring_end: Details about the abrasion ring if present.
  • “wound_path_description”: A string detailing the specific anatomical structures the projectile passed through.

Add the wound to the wounds list:

python

Copy code

# Add the wound to the wounds list

wounds.append(wound)


DOWNLOAD TEMPLATE HERE

Writing the Summary Function

We will create a function that generates the summary section of the autopsy report.

Step 3: Define the Function

python

Copy code

def summarize_gunshot_wounds(wounds):

    summaries = []

    for wound in wounds:

        # Extract wound details

        wound_nature = wound.get(“wound_type”, “Penetrating”)

        wound_range = wound.get(“wound_range”, “[XXX]”)

        wound_label = wound.get(“wound_label”, “[XXX]”)

        wound_location = wound.get(“wound_location”, “[XXX]”)

        entrance_wound_location = wound.get(“entrance_wound_location”, “[XXX]”)

        exit_wound_location = wound.get(“exit_wound_location”, None)

        projectile_recovered_location = wound.get(“projectile_recovered_location”, “[XXX]”)

        associated_findings = wound.get(“associated_findings”, “[XXX]”)

        wound_path_direction = wound.get(“wound_path_direction”, “[XXX]”)

        # Determine if the wound is perforating or penetrating

        if exit_wound_location:

            wound_nature = ‘Perforating’

        else:

            wound_nature = ‘Penetrating’

        # Build the summary string

        summary = f”””{wound_nature} {wound_range} gunshot wound “{wound_label}” of {wound_location}:

The entrance wound is on the {entrance_wound_location}.”””

        if exit_wound_location:

            summary += f”\nThe exit wound is on the {exit_wound_location}.”

        else:

            if wound.get(“projectile_recovered”, False):

                summary += f”\nRecovery of projectile from the {projectile_recovered_location}.”

            else:

                summary += f”\nNo projectile is recovered.”

        summary += f”\nAssociated findings include {associated_findings}.”

        summary += f”\nThe direction of the wound is {wound_path_direction}.”

        summaries.append(summary)

    # Combine all summaries

    return “\n\n”.join(summaries)

Explanation:

  • Function: summarize_gunshot_wounds takes a list of wounds and generates a summary for each.
  • New Logic: Includes whether the projectile was recovered in the summary.
  • Placeholders: [XXX] is used for missing information.

Creating Detailed Descriptions

Next, we will write a function to generate detailed descriptions for each wound.

Step 4: Define the Function

python

Copy code

def detailed_description(wounds):

    descriptions = []

    for wound in wounds:

        # Extract wound details

        wound_nature = wound.get(“wound_type”, “PENETRATING”).upper()

        wound_label = wound.get(“wound_label”, “[XXX]”)

        wound_location = wound.get(“wound_location”, “[XXX]”)

        entrance_wound_label = wound.get(“entrance_wound_label”, “[XXX]”)

        entrance_wound_location = wound.get(“entrance_wound_location”, “[XXX]”)

        entrance_wound_details = wound.get(“entrance_wound_details”, “[XXX]”)

        abrasion_ring_present = wound.get(“abrasion_ring_present”, False)

        abrasion_ring_size = wound.get(“abrasion_ring_size”, “[XXX]”)

        abrasion_ring_start = wound.get(“abrasion_ring_start”, “[XXX]”)

        abrasion_ring_end = wound.get(“abrasion_ring_end”, “[XXX]”)

        soot_present = wound.get(“soot_present”, False)

        stippling_present = wound.get(“stippling_present”, False)

        muzzle_imprint_present = wound.get(“muzzle_imprint_present”, False)

        exit_wound_label = wound.get(“exit_wound_label”, None)

        exit_wound_location = wound.get(“exit_wound_location”, “[XXX]”)

        exit_wound_details = wound.get(“exit_wound_details”, None)

        associated_findings = wound.get(“associated_findings”, “[XXX]”)

        wound_path_direction = wound.get(“wound_path_direction”, “[XXX]”)

wound_path_description = wound.get(“wound_path_description”, “[XXX]”)

        projectile_path_tissue = wound.get(“projectile_path_tissue”, “[XXX]”)

        projectile_recovered = wound.get(“projectile_recovered”, False)

        projectile_recovered_location = wound.get(“projectile_recovered_location”, “[XXX]”)

        projectile_details = wound.get(“projectile_details”, “[XXX]”)

        # Build the detailed description

        description = f”””{wound_nature} GUNSHOT WOUND “{wound_label}” OF {wound_location}:

An entrance-type gunshot wound (labeled “{entrance_wound_label}”) is on the {entrance_wound_location}, {entrance_wound_details}.”””

        # Add abrasion ring information

        if abrasion_ring_present:

            description += f”\nThe {abrasion_ring_size}-centimeter abrasion ring extends from {abrasion_ring_start} o’clock to {abrasion_ring_end} o’clock.”

        # Add soot, stippling, and muzzle imprint information

        if soot_present:

            description += “\nSoot is present around the wound.”

        else:

            description += “\nNo soot is associated with the wound.”

        if stippling_present:

            description += “\nThe wound is surrounded by gunpowder stippling.”

        else:

            description += “\nNo stippling is associated with the wound.”

        if muzzle_imprint_present:

            description += “\nA muzzle imprint is present.”

        else:

            description += “\nNo muzzle imprint is present.”

        if exit_wound_label and exit_wound_details:

            description += f”””

{wound_path_description}.

It exited through the exit-type gunshot wound (labeled “{exit_wound_label}”) on the {exit_wound_location}, {exit_wound_details}.”””

        else:

            description += f”””

The projectile passed through the {projectile_path_tissue}.”””

            if projectile_recovered:

                description += f”””

A {projectile_details} is recovered from the {projectile_recovered_location}.”””

            else:

                description += f”””

No projectile is recovered.”””

        description += f”””

Associated findings include {associated_findings}.

The direction of the wound’s path, with the body in the normal anatomic position, is from {wound_path_direction}.”””

        descriptions.append(description)

    # Combine all descriptions

    return “\n\n”.join(descriptions)

Explanation:

  • New Fields Included: The function now incorporates the presence or absence of abrasion ring, soot, stippling, and muzzle imprint.
  • Conditional Statements: Used to include information based on the presence of these features.
  • Projectile Recovery: Includes detailed information about projectile recovery.
  • Function: detailed_description generates a detailed account for each wound.
  • Uppercase for Emphasis: Wound nature is converted to uppercase to match the formatting in official reports.
  • Conditional Logic: Handles whether there is an exit wound or if the projectile was recovered.

DOWNLOAD TEMPLATE HERE

Integrating Human Language Prompts

To make the template more accessible and effective, we will include human language prompts and general instructions that guide the AI in generating the report.

Step 5: Include General Instructions

Add the following general instructions as comments in your code:

python

Copy code

# General Instructions:

# – Write as a medical examiner examining the body.

# – Use “XXX” for unknown parameters; never make assumptions.

# – For missing information, use “[XXX]” and flag for human review.

# – Follow the exact format and structure provided.

# – Do not include quotation marks around any text in the report.

# – If any abnormalities or different findings are mentioned, modify the relevant parts of the description accordingly.

# – Use hyphenated color descriptions (e.g., red-brown, blue-purple).

# – Do not use any abbreviations throughout the report.

# – Place the unit “centimeter” after the last measurement only.

These instructions help the AI understand the expected format and content, ensuring consistency and adherence to professional standards.


DOWNLOAD TEMPLATE HERE

Generating the Full Autopsy Report

Step 6: Utilize the Human Language Prompt in the Autopsy Report Function

We will incorporate the human language prompt into our generate_autopsy_report function to guide the AI in generating the report.

python

Copy code

def generate_autopsy_report(case_number, wounds, external_examination, additional_findings=None):

    # General Instructions included as comments above

    # Generate the summary and detailed descriptions

    summary = summarize_gunshot_wounds(wounds)

    details = detailed_description(wounds)

    # Build the report

    report = f”””

CASE NUMBER: {case_number}

AUTOPSY FINDINGS:

{summary}

DETAILED DESCRIPTION OF GUNSHOT WOUNDS:

{details}

“””

    # Include additional findings if provided

    if additional_findings:

        for section, content in additional_findings.items():

            report += f”\n\n{section.upper()}:\n\n{content}”

    return report


DOWNLOAD TEMPLATE HERE

Testing with Sample Data

Step 7: Prepare the Data

Include all necessary data, including any additional findings or sections.

python

Copy code

# Wounds data (including the new fields)

wounds = [

    {

        “wound_type”: “Perforating”,

        “wound_range”: “intermediate-range”,

        “wound_location”: “chest”,

        “wound_label”: “A”,

        “entrance_wound_label”: “3”,

        “entrance_wound_location”: “upper aspect of the left side of the chest”,

        “entrance_wound_details”: “31 centimeters below the top of the head and 7.0 centimeters to the left of the anterior midline”,

        “exit_wound_label”: “1”,

        “exit_wound_location”: “upper aspect of the right side of the back”,

        “exit_wound_details”: “29 centimeters below the top of the head and 12 centimeters to the left of the posterior midline”,

        “projectile_recovered”: False,

        “projectile_recovered_location”: “”,

        “projectile_details”: “”,

        “abrasion_ring_present”: True,

        “abrasion_ring_size”: “1.1”,

        “abrasion_ring_start”: “12”,

        “abrasion_ring_end”: “10”,

        “soot_present”: False,

        “stippling_present”: False,

        “muzzle_imprint_present”: False,

        “associated_findings”: “fractures of the left 2nd rib and right 5th rib”,

        “wound_path_direction”: “left to right, front to back, and upward”,

        “projectile_path_tissue”: “left 2nd rib, upper lobe of the left lung, aortic arch, trachea, right lung, and right 5th rib”

“wound_path_description”: “The projectile passed through the left 2nd rib, the upper lobe of the left lung, the aortic arch, the trachea, the right lung, and the right 5th rib.”,

    },

    # Add more wounds as needed

]

Step 8: Generate the Report

python

Copy code

# Generate the autopsy report

report = generate_autopsy_report(

    case_number=”2023-001″,

    wounds=wounds,

    additional_findings=additional_findings

)

# Print the report

print(report)


Reviewing the Sample Output

Running your script should generate a report that includes the new fields and follows the specified format.

Sample Output:

vbnet

Copy code

CASE NUMBER: 2023-001

AUTOPSY FINDINGS:

Perforating intermediate-range gunshot wound “A” of chest:

The entrance wound is on the upper aspect of the left side of the chest.

The exit wound is on the upper aspect of the right side of the back.

Associated findings include fractures of the left 2nd rib and right 5th rib.

The direction of the wound is left to right, front to back, and upward.

DETAILED DESCRIPTION OF GUNSHOT WOUNDS:

PERFORATING GUNSHOT WOUND “A” OF chest:

An entrance-type gunshot wound (labeled “3”) is on the upper aspect of the left side of the chest, 31 centimeters below the top of the head and 7.0 centimeters to the left of the anterior midline.

The 1.1-centimeter abrasion ring extends from 12 o’clock to 10 o’clock.

No soot is associated with the wound.

No stippling is associated with the wound.

No muzzle imprint is present.

The projectile passed through the left 2nd rib, upper lobe of the left lung, aortic arch, trachea, right lung, and right 5th rib.

It exited through the exit-type gunshot wound (labeled “1”) on the upper aspect of the right side of the back, 29 centimeters below the top of the head and 12 centimeters to the left of the posterior midline.

Associated findings include fractures of the left 2nd rib and right 5th rib.

The direction of the wound’s path, with the body in the normal anatomic position, is from left to right, front to back, and upward.


DOWNLOAD TEMPLATE HERE

Customizing the Template

You can customize the template to suit your specific needs.

Step 9: Add More Wounds and Details

Feel free to add more wounds with varying characteristics to test the robustness of your template.

python

Copy code

# Adding another wound

wound_b = {

    “wound_type”: “Penetrating”,

    “wound_range”: “distant range”,

    “wound_location”: “abdomen”,

    “wound_label”: “B”,

    “entrance_wound_label”: “4”,

    “entrance_wound_location”: “left flank”,

    “entrance_wound_details”: “63 centimeters below the top of the head and 14 centimeters to the left of the posterior midline”,

    “exit_wound_label”: None,

    “exit_wound_location”: “”,

    “exit_wound_details”: “”,

    “projectile_recovered”: True,

    “projectile_recovered_location”: “retroperitoneum”,

    “projectile_details”: “deformed projectile”,

    “abrasion_ring_present”: False,

    “abrasion_ring_size”: “”,

    “abrasion_ring_start”: “”,

    “abrasion_ring_end”: “”,

    “soot_present”: False,

    “stippling_present”: False,

    “muzzle_imprint_present”: False,

    “associated_findings”: “perforation of the left kidney”,

    “wound_path_direction”: “left to right, front to back, and upward”,

    “projectile_path_tissue”: “soft tissue of the left flank, retroperitoneum”

}

# Add the new wound to the wounds list

wounds.append(wound_b)

Step 10: Re-generate the Report

After adding more wounds, re-run your script to generate the updated report.


Conclusion

By following this tutorial, you have created a robust template that helps an AI scribe generate detailed and accurate autopsy reports for cases involving multiple gunshot wounds. The inclusion of human language prompts ensures that the AI understands the context and formatting requirements, making the template accessible to individuals with little to no programming experience.


Additional Resources


Disclaimer: This template is intended to assist in documentation and should not replace professional judgment. Always review and verify the generated reports for accuracy and completeness.


Did you find this tutorial helpful? Let us know in the comments below or via the contact form.


Feel free to reach out if you have any questions or need further assistance!

DOWNLOAD TEMPLATE HERE

Index