{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "8c4f3506", "metadata": {}, "outputs": [], "source": [ "import sys\n", "from pathlib import Path\n", "\n", "# Add project root to Python path\n", "sys.path.insert(0, str(Path.cwd().parent.parent))" ] }, { "cell_type": "code", "execution_count": 2, "id": "17cd9954", "metadata": {}, "outputs": [], "source": [ "from analysis.chat_log.dynamodb_chat_log_analysis_helper import (\n", " extract_rated_messages_v1,\n", " extract_rated_messages_v2,\n", " get_comments,\n", " get_number_of_users,\n", ")\n", "from helpers.dynamodb_helper import (\n", " format_date_dynamodb,\n", " get_items_starting_from_date,\n", " get_dynamodb_client,\n", ")" ] }, { "cell_type": "code", "execution_count": 3, "id": "fb49f5b0", "metadata": {}, "outputs": [], "source": [ "dynamodb = get_dynamodb_client()\n", "\n", "client = dynamodb.meta.client\n", "\n", "table = dynamodb.Table(\"chatbot-conversations\")" ] }, { "cell_type": "code", "execution_count": null, "id": "bf1a8335", "metadata": {}, "outputs": [], "source": [ "dynamodb_date = format_date_dynamodb(2026, 3, 6, 15, 0, 0)\n", "\n", "items = get_items_starting_from_date(dynamodb_date, table)" ] }, { "cell_type": "code", "execution_count": null, "id": "7b1cd7ec", "metadata": {}, "outputs": [], "source": [ "rated_messages = extract_rated_messages_v1(items)" ] }, { "cell_type": "code", "execution_count": null, "id": "2704046e", "metadata": {}, "outputs": [], "source": [ "# rated_messages" ] }, { "cell_type": "code", "execution_count": null, "id": "54566913", "metadata": {}, "outputs": [], "source": [ "# rated_messages = extract_rated_messages_v2(items)\n", "# rated_messages" ] }, { "cell_type": "code", "execution_count": null, "id": "63f8bcbe", "metadata": {}, "outputs": [], "source": [ "# get_comments(items)" ] }, { "cell_type": "code", "execution_count": null, "id": "86cc01ee", "metadata": {}, "outputs": [], "source": [ "# get_number_of_users(items)" ] }, { "cell_type": "code", "execution_count": null, "id": "6bc8f985", "metadata": {}, "outputs": [], "source": [ "rated_msgs = [\n", " {\n", " \"rating\": rated_message[\"rating\"],\n", " \"human_message\": rated_message[\"human_message\"],\n", " \"reply\": rated_message[\"reply\"],\n", " \"comment\": rated_message[\"comment\"],\n", " \"model_type\": rated_message[\"model_type\"],\n", " \"conversation_id\": rated_message[\"conversation_id\"],\n", " }\n", " for rated_message in rated_messages\n", " if rated_message[\"model_type\"] == \"openai\"\n", "]\n", "\n", "rated_msgs" ] }, { "cell_type": "code", "execution_count": null, "id": "933693ba", "metadata": {}, "outputs": [], "source": [ "conversation_items = [\n", " item\n", " for item in items\n", " if item[\"data\"].get(\"conversation_id\", None)\n", " == \"conversation-83054715-455b-4b92-b967-d5a8a1d1069d\"\n", "]\n", "conversation_items" ] }, { "cell_type": "code", "execution_count": null, "id": "be3505c7", "metadata": {}, "outputs": [], "source": [ "{item[\"data\"][\"participant_id\"] for item in items if \"participant_id\" in item[\"data\"]}" ] }, { "cell_type": "code", "execution_count": null, "id": "b5770484", "metadata": {}, "outputs": [], "source": [ "conversation_items = [\n", " item\n", " for item in items\n", " if \"conversation_id\" in item[\"data\"]\n", " and item[\"data\"].get(\"participant_id\", None) == \"FouadGAM\"\n", "]\n", "conversation_items" ] }, { "cell_type": "code", "execution_count": null, "id": "0d7fae94", "metadata": {}, "outputs": [], "source": [ "idk = [\n", " \"Children aged 6 months and over who are not protected against measles can be given a **postexposure vaccine in the 72hours after their first exposure to the illness.** They must also receive their regularly scheduled measles vaccinations at 12 and 18 months. \\n**Measles and pregnancy** \\nContracting the [measles while pregnant](https:\\\\naitreetgrandir.com\\\\en\\\\pregnancy\\\\health-well-being\\\\pregnancy-chickenpox-measles-flu-fifth-disease) can lead to [miscarriage](https:\\\\naitreetgrandir.com\\\\en\\\\pregnancy\\\\first-trimester\\\\miscarriage) , [premature birth](https:\\\\naitreetgrandir.com\\\\en\\\\step\\\\0-12-months\\\\care-and-well-being\\\\premature-babies) , or low birth weight. \\nIf you plan to become pregnant in the next few months, or if you’re of childbearing age, check with your doctor to find out whether you’ve been immunized against measles. If not, you will need to receive the measles vaccine at least 30 days before you become pregnant for it to be effective. A full vaccination course consists of two doses, administered one month apart. Protection is 90% after the first dose and 95% after the second, received one month later. \\nIf you are pregnant, unvaccinated against measles, and have recently come into contact with an infected person, ask a doctor about preventive measures without delay. \\n**Sources and references** \\nNote: The links to other websites are not updated regularly, and some URLs may have changed since publication. If a link is no longer active, please use search engines to find the relevant information. \\n- AboutKidsHealth. “Measles.” *AboutKidsHealth.* 2023. [aboutkidshealth.ca](https:\\\\www.aboutkidshealth.ca\\\\measles)\\n- Public Health Agency of Canada. “Measles: Symptoms and treatment.” *Government of Canada* . 2024. [canada.ca](https:\\\\www.canada.ca\\\\en\\\\public-health\\\\services\\\\diseases\\\\measles.html)\",\n", " \"There are few cases in which a child cannot be vaccinated. A cold, an ear infection, a runny nose, or the fact that he's taking antibiotics are not reasons to put o/ff a vaccination.\\nIf your child is ill to the point of being feverish or irritable or crying abnormally, discuss the situation with the health professional.\",\n", " \"American Academy of Pediatrics. Kimberlin DW, Brady MT, Jackson MA, Long SS, eds. Red Book: 2018-2021 Report of the Committee of Infectious Diseases. 31 st ed. Ithaca, IL: American Academy of Pediatrics; c2018. 1213 p.\\nBC Centre for Disease Control [Internet]. Vancouver (BC): Provincial Health Services Authority; c2020. Diseases & Conditions. Available from: http://www.bccdc.ca/health-info/diseases-conditions.\\nCanada.ca [Internet]. Ottawa (ON): Government of Canada. 2020 Mar 3. Infectious diseases; 2016 Nov 22. Available from: https://www.canada.ca/en/public-health/services/infectious-diseases.html,\\nCanadian Paediatric Society [Internet]. Ottawa (ON): Canadian Paediatric Society; c2020. Head lice infestations: A clinical update; 2018 Feb 15. Available from: https://www.cps.ca/en/documents/position/head-lice.\\nCaring for Kids [Internet]. Ottawa (ON): Canadian Paediatric Society; c2021. Health Conditions & Treatments. Available from: https://www.caringforkids.cps.ca/handouts/health-conditions-andtreatments.\\nCenters for Disease Control and Prevention [Internet]. Washington (DC): U.S. Department of Health and Human Services. Diseases & conditions. Available from: https://www.cdc.gov/DiseasesConditions/.\\nChildren's Hospital of Philadelphia [Internet]. Philadelphia (PA): The Children's Hospital of Philadelphia; c2020. Conditions and diseases. Available from: https://www.chop.edu/conditionsdiseases.\\nDo Bugs Need Drugs? [Internet]. Vancouver (BC): Do Bugs Need Drugs?; c2020 [modified 2019 Dec 14]. Available from: http://www.dobugsneeddrugs.org/.\\nHamborsky J, Kroger A, Wolfe S, editors. Epidemiology and Prevention of Vaccine-Preventable Diseases [Internet]. 13th ed. Washington (DC): Public Health Foundation; 2015. [reviewed 2019 Apr 15]. Available from: https://www.cdc.gov/vaccines/pubs/pinkbook/index.html.\\nHeymann DL, editor. Control of communicable diseases manual. 20 th ed. Washington: American Public Health Association; c2015. 729 p.\",\n", " \"- **Watch for signs of complications:** - Fever of 40°C or higher\\n- Stiff neck\\n- Seizures\\n- Dizziness\\n- Severe headache\\n- Abdominal pain\\n- Swelling or tenderness of one or both testicles \\n**Prevention** \\n**Vaccination is the best way to prevent mumps.** Although the vaccine isn’t 100percent effective, it usually makes the illness milder and reduces the risk of complications if a child does get sick. \\nThe vaccination schedule includes two doses of the MMR (measles, mumps, and rubella) vaccine. The first injection is given at 12months and the second at 18months. \\n**To help prevent the spread of mumps, certain basic hygiene measures are also recommended:** \\n- Avoid direct contact with someone who is infected (e.g., kissing, cuddling).\\n- Don’t share drinking glasses, utensils, or water bottles.\\n- Wash your hands frequently. \\n**Resources and references** \\nNote: The links to other websites are not updated regularly, and some URLs may have changed since publication. If a link is no longer valid, use search engines to find the relevant information. \\n- Centers for Disease Control and Prevention. “About Mumps.” *U.S. Centers for Disease Control and Prevention.* 2024. [cdc.gov](https:\\\\www.cdc.gov\\\\mumps\\\\about\\\\index.html)\\n- Gans, Hayley A. “Mumps.” In *Nelson Textbook of Pediatrics,* vol.1, 22nd ed., Philadelphia, Elsevier, 2024, pp. 1969–1971.\\n- Public Health Agency of Canada. “Mumps.” *Government of Canada* . 2023. [canada.ca](https:\\\\www.canada.ca\\\\en\\\\public-health\\\\services\\\\immunization\\\\vaccine-preventable-diseases\\\\mumps.html)\\n- Gouvernement du Québec. “Mumps.” *Gouvernement du Québec* . 2019. [quebec.ca](https:\\\\www.quebec.ca\\\\en\\\\health\\\\health-issues\\\\a-z\\\\mumps)\\n- Nemours KidsHealth. “Mumps.” *KidsHealth* . 2023. [kidshealth.org](https:\\\\kidshealth.org\\\\en\\\\parents\\\\mumps.html)\\n- Mayo Clinic Staff. “Mumps.” *Mayo Clinic.* 2022. [mayoclinic.org](https:\\\\www.mayoclinic.org\\\\diseases-conditions\\\\mumps\\\\symptoms-causes\\\\syc-20375361)\",\n", "]\n" ] }, { "cell_type": "code", "execution_count": null, "id": "f6d7675e", "metadata": {}, "outputs": [], "source": [ "idk[-1]" ] } ], "metadata": { "kernelspec": { "display_name": ".venv_win (3.11.9)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.9" } }, "nbformat": 4, "nbformat_minor": 5 }