Skip to content

Commit

Permalink
k
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhongsun96 committed Sep 2, 2024
1 parent ba8eb6f commit 6e6196f
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions backend/danswer/connectors/productboard/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ def _get_features(self) -> Generator[Document, None, None]:
owner = self._get_owner_email(feature)
experts = [BasicExpertInfo(email=owner)] if owner else None

metadata: dict[str, str | list[str]] = {}
entity_type = feature.get("type", "feature")
if entity_type:
metadata["entity_type"] = entity_type

status = feature.get("status", {}).get("name")
if status:
metadata["status"] = status

yield Document(
id=feature["id"],
sections=[
Expand All @@ -110,10 +119,7 @@ def _get_features(self) -> Generator[Document, None, None]:
source=DocumentSource.PRODUCTBOARD,
doc_updated_at=time_str_to_utc(feature["updatedAt"]),
primary_owners=experts,
metadata={
"entity_type": feature["type"],
"status": feature["status"]["name"],
},
metadata=metadata,
)

def _get_components(self) -> Generator[Document, None, None]:
Expand Down Expand Up @@ -174,6 +180,12 @@ def _get_objectives(self) -> Generator[Document, None, None]:
owner = self._get_owner_email(objective)
experts = [BasicExpertInfo(email=owner)] if owner else None

metadata: dict[str, str | list[str]] = {
"entity_type": "objective",
}
if objective.get("state"):
metadata["state"] = str(objective["state"])

yield Document(
id=objective["id"],
sections=[
Expand All @@ -186,10 +198,7 @@ def _get_objectives(self) -> Generator[Document, None, None]:
source=DocumentSource.PRODUCTBOARD,
doc_updated_at=time_str_to_utc(objective["updatedAt"]),
primary_owners=experts,
metadata={
"entity_type": "release",
"state": objective["state"],
},
metadata=metadata,
)

def _is_updated_at_out_of_time_range(
Expand Down

0 comments on commit 6e6196f

Please sign in to comment.