-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
20 changed files
with
1,836 additions
and
817 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ linters: | |
# TODO: Restore this | ||
- unused | ||
- depguard | ||
- dupl | ||
|
||
linters-settings: | ||
lll: | ||
|
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,44 @@ | ||
package hapifhirgo | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/savannahghi/hapi-fhir-go/models" | ||
) | ||
|
||
func (c *Client) CreateFHIRConsent(ctx context.Context, input *models.FHIRConsent) (*models.FHIRConsent, error) { | ||
payload, err := structToMap(input) | ||
if err != nil { | ||
return nil, fmt.Errorf("unable to turn %s input into a map: %w", consentResourceType, err) | ||
} | ||
|
||
resource := &models.FHIRConsent{} | ||
|
||
err = c.createFHIRResource(ctx, consentResourceType, payload, resource) | ||
if err != nil { | ||
return nil, fmt.Errorf("unable to create %s resource: %w", consentResourceType, err) | ||
} | ||
|
||
return resource, nil | ||
} | ||
|
||
func (c *Client) GetFHIRConsent(ctx context.Context, id string) (*models.FHIRConsent, error) { | ||
resource := &models.FHIRConsent{} | ||
|
||
err := c.getFHIRResource(ctx, consentResourceType, id, resource) | ||
if err != nil { | ||
return nil, fmt.Errorf("unable to get %s with ID %s, err: %w", consentResourceType, id, err) | ||
} | ||
|
||
return resource, nil | ||
} | ||
|
||
func (c *Client) SearchFHIRConsent(ctx context.Context, searchParams map[string]interface{}) (*models.Bundle, error) { | ||
response, err := c.searchFHIRResource(ctx, consentResourceType, searchParams) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return response, nil | ||
} |
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,26 @@ | ||
package hapifhirgo | ||
|
||
const ( | ||
organizationResource = "Organization" | ||
patientResourceType = "Patient" | ||
episodeOfCareResourceType = "EpisodeOfCare" | ||
observationResourceType = "Observation" | ||
allergyIntoleranceResourceType = "AllergyIntolerance" | ||
serviceRequestResourceType = "ServiceRequest" | ||
medicationRequestResourceType = "MedicationRequest" | ||
conditionResourceType = "Condition" | ||
encounterResourceType = "Encounter" | ||
compositionResourceType = "Composition" | ||
medicationStatementResourceType = "MedicationStatement" | ||
medicationResourceType = "Medication" | ||
mediaResourceType = "Media" | ||
questionnaireResourceType = "Questionnaire" | ||
consentResourceType = "Consent" | ||
questionnaireResponseResourceType = "QuestionnaireResponse" | ||
riskAssessmentResourceType = "RiskAssessment" | ||
diagnosticReportResourceType = "DiagnosticReport" | ||
subscriptionResourceType = "Subscription" | ||
documentReferenceResourceType = "DocumentReference" | ||
appointmentResourceType = "Appointment" | ||
taskResourceType = "Task" | ||
) |
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,53 @@ | ||
package hapifhirgo | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/savannahghi/hapi-fhir-go/models" | ||
) | ||
|
||
func (c *Client) CreateFHIREncounter(ctx context.Context, input *models.FHIREncounter) (*models.FHIREncounter, error) { | ||
payload, err := structToMap(input) | ||
if err != nil { | ||
return nil, fmt.Errorf("unable to turn %s input into a map: %w", encounterResourceType, err) | ||
} | ||
|
||
resource := &models.FHIREncounter{} | ||
|
||
err = c.createFHIRResource(ctx, encounterResourceType, payload, resource) | ||
if err != nil { | ||
return nil, fmt.Errorf("unable to create %s resource: %w", encounterResourceType, err) | ||
} | ||
|
||
return resource, nil | ||
} | ||
|
||
func (c *Client) GetFHIREncounter(ctx context.Context, id string) (*models.FHIREncounter, error) { | ||
resource := &models.FHIREncounter{} | ||
|
||
err := c.getFHIRResource(ctx, encounterResourceType, id, resource) | ||
if err != nil { | ||
return nil, fmt.Errorf("unable to get %s with ID %s, err: %w", encounterResourceType, id, err) | ||
} | ||
|
||
return resource, nil | ||
} | ||
|
||
func (c *Client) GetFHIREncounterAllData(ctx context.Context, id string, params map[string]interface{}) (*models.Bundle, error) { | ||
response, err := c.getEncounterEverything(ctx, id, params) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return response, nil | ||
} | ||
|
||
func (c *Client) SearchFHIREncounter(ctx context.Context, searchParams map[string]interface{}) (*models.Bundle, error) { | ||
response, err := c.searchFHIRResource(ctx, encounterResourceType, searchParams) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return response, nil | ||
} |
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,44 @@ | ||
package hapifhirgo | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/savannahghi/hapi-fhir-go/models" | ||
) | ||
|
||
func (c *Client) CreateFHIREpisodeOfCare(ctx context.Context, input *models.FHIREpisodeOfCare) (*models.FHIREpisodeOfCare, error) { | ||
payload, err := structToMap(input) | ||
if err != nil { | ||
return nil, fmt.Errorf("unable to turn %s input into a map: %w", episodeOfCareResourceType, err) | ||
} | ||
|
||
resource := &models.FHIREpisodeOfCare{} | ||
|
||
err = c.createFHIRResource(ctx, episodeOfCareResourceType, payload, resource) | ||
if err != nil { | ||
return nil, fmt.Errorf("unable to create %s resource: %w", episodeOfCareResourceType, err) | ||
} | ||
|
||
return resource, nil | ||
} | ||
|
||
func (c *Client) GetFHIREpisodeOfCare(ctx context.Context, id string) (*models.FHIREpisodeOfCare, error) { | ||
resource := &models.FHIREpisodeOfCare{} | ||
|
||
err := c.getFHIRResource(ctx, episodeOfCareResourceType, id, resource) | ||
if err != nil { | ||
return nil, fmt.Errorf("unable to get %s with ID %s, err: %w", episodeOfCareResourceType, id, err) | ||
} | ||
|
||
return resource, nil | ||
} | ||
|
||
func (c *Client) SearchFHIREpisodeOfCare(ctx context.Context, searchParams map[string]interface{}) (*models.Bundle, error) { | ||
response, err := c.searchFHIRResource(ctx, episodeOfCareResourceType, searchParams) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return response, nil | ||
} |
Oops, something went wrong.