Reactions Extraction from SQL Databas #79
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Original Description: I went ahead and grabbed the Reactions data for each message, added the respective lines to the query, and added that data onto the dictionary object in extract.py. Did not interface this updated dictionary object with the HTML output at all. Tested with JSON extraction, worked just fine.
Reactions are understood in the SQL database in two ways:
With an associated sender_row_jid: this will be seen in the message_add_on table, and ties relevant information as who performed the reaction. I wanted sender information associated with each reaction, so this worked just fine. The message_add_on also references the message line id, which is what I used to join to the main table. Meanwhile, the message_add_on_reaction simply contains the reaction (an emoji) and the timestamp, as well as a reference to the message_add_on table with its primary key. In this case, only reactions by other users in group chats are accounted for.
The second way the reaction sender is understood is through a "-1" field for the jid. This indicates a reaction associated with the WhatsApp account holder: either a reaction FROM the user to ANY other message (dm or group message), or a reaction to a message in dms with the user (so, the other dm participant reacting to the user's message). This meant doing additional logic in the information that I extracted using group_concatenate in the SQL query, and parsing the concatenated string accordingly in the associated logic. This also means both cases had to have different methods of extracting the reaction sender tag.
Let me know if you would want additional changes to be made in order for this to be merged with main. In my communication on WhatsApp, it became apparent that reactions (usually thumbs-up or hearts) would take the place of a confirmation message (where "okay" or "sounds good" usually sufficed), meaning some conversational information was lost when not taking reactions into account.
The changes account for three additional query lines, and one if-statement of logic, as well as adding "reactions" to the base class attributes. I would be welcome to assist in any other changes to make this branch compatible with your project.
P.S. I fixed the pull request to only include relevant files, previously it included my result files from testing the extraction.
Best,
tlc