Skip to content
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

feat: pumb through event ids #334

Merged
merged 2 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ type EmbeddingMetadata {
}

type Event {
id: ID!
eventMetadata: EventMetadata!
dimensions: [DimensionWithValue!]!
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/pages/embedding/PointSelectionPanelContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export function PointSelectionPanelContent() {
model {
primaryDataset {
events(eventIds: $primaryEventIds) {
id
dimensions {
dimension {
name
Expand All @@ -49,6 +50,7 @@ export function PointSelectionPanelContent() {
}
referenceDataset {
events(eventIds: $referenceEventIds) {
id
dimensions {
dimension {
name
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions src/phoenix/server/api/types/Dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from phoenix.datasets import Dataset as InternalDataset
from phoenix.datasets import Schema
from phoenix.datasets.dataset import DatasetType
from phoenix.datasets.event import EventId

from ..context import Context
from ..input_types.DimensionInput import DimensionInput
Expand Down Expand Up @@ -68,6 +69,8 @@ def events(
]
return [
_create_event(
row_index=row_index,
dataset_type=self.type,
row=dataframe.iloc[row_index, column_indexes],
schema=schema,
dimensions=requested_gql_dimensions,
Expand Down Expand Up @@ -118,7 +121,13 @@ def _get_requested_features_and_tags(
return requested_features_and_tags


def _create_event(row: "Series[Any]", schema: Schema, dimensions: List[Dimension]) -> Event:
def _create_event(
row_index: int,
dataset_type: "DatasetType",
row: "Series[Any]",
schema: Schema,
dimensions: List[Dimension],
) -> Event:
"""
Reads dimension values and event metadata from a dataframe row and returns
an event containing this information.
Expand All @@ -140,4 +149,9 @@ def _create_event(row: "Series[Any]", schema: Schema, dimensions: List[Dimension
)
for dim in dimensions
]
return Event(eventMetadata=event_metadata, dimensions=dimensions_with_values)

return Event(
id=ID(str(EventId(row_id=row_index, dataset_id=dataset_type))),
eventMetadata=event_metadata,
dimensions=dimensions_with_values,
)
1 change: 1 addition & 0 deletions src/phoenix/server/api/types/Event.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@

@strawberry.type
class Event:
id: strawberry.ID
eventMetadata: EventMetadata
dimensions: List[DimensionWithValue]