Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3
Issue 5 message thread#38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ajnelson-nist
merged 5 commits into
casework:main
from
fabrizio-turchi:issue_5_message_threadMar 13, 2024
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bf877ba
Reformatted line by Flake by CI action
fabrizio-turchi 1172259
Regenerate Make-managed files
ajnelson-nist 6ad4bc7
Merge branch 'main' into issue_5_message_thread
ajnelson-nist 9be959b
Merge branch 'main' into issue_5_message_thread
ajnelson-nist e93506c
Review 'visbility' usage
ajnelson-nist File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| from datetime import datetime | ||
| from typing import Dict | ||
| from typing import Dict, Optional | ||
| from cdo_local_uuid import local_uuid | ||
| from pytz import timezone | ||
| @@ -1342,56 +1342,35 @@ def __init__( | ||
| class FacetMessagethread(FacetEntity): | ||
| def __init__( | ||
| self, | ||
| display_name=None, | ||
| visibility=None, | ||
| visibility: Optional[bool] = None, | ||
| participants=None, | ||
| messages=None, | ||
| ): | ||
| """ | ||
| A message thread facet is a grouping of characteristics unique to a running commentary of electronic messages | ||
| pertaining to one topic or question. | ||
| :param messages: Adjacency matrix, encoded as a dictionary. Key: IRI of Message ObservableObject. Value: Set of IRIs of Message ObservableObjects. | ||
| A message thread facet is a grouping of characteristics unique to a running | ||
| commentary of electronic messages pertaining to one topic or question. | ||
| :param visibility: A boolean value to indicate if the thread is private (False) or | ||
| public (True). | ||
| :param participants: Array of Account ObservableObject, | ||
| :param messages: Array of Message ObservableObjects. | ||
| """ | ||
| super().__init__() | ||
| self["@type"] = "uco-observable:MessageThreadFacet" | ||
| self._str_vars(**{"uco-observable:displayName": display_name}) | ||
| self._bool_vars(**{"uco-observable:visibility": visibility}) | ||
ajnelson-nist marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| self._node_reference_vars(**{"uco-observable:participant": participants}) | ||
| self["uco-observable:messageThread"] = { | ||
| "@id": self.prefix_label + ":" + local_uuid(), | ||
| "@type": "uco-types:Thread", | ||
| } | ||
| # How many messages are there? | ||
| _message_ids = set() | ||
| if messages is not None: | ||
| for message_id in messages: | ||
| _message_ids.add(message_id) | ||
| for next_message_id in messages[message_id]: | ||
| _message_ids.add(next_message_id) | ||
| self["uco-observable:messageThread"]["co:size"] = { | ||
| "@type": "xsd:nonNegativeInteger", | ||
| "@value": str(len(_message_ids)), | ||
| "@value": str(len(messages)), | ||
| } | ||
| if len(_message_ids) > 0: | ||
| _element_list = [] | ||
| # TODO - Need to implement checker for thread having only one terminus. | ||
| # _item_list = [] | ||
| for message_id in sorted(_message_ids): | ||
| _element = {"@id": message_id} | ||
| _element_list.append(_element) | ||
| _item = { | ||
| "@id": message_id, | ||
| "@type": "uco-types:ThreadItem", | ||
| "co:itemContent": {"@id": message_id}, | ||
| } | ||
| if message_id in messages and len(messages[message_id]) > 0: | ||
| _next_items = [] | ||
| for next_message_id in sorted(messages[message_id]): | ||
| _next_items.append({"@id": next_message_id}) | ||
| _item["uco-types:threadNextItem"] = _next_items | ||
| self["uco-observable:messageThread"]["co:element"] = _element_list | ||
| list_id_messages = list() | ||
| for m in messages: | ||
| list_id_messages.append({"@id": m.get_id()}) | ||
| self["uco-observable:messageThread"]["co:element"] = list_id_messages | ||
| def append_messages(self, messages): | ||
| raise NotImplementedError( | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Uh oh!
There was an error while loading. Please reload this page.