-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8786680
commit 918bb09
Showing
18 changed files
with
1,499 additions
and
49 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package dto | ||
|
||
import ( | ||
"github.com/savannahghi/scalarutils" | ||
) | ||
|
||
// Composition is a minimal representation of a fhir Composition | ||
type Composition struct { | ||
ID string `json:"id,omitempty"` | ||
Text string `json:"text,omitempty"` | ||
Type CompositionType `json:"type,omitempty"` | ||
Category CompositionCategory `json:"category,omitempty"` | ||
Status CompositionStatusEnum `json:"status,omitempty"` | ||
PatientID string `json:"patientID,omitempty"` | ||
EncounterID string `json:"encounterID,omitempty"` | ||
Date *scalarutils.Date `json:"date"` | ||
Author string `json:"author,omitempty"` | ||
} | ||
|
||
// CompositionEdge is a composition edge | ||
type CompositionEdge struct { | ||
Node Composition | ||
Cursor string | ||
} | ||
|
||
// CompositionConnection is a Composition Connection Type | ||
type CompositionConnection struct { | ||
TotalCount int | ||
Edges []CompositionEdge | ||
PageInfo PageInfo | ||
} | ||
|
||
// CreateConditionConnection creates a connection that follows the GraphQl Cursor Connection Specification | ||
func CreateCompositionConnection(compositions []Composition, pageInfo PageInfo, total int) CompositionConnection { | ||
connection := CompositionConnection{ | ||
TotalCount: total, | ||
Edges: []CompositionEdge{}, | ||
PageInfo: pageInfo, | ||
} | ||
|
||
for _, composition := range compositions { | ||
edge := CompositionEdge{ | ||
Node: composition, | ||
Cursor: composition.ID, | ||
} | ||
|
||
connection.Edges = append(connection.Edges, edge) | ||
} | ||
|
||
return connection | ||
} |
This file contains 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 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 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 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 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 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
Oops, something went wrong.