{ "cells": [ { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [], "source": [ "from app import connector\n", "import time\n", "conn=connector()" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "GENERATE\n", "\n" ] }, { "data": { "text/plain": [ "{'conversationId': 'FDfvsSZMkEa2wQkHX58myW-eu',\n", " 'token': 'eyJhbGciOiJSUzI1NiIsImtpZCI6Ik5MZjUwanFheTN1R0VpQUpOV29EWmZzRnE4QSIsIng1dCI6Ik5MZjUwanFheTN1R0VpQUpOV29EWmZzRnE4QSIsInR5cCI6IkpXVCJ9.eyJib3QiOiI0OWU3Mzc4Yy02MGEyLTk0MTAtZmVhYy0zNjNjYzBiZjYzMjgiLCJzaXRlIjoiV2lkbl9BY05tWTQiLCJjb252IjoiRkRmdnNTWk1rRWEyd1FrSFg1OG15Vy1ldSIsIm5iZiI6MTcxOTgzMjY0MywiZXhwIjoxNzE5ODM2MjQzLCJpc3MiOiJodHRwczovL2RpcmVjdGxpbmUuYm90ZnJhbWV3b3JrLmNvbS8iLCJhdWQiOiJodHRwczovL2RpcmVjdGxpbmUuYm90ZnJhbWV3b3JrLmNvbS8ifQ.Qvm73JBGautoQ60MqoxRlmbjrYFwcTS7_6Y2VjnWFKEvIdUHd2CWoTlpL1aUqtlnZvvpaBA8iFraC3z9Lj-9thi0l83bWmMABZ_9ZVc6T0pBzwG0QtFNHASjnfCzrAT5fBQ3AWXNEIPxgnPPOi503j71eJhG4fqgsV2ZQYA-4UNstujTwVtIpm0pga-C4Bks7UIzGvOcdyq53R-SvUR7rqKksIgeZHDR0GRUz0aCAdiWxEZe2DQbjxTqlu5lvCb5bVz9S069fdXDF4jARqal4IhIcHzvOc7FVyDrhjbHL3stN7fc-o5mG2fn5JjAy5OHNtp2tYxUJcu9w0cqJTV-7A',\n", " 'expires_in': 3600}" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "info=conn.generate()\n", "info" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "START CONVERSATION\n", "\n", "{'conversationId': 'FDfvsSZMkEa2wQkHX58myW-eu', 'token': 'eyJhbGciOiJSUzI1NiIsImtpZCI6Ik5MZjUwanFheTN1R0VpQUpOV29EWmZzRnE4QSIsIng1dCI6Ik5MZjUwanFheTN1R0VpQUpOV29EWmZzRnE4QSIsInR5cCI6IkpXVCJ9.eyJib3QiOiI0OWU3Mzc4Yy02MGEyLTk0MTAtZmVhYy0zNjNjYzBiZjYzMjgiLCJzaXRlIjoiV2lkbl9BY05tWTQiLCJjb252IjoiRkRmdnNTWk1rRWEyd1FrSFg1OG15Vy1ldSIsIm5iZiI6MTcxOTgzMjY0NCwiZXhwIjoxNzE5ODM2MjQ0LCJpc3MiOiJodHRwczovL2RpcmVjdGxpbmUuYm90ZnJhbWV3b3JrLmNvbS8iLCJhdWQiOiJodHRwczovL2RpcmVjdGxpbmUuYm90ZnJhbWV3b3JrLmNvbS8ifQ.pEGceF3_8aeYExZHifP8Gy16Nx4gj8UOES2o2u7X54So90CcVeDgbpiRZ1QdKcsEsruO-9KXoOJFvKIAV342Zwf15r8GtLdZSxPUCsER16QXxGc0TxC_Gi_8bBec-ILHPe52EqiDfotReOv9TDcYkiegGGZENdIC_9lpULJVJXTbugBBCLTVIwlB4VRvpvJItYMwosRXV6w3XvQ6CABH1hvKRLDfFfytjm0UeURC-GSEWWl8ViS2JEylYlyh9aN2GR2xB13yRqgr-SjTF7m2bAMkKooOPlT0YXQMS17KpIUw_oCSDHKvUNul1QgyM4_nl6bnv7f--_SAi9CoinMd7A', 'expires_in': 3600, 'streamUrl': 'wss://europe.directline.botframework.com/v3/directline/conversations/FDfvsSZMkEa2wQkHX58myW-eu/stream?watermark=-&t=eyJhbGciOiJSUzI1NiIsImtpZCI6Ik5MZjUwanFheTN1R0VpQUpOV29EWmZzRnE4QSIsIng1dCI6Ik5MZjUwanFheTN1R0VpQUpOV29EWmZzRnE4QSIsInR5cCI6IkpXVCJ9.eyJib3QiOiI0OWU3Mzc4Yy02MGEyLTk0MTAtZmVhYy0zNjNjYzBiZjYzMjgiLCJzaXRlIjoiV2lkbl9BY05tWTQiLCJjb252IjoiRkRmdnNTWk1rRWEyd1FrSFg1OG15Vy1ldSIsIm5iZiI6MTcxOTgzMjY0NCwiZXhwIjoxNzE5ODMyNzA0LCJpc3MiOiJodHRwczovL2RpcmVjdGxpbmUuYm90ZnJhbWV3b3JrLmNvbS8iLCJhdWQiOiJodHRwczovL2RpcmVjdGxpbmUuYm90ZnJhbWV3b3JrLmNvbS8ifQ.dgzf_ywaa2D8EQQjaGRfpM1TESXAV0LJwQSjvZq3TK-lamrPYpNN42SvNM9T6k-wAra_vX36Xk2i1i4-QqGXKTESeBEPIQ2n936fUFHZDtYZwsID4idQSXxysW5B7IIuQ3QBMZU3PLH0SPCw_fCdEW80KWyoWsnIjxniKA4sPB2_HogWWGixfbYa_djZKWLWkYvOusqxVuoPfFPuO8M3fQJQhWiE3r5o4251Of7fAe-dmQG5vXeWl3PJowq1m76jCGbc16UR_ldtsxkMKqdSoEtkEbTP0NvnibMHwbdSQMj4IXyptFido9Xc0fR2y7cj98SNfc7anH7ydlX5_tdobw', 'referenceGrammarId': 'f81d2e90-3197-775d-ac27-3daecccb560d'}\n" ] }, { "data": { "text/plain": [ "{'conversationId': 'FDfvsSZMkEa2wQkHX58myW-eu',\n", " 'token': 'eyJhbGciOiJSUzI1NiIsImtpZCI6Ik5MZjUwanFheTN1R0VpQUpOV29EWmZzRnE4QSIsIng1dCI6Ik5MZjUwanFheTN1R0VpQUpOV29EWmZzRnE4QSIsInR5cCI6IkpXVCJ9.eyJib3QiOiI0OWU3Mzc4Yy02MGEyLTk0MTAtZmVhYy0zNjNjYzBiZjYzMjgiLCJzaXRlIjoiV2lkbl9BY05tWTQiLCJjb252IjoiRkRmdnNTWk1rRWEyd1FrSFg1OG15Vy1ldSIsIm5iZiI6MTcxOTgzMjY0NCwiZXhwIjoxNzE5ODM2MjQ0LCJpc3MiOiJodHRwczovL2RpcmVjdGxpbmUuYm90ZnJhbWV3b3JrLmNvbS8iLCJhdWQiOiJodHRwczovL2RpcmVjdGxpbmUuYm90ZnJhbWV3b3JrLmNvbS8ifQ.pEGceF3_8aeYExZHifP8Gy16Nx4gj8UOES2o2u7X54So90CcVeDgbpiRZ1QdKcsEsruO-9KXoOJFvKIAV342Zwf15r8GtLdZSxPUCsER16QXxGc0TxC_Gi_8bBec-ILHPe52EqiDfotReOv9TDcYkiegGGZENdIC_9lpULJVJXTbugBBCLTVIwlB4VRvpvJItYMwosRXV6w3XvQ6CABH1hvKRLDfFfytjm0UeURC-GSEWWl8ViS2JEylYlyh9aN2GR2xB13yRqgr-SjTF7m2bAMkKooOPlT0YXQMS17KpIUw_oCSDHKvUNul1QgyM4_nl6bnv7f--_SAi9CoinMd7A',\n", " 'expires_in': 3600,\n", " 'streamUrl': 'wss://europe.directline.botframework.com/v3/directline/conversations/FDfvsSZMkEa2wQkHX58myW-eu/stream?watermark=-&t=eyJhbGciOiJSUzI1NiIsImtpZCI6Ik5MZjUwanFheTN1R0VpQUpOV29EWmZzRnE4QSIsIng1dCI6Ik5MZjUwanFheTN1R0VpQUpOV29EWmZzRnE4QSIsInR5cCI6IkpXVCJ9.eyJib3QiOiI0OWU3Mzc4Yy02MGEyLTk0MTAtZmVhYy0zNjNjYzBiZjYzMjgiLCJzaXRlIjoiV2lkbl9BY05tWTQiLCJjb252IjoiRkRmdnNTWk1rRWEyd1FrSFg1OG15Vy1ldSIsIm5iZiI6MTcxOTgzMjY0NCwiZXhwIjoxNzE5ODMyNzA0LCJpc3MiOiJodHRwczovL2RpcmVjdGxpbmUuYm90ZnJhbWV3b3JrLmNvbS8iLCJhdWQiOiJodHRwczovL2RpcmVjdGxpbmUuYm90ZnJhbWV3b3JrLmNvbS8ifQ.dgzf_ywaa2D8EQQjaGRfpM1TESXAV0LJwQSjvZq3TK-lamrPYpNN42SvNM9T6k-wAra_vX36Xk2i1i4-QqGXKTESeBEPIQ2n936fUFHZDtYZwsID4idQSXxysW5B7IIuQ3QBMZU3PLH0SPCw_fCdEW80KWyoWsnIjxniKA4sPB2_HogWWGixfbYa_djZKWLWkYvOusqxVuoPfFPuO8M3fQJQhWiE3r5o4251Of7fAe-dmQG5vXeWl3PJowq1m76jCGbc16UR_ldtsxkMKqdSoEtkEbTP0NvnibMHwbdSQMj4IXyptFido9Xc0fR2y7cj98SNfc7anH7ydlX5_tdobw',\n", " 'referenceGrammarId': 'f81d2e90-3197-775d-ac27-3daecccb560d'}" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "info=conn.start_conversation(info['token'])\n", "info" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [], "source": [ "PROMT = \"\"\"Viedoc EC testing: Check that the end date is not prior to start date, code: var a = EXISTDAT; \n", " if !(a) \n", " return true; \n", " else \n", " return (EX1STDAT > =a); querytext: Note that 'End date' is before 'Start date'. Please reconcile. check that all items aligned with the description\"\"\"" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "SEND\n", "\n", "200\n", "{'id': 'FDfvsSZMkEa2wQkHX58myW-eu|0000000'}\n", "\n", "FETCH\n", "\n", "200\n" ] }, { "data": { "text/plain": [ "'It seems like you are referring to a code snippet for Viedoc EC testing. The code provided checks if the end date is not prior to the start date. If the variable `EXISTDAT` is not defined, it returns true. Otherwise, it compares the start date `EX1STDAT` with `EXISTDAT` and returns the result.\\n\\nThe query text states that the end date is before the start date and suggests reconciling the issue. It also advises checking if all items align with the description.\\n\\nIf you need further assistance or have any specific questions regarding this code or the query text, please let me know.\\r\\nAI-generated content may be incorrect'" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "conn.send_message(info['token'],info['conversationId'],'cohitai',PROMT)\n", "time.sleep(4)\n", "a= conn.get_message(info['token'],info['conversationId'])\n", "a[\"activities\"][-1][\"text\"]" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [], "source": [ "PROMT = \"\"\"Viedoc EC testing: Check that the end date is equal to start date, code: var a = EX1STDAT; \n", " if !(a) \n", " return true; \n", " else \n", " return (EX1STDAT >=a); querytext: Note that 'End date' is before 'Start date'. Please reconsile. check that all items aligned with the description\"\"\"" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "SEND\n", "\n", "200\n", "{'id': 'FDfvsSZMkEa2wQkHX58myW-eu|0000002'}\n", "\n", "FETCH\n", "\n", "200\n" ] }, { "data": { "text/plain": [ "'To modify the code and check if the end date is equal to the start date, you can update the code snippet as follows:\\n\\n```javascript\\nvar a = EXISTDAT;\\nif (!a) {\\n return true;\\n} else {\\n return (EX1STDAT === a);\\n}\\n```\\n\\nBy using the strict equality operator (`===`), the code will compare if the start date `EX1STDAT` is exactly equal to `EXISTDAT`, ensuring that the end date is equal to the start date.\\n\\nTo ensure that all items align with the description provided in the query text, you would need to provide more specific details or requirements about the items and their alignment. Based on the given information, it is not clear how the items should align with the description. Please provide more details or specific requirements so that I can assist you further.\\r\\nAI-generated content may be incorrect'" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "conn.send_message(info['token'],info['conversationId'],'cohitai',PROMT)\n", "time.sleep(4)\n", "a=conn.get_message(info['token'],info['conversationId'])\n", "a[\"activities\"][-1][\"text\"]" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [], "source": [ "PROMPT = \"\"\"If ((Associated visit in Disease Assessment (iwCLL) in Discease Assessment with record position 0 isEqualTo Schedualed Discease Assessment) Or (Associated visit in Disease Assessment (iwCLL) in Deseaace Assessment with record position 0 IsEqualTo Unschedualed Disease Assessment) And (CLC Was Assessment Performed? in Desease Assessment (iwCLL) in Disease Assessment with record position Y) then .. CLC Was Assessment Performed?\"\"\"" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "SEND\n", "\n", "200\n", "{'id': 'FDfvsSZMkEa2wQkHX58myW-eu|0000004'}\n", "\n", "FETCH\n", "\n", "200\n" ] }, { "data": { "text/plain": [ "'Based on your question, it seems like you are asking about a condition related to disease assessment in the context of iwCLL (International Workshop on Chronic Lymphocytic Leukemia). \\n\\nIf the associated visit in Disease Assessment (iwCLL) in Disease Assessment with record position 0 is equal to Scheduled Disease Assessment or Unscheduled Disease Assessment, and CLC Was Assessment Performed in Disease Assessment (iwCLL) in Disease Assessment with record position Y, then the question is asking whether the CLC Assessment was performed.\\n\\nTo provide a more accurate response, I would need additional information such as the specific values or conditions for the associated visit, record positions, and the CLC assessment. Please provide more details so that I can assist you further.\\r\\nAI-generated content may be incorrect'" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "conn.send_message(info['token'],info['conversationId'],'cohitai',PROMPT)\n", "time.sleep(4)\n", "a=conn.get_message(info['token'],info['conversationId'])\n", "a[\"activities\"][-1][\"text\"]\n" ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [], "source": [ "PROMPT = \"\"\"in Medidate EC testing- description \" check that end date of AE is not after date of death, if yes fire query. inflix- if End Date of Adverse Event in Adverse Events in Adverse Events isGreaterThan Date of Death in Death Form in Adverse Events. with record postion 0 then... open a query to Site from System on End End Date of Adverse Event in Adverse Events in Adverse Events, displaying \"AE End date is fter Date of Death. Please review.\" (requires response) (requires manual close), does it in allignment with description ?\"\"\"" ] }, { "cell_type": "code", "execution_count": 29, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "SEND\n", "\n", "200\n", "{'id': 'FDfvsSZMkEa2wQkHX58myW-eu|0000006'}\n", "\n", "FETCH\n", "\n", "200\n" ] }, { "data": { "text/plain": [ "'Yes, the provided description aligns with the given statement for Medidate EC testing. The description states that you need to check if the end date of an Adverse Event (AE) is after the date of death. If the end date of the Adverse Event in the Adverse Events table is greater than the Date of Death in the Death Form in the Adverse Events table with record position 0, then a query should be opened to the Site from the System. The query should be related to the End Date of the Adverse Event in the Adverse Events table and should display the message \"AE End date is after Date of Death. Please review.\" This query requires a response and manual closure.\\n\\nIf you have any further questions or need assistance with implementing this logic, please let me know.\\nAI-generated content may be incorrect \\r\\nAI-generated content may be incorrect'" ] }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "conn.send_message(info['token'],info['conversationId'],'cohitai',PROMPT)\n", "time.sleep(4)\n", "a=conn.get_message(info['token'],info['conversationId'])\n", "a[\"activities\"][-1][\"text\"]" ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [], "source": [ "PROMPT = \"\"\"would it function properly ?\"\"\"" ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "SEND\n", "\n", "200\n", "{'id': 'FDfvsSZMkEa2wQkHX58myW-eu|0000008'}\n", "\n", "FETCH\n", "\n", "200\n" ] }, { "data": { "text/plain": [ "'Based on the provided description, the functionality appears to be designed to work correctly as described. It checks if the end date of an Adverse Event is after the date of death, and if it is, it opens a query to the Site from the System. The query message clearly states the issue, and it requires a response and manual closure.\\n\\nHowever, please note that without access to the actual implementation and testing, it is difficult to guarantee the functionality will work exactly as described. It is always recommended to thoroughly test the functionality to ensure it behaves as expected in your specific system and environment.\\n\\nIf you have any specific concerns or questions about the implementation or need further assistance, please let me know.\\r\\nAI-generated content may be incorrect'" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "conn.send_message(info['token'],info['conversationId'],'cohitai',PROMPT)\n", "time.sleep(4)\n", "a=conn.get_message(info['token'],info['conversationId'])\n", "a[\"activities\"][-1][\"text\"]" ] }, { "cell_type": "code", "execution_count": 32, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "10" ] }, "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "res=a[\"activities\"]\n", "type(res)\n", "len(res)" ] }, { "cell_type": "code", "execution_count": 33, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\"Viedoc EC testing: Check that the end date is not prior to start date, code: var a = EXISTDAT; \\n if !(a) \\n return true; \\n else \\n return (EX1STDAT > =a); querytext: Note that 'End date' is before 'Start date'. Please reconcile. check that all items aligned with the description\"" ] }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "res[0]['text']" ] }, { "cell_type": "code", "execution_count": 34, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'It seems like you are referring to a code snippet for Viedoc EC testing. The code provided checks if the end date is not prior to the start date. If the variable `EXISTDAT` is not defined, it returns true. Otherwise, it compares the start date `EX1STDAT` with `EXISTDAT` and returns the result.\\n\\nThe query text states that the end date is before the start date and suggests reconciling the issue. It also advises checking if all items align with the description.\\n\\nIf you need further assistance or have any specific questions regarding this code or the query text, please let me know.\\r\\nAI-generated content may be incorrect'" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ "res[1]['text']" ] }, { "cell_type": "code", "execution_count": 35, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\"Viedoc EC testing: Check that the end date is equal to start date, code: var a = EX1STDAT; \\n if !(a) \\n return true; \\n else \\n return (EX1STDAT >=a); querytext: Note that 'End date' is before 'Start date'. Please reconsile. check that all items aligned with the description\"" ] }, "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "res[2]['text']" ] }, { "cell_type": "code", "execution_count": 36, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'To modify the code and check if the end date is equal to the start date, you can update the code snippet as follows:\\n\\n```javascript\\nvar a = EXISTDAT;\\nif (!a) {\\n return true;\\n} else {\\n return (EX1STDAT === a);\\n}\\n```\\n\\nBy using the strict equality operator (`===`), the code will compare if the start date `EX1STDAT` is exactly equal to `EXISTDAT`, ensuring that the end date is equal to the start date.\\n\\nTo ensure that all items align with the description provided in the query text, you would need to provide more specific details or requirements about the items and their alignment. Based on the given information, it is not clear how the items should align with the description. Please provide more details or specific requirements so that I can assist you further.\\r\\nAI-generated content may be incorrect'" ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "res[3]['text']" ] }, { "cell_type": "code", "execution_count": 37, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'If ((Associated visit in Disease Assessment (iwCLL) in Discease Assessment with record position 0 isEqualTo Schedualed Discease Assessment) Or (Associated visit in Disease Assessment (iwCLL) in Deseaace Assessment with record position 0 IsEqualTo Unschedualed Disease Assessment) And (CLC Was Assessment Performed? in Desease Assessment (iwCLL) in Disease Assessment with record position Y) then .. CLC Was Assessment Performed?'" ] }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ "res[4]['text']" ] }, { "cell_type": "code", "execution_count": 38, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'Based on your question, it seems like you are asking about a condition related to disease assessment in the context of iwCLL (International Workshop on Chronic Lymphocytic Leukemia). \\n\\nIf the associated visit in Disease Assessment (iwCLL) in Disease Assessment with record position 0 is equal to Scheduled Disease Assessment or Unscheduled Disease Assessment, and CLC Was Assessment Performed in Disease Assessment (iwCLL) in Disease Assessment with record position Y, then the question is asking whether the CLC Assessment was performed.\\n\\nTo provide a more accurate response, I would need additional information such as the specific values or conditions for the associated visit, record positions, and the CLC assessment. Please provide more details so that I can assist you further.\\r\\nAI-generated content may be incorrect'" ] }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "res[5]['text']" ] }, { "cell_type": "code", "execution_count": 39, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'in Medidate EC testing- description \" check that end date of AE is not after date of death, if yes fire query. inflix- if End Date of Adverse Event in Adverse Events in Adverse Events isGreaterThan Date of Death in Death Form in Adverse Events. with record postion 0 then... open a query to Site from System on End End Date of Adverse Event in Adverse Events in Adverse Events, displaying \"AE End date is fter Date of Death. Please review.\" (requires response) (requires manual close), does it in allignment with description ?'" ] }, "execution_count": 39, "metadata": {}, "output_type": "execute_result" } ], "source": [ "res[6]['text']" ] }, { "cell_type": "code", "execution_count": 40, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'Yes, the provided description aligns with the given statement for Medidate EC testing. The description states that you need to check if the end date of an Adverse Event (AE) is after the date of death. If the end date of the Adverse Event in the Adverse Events table is greater than the Date of Death in the Death Form in the Adverse Events table with record position 0, then a query should be opened to the Site from the System. The query should be related to the End Date of the Adverse Event in the Adverse Events table and should display the message \"AE End date is after Date of Death. Please review.\" This query requires a response and manual closure.\\n\\nIf you have any further questions or need assistance with implementing this logic, please let me know.\\nAI-generated content may be incorrect \\r\\nAI-generated content may be incorrect'" ] }, "execution_count": 40, "metadata": {}, "output_type": "execute_result" } ], "source": [ "res[7]['text']" ] }, { "cell_type": "code", "execution_count": 41, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[\"cohitai: Viedoc EC testing: Check that the end date is not prior to start date, code: var a = EXISTDAT; \\n if !(a) \\n return true; \\n else \\n return (EX1STDAT > =a); querytext: Note that 'End date' is before 'Start date'. Please reconcile. check that all items aligned with the description\",\n", " 'Dev Bot 1: It seems like you are referring to a code snippet for Viedoc EC testing. The code provided checks if the end date is not prior to the start date. If the variable `EXISTDAT` is not defined, it returns true. Otherwise, it compares the start date `EX1STDAT` with `EXISTDAT` and returns the result.\\n\\nThe query text states that the end date is before the start date and suggests reconciling the issue. It also advises checking if all items align with the description.\\n\\nIf you need further assistance or have any specific questions regarding this code or the query text, please let me know.\\r\\nAI-generated content may be incorrect',\n", " \"cohitai: Viedoc EC testing: Check that the end date is equal to start date, code: var a = EX1STDAT; \\n if !(a) \\n return true; \\n else \\n return (EX1STDAT >=a); querytext: Note that 'End date' is before 'Start date'. Please reconsile. check that all items aligned with the description\",\n", " 'Dev Bot 1: To modify the code and check if the end date is equal to the start date, you can update the code snippet as follows:\\n\\n```javascript\\nvar a = EXISTDAT;\\nif (!a) {\\n return true;\\n} else {\\n return (EX1STDAT === a);\\n}\\n```\\n\\nBy using the strict equality operator (`===`), the code will compare if the start date `EX1STDAT` is exactly equal to `EXISTDAT`, ensuring that the end date is equal to the start date.\\n\\nTo ensure that all items align with the description provided in the query text, you would need to provide more specific details or requirements about the items and their alignment. Based on the given information, it is not clear how the items should align with the description. Please provide more details or specific requirements so that I can assist you further.\\r\\nAI-generated content may be incorrect',\n", " 'cohitai: If ((Associated visit in Disease Assessment (iwCLL) in Discease Assessment with record position 0 isEqualTo Schedualed Discease Assessment) Or (Associated visit in Disease Assessment (iwCLL) in Deseaace Assessment with record position 0 IsEqualTo Unschedualed Disease Assessment) And (CLC Was Assessment Performed? in Desease Assessment (iwCLL) in Disease Assessment with record position Y) then .. CLC Was Assessment Performed?',\n", " 'Dev Bot 1: Based on your question, it seems like you are asking about a condition related to disease assessment in the context of iwCLL (International Workshop on Chronic Lymphocytic Leukemia). \\n\\nIf the associated visit in Disease Assessment (iwCLL) in Disease Assessment with record position 0 is equal to Scheduled Disease Assessment or Unscheduled Disease Assessment, and CLC Was Assessment Performed in Disease Assessment (iwCLL) in Disease Assessment with record position Y, then the question is asking whether the CLC Assessment was performed.\\n\\nTo provide a more accurate response, I would need additional information such as the specific values or conditions for the associated visit, record positions, and the CLC assessment. Please provide more details so that I can assist you further.\\r\\nAI-generated content may be incorrect',\n", " 'cohitai: in Medidate EC testing- description \" check that end date of AE is not after date of death, if yes fire query. inflix- if End Date of Adverse Event in Adverse Events in Adverse Events isGreaterThan Date of Death in Death Form in Adverse Events. with record postion 0 then... open a query to Site from System on End End Date of Adverse Event in Adverse Events in Adverse Events, displaying \"AE End date is fter Date of Death. Please review.\" (requires response) (requires manual close), does it in allignment with description ?',\n", " 'Dev Bot 1: Yes, the provided description aligns with the given statement for Medidate EC testing. The description states that you need to check if the end date of an Adverse Event (AE) is after the date of death. If the end date of the Adverse Event in the Adverse Events table is greater than the Date of Death in the Death Form in the Adverse Events table with record position 0, then a query should be opened to the Site from the System. The query should be related to the End Date of the Adverse Event in the Adverse Events table and should display the message \"AE End date is after Date of Death. Please review.\" This query requires a response and manual closure.\\n\\nIf you have any further questions or need assistance with implementing this logic, please let me know.\\nAI-generated content may be incorrect \\r\\nAI-generated content may be incorrect',\n", " 'cohitai: would it function properly ?',\n", " 'Dev Bot 1: Based on the provided description, the functionality appears to be designed to work correctly as described. It checks if the end date of an Adverse Event is after the date of death, and if it is, it opens a query to the Site from the System. The query message clearly states the issue, and it requires a response and manual closure.\\n\\nHowever, please note that without access to the actual implementation and testing, it is difficult to guarantee the functionality will work exactly as described. It is always recommended to thoroughly test the functionality to ensure it behaves as expected in your specific system and environment.\\n\\nIf you have any specific concerns or questions about the implementation or need further assistance, please let me know.\\r\\nAI-generated content may be incorrect']" ] }, "execution_count": 41, "metadata": {}, "output_type": "execute_result" } ], "source": [ "conn.transcript" ] }, { "cell_type": "code", "execution_count": 42, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'wss://europe.directline.botframework.com/v3/directline/conversations/FDfvsSZMkEa2wQkHX58myW-eu/stream?watermark=-&t=eyJhbGciOiJSUzI1NiIsImtpZCI6Ik5MZjUwanFheTN1R0VpQUpOV29EWmZzRnE4QSIsIng1dCI6Ik5MZjUwanFheTN1R0VpQUpOV29EWmZzRnE4QSIsInR5cCI6IkpXVCJ9.eyJib3QiOiI0OWU3Mzc4Yy02MGEyLTk0MTAtZmVhYy0zNjNjYzBiZjYzMjgiLCJzaXRlIjoiV2lkbl9BY05tWTQiLCJjb252IjoiRkRmdnNTWk1rRWEyd1FrSFg1OG15Vy1ldSIsIm5iZiI6MTcxOTgzMjY0NCwiZXhwIjoxNzE5ODMyNzA0LCJpc3MiOiJodHRwczovL2RpcmVjdGxpbmUuYm90ZnJhbWV3b3JrLmNvbS8iLCJhdWQiOiJodHRwczovL2RpcmVjdGxpbmUuYm90ZnJhbWV3b3JrLmNvbS8ifQ.dgzf_ywaa2D8EQQjaGRfpM1TESXAV0LJwQSjvZq3TK-lamrPYpNN42SvNM9T6k-wAra_vX36Xk2i1i4-QqGXKTESeBEPIQ2n936fUFHZDtYZwsID4idQSXxysW5B7IIuQ3QBMZU3PLH0SPCw_fCdEW80KWyoWsnIjxniKA4sPB2_HogWWGixfbYa_djZKWLWkYvOusqxVuoPfFPuO8M3fQJQhWiE3r5o4251Of7fAe-dmQG5vXeWl3PJowq1m76jCGbc16UR_ldtsxkMKqdSoEtkEbTP0NvnibMHwbdSQMj4IXyptFido9Xc0fR2y7cj98SNfc7anH7ydlX5_tdobw'" ] }, "execution_count": 42, "metadata": {}, "output_type": "execute_result" } ], "source": [ "URL_WSS=info[\"streamUrl\"]\n", "URL_WSS" ] }, { "cell_type": "code", "execution_count": 44, "metadata": {}, "outputs": [ { "ename": "RuntimeError", "evalue": "This event loop is already running", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)", "Cell \u001b[0;32mIn[44], line 10\u001b[0m\n\u001b[1;32m 7\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m websocket\u001b[38;5;241m.\u001b[39mrecv()\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28mprint\u001b[39m(response)\n\u001b[0;32m---> 10\u001b[0m \u001b[43masyncio\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_event_loop\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun_until_complete\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtest\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[0;32m~/.pyenv/versions/3.11.7/lib/python3.11/asyncio/base_events.py:629\u001b[0m, in \u001b[0;36mBaseEventLoop.run_until_complete\u001b[0;34m(self, future)\u001b[0m\n\u001b[1;32m 618\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Run until the Future is done.\u001b[39;00m\n\u001b[1;32m 619\u001b[0m \n\u001b[1;32m 620\u001b[0m \u001b[38;5;124;03mIf the argument is a coroutine, it is wrapped in a Task.\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 626\u001b[0m \u001b[38;5;124;03mReturn the Future's result, or raise its exception.\u001b[39;00m\n\u001b[1;32m 627\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 628\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_closed()\n\u001b[0;32m--> 629\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_check_running\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 631\u001b[0m new_task \u001b[38;5;241m=\u001b[39m \u001b[38;5;129;01mnot\u001b[39;00m futures\u001b[38;5;241m.\u001b[39misfuture(future)\n\u001b[1;32m 632\u001b[0m future \u001b[38;5;241m=\u001b[39m tasks\u001b[38;5;241m.\u001b[39mensure_future(future, loop\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m)\n", "File \u001b[0;32m~/.pyenv/versions/3.11.7/lib/python3.11/asyncio/base_events.py:588\u001b[0m, in \u001b[0;36mBaseEventLoop._check_running\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 586\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_check_running\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[1;32m 587\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mis_running():\n\u001b[0;32m--> 588\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mThis event loop is already running\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 589\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m events\u001b[38;5;241m.\u001b[39m_get_running_loop() \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 590\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m(\n\u001b[1;32m 591\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mCannot run the event loop while another loop is running\u001b[39m\u001b[38;5;124m'\u001b[39m)\n", "\u001b[0;31mRuntimeError\u001b[0m: This event loop is already running" ] } ], "source": [ "import asyncio\n", "import websockets\n", "\n", "async def test():\n", " async with websockets.connect(URL_WSS) as websocket:\n", " await websocket.send(\"hello\")\n", " response = await websocket.recv()\n", " print(response)\n", "\n", "asyncio.get_event_loop().run_until_complete(test())\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "gradio", "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.7" } }, "nbformat": 4, "nbformat_minor": 2 }