add sort_date as a DB field that can be queried.
make sure that order_by is automatically desc for date fields.
This commit is contained in:
parent
6d831f6ee7
commit
af2344ec00
|
@ -162,7 +162,7 @@ func (sr *SqliteRepository) sqlQueryResources(ctx context.Context, query models.
|
|||
|
||||
//process order by clause
|
||||
if len(query.Aggregations.OrderBy) > 0 {
|
||||
orderAsc := true
|
||||
orderAsc := true //default to ascending, switch to desc if parameter is a date type.
|
||||
if !strings.HasPrefix(query.Aggregations.OrderBy, "count(*)") {
|
||||
orderAggregationParam, err := ProcessAggregationParameter(query.Aggregations.OrderBy, searchCodeToTypeLookup)
|
||||
if err != nil {
|
||||
|
@ -174,6 +174,11 @@ func (sr *SqliteRepository) sqlQueryResources(ctx context.Context, query models.
|
|||
}
|
||||
fromClauses = append(fromClauses, orderAggregationFromClause)
|
||||
|
||||
//if the order by is a date type, we need to order by DESC (most recent first)
|
||||
if orderAggregationParam.Type == SearchParameterTypeDate {
|
||||
orderAsc = false
|
||||
}
|
||||
|
||||
orderClause = AggregationParameterToClause(orderAggregationParam)
|
||||
if orderAsc {
|
||||
orderClause = fmt.Sprintf("%s ASC", orderClause)
|
||||
|
@ -619,7 +624,7 @@ func ProcessAggregationParameter(aggregationFieldWithProperty string, searchPara
|
|||
}
|
||||
|
||||
//primitive types should not have a modifier, we need to throw an error
|
||||
if aggregationParameter.Type == SearchParameterTypeNumber || aggregationParameter.Type == SearchParameterTypeUri || aggregationParameter.Type == SearchParameterTypeKeyword {
|
||||
if aggregationParameter.Type == SearchParameterTypeNumber || aggregationParameter.Type == SearchParameterTypeUri || aggregationParameter.Type == SearchParameterTypeKeyword || aggregationParameter.Type == SearchParameterTypeDate {
|
||||
if len(aggregationParameter.Modifier) > 0 {
|
||||
return aggregationParameter, fmt.Errorf("primitive aggregation parameter %s cannot have a property (%s)", aggregationParameter.Name, aggregationParameter.Modifier)
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ func (s *FhirAccount) GetSearchParameters() map[string]string {
|
|||
"owner": "reference",
|
||||
"period": "date",
|
||||
"profile": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -85,6 +85,7 @@ func (s *FhirAdverseEvent) GetSearchParameters() map[string]string {
|
|||
"resultingcondition": "reference",
|
||||
"seriousness": "token",
|
||||
"severity": "token",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -165,6 +165,7 @@ func (s *FhirAllergyIntolerance) GetSearchParameters() map[string]string {
|
|||
"recorder": "reference",
|
||||
"route": "token",
|
||||
"severity": "token",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -101,6 +101,7 @@ func (s *FhirAppointment) GetSearchParameters() map[string]string {
|
|||
"serviceCategory": "token",
|
||||
"serviceType": "token",
|
||||
"slot": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -40,6 +40,7 @@ func (s *FhirBinary) GetSearchParameters() map[string]string {
|
|||
"language": "token",
|
||||
"lastUpdated": "date",
|
||||
"profile": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -167,6 +167,7 @@ func (s *FhirCarePlan) GetSearchParameters() map[string]string {
|
|||
"performer": "reference",
|
||||
"profile": "reference",
|
||||
"replaces": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -119,6 +119,7 @@ func (s *FhirCareTeam) GetSearchParameters() map[string]string {
|
|||
"lastUpdated": "date",
|
||||
"participant": "reference",
|
||||
"profile": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -101,6 +101,7 @@ func (s *FhirClaim) GetSearchParameters() map[string]string {
|
|||
"procedureUdi": "reference",
|
||||
"profile": "reference",
|
||||
"provider": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -78,6 +78,7 @@ func (s *FhirClaimResponse) GetSearchParameters() map[string]string {
|
|||
"profile": "reference",
|
||||
"request": "reference",
|
||||
"requestor": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -169,6 +169,7 @@ func (s *FhirComposition) GetSearchParameters() map[string]string {
|
|||
"relatedId": "token",
|
||||
"relatedRef": "reference",
|
||||
"section": "token",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -167,6 +167,7 @@ func (s *FhirCondition) GetSearchParameters() map[string]string {
|
|||
"profile": "reference",
|
||||
"recordedDate": "date",
|
||||
"severity": "token",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -147,6 +147,7 @@ func (s *FhirConsent) GetSearchParameters() map[string]string {
|
|||
"purpose": "token",
|
||||
"scope": "token",
|
||||
"securityLabel": "token",
|
||||
"sort_date": "date",
|
||||
"sourceReference": "reference",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
|
|
|
@ -74,6 +74,7 @@ func (s *FhirCoverage) GetSearchParameters() map[string]string {
|
|||
"payor": "reference",
|
||||
"policyHolder": "reference",
|
||||
"profile": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -63,6 +63,7 @@ func (s *FhirCoverageEligibilityRequest) GetSearchParameters() map[string]string
|
|||
"lastUpdated": "date",
|
||||
"profile": "reference",
|
||||
"provider": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -71,6 +71,7 @@ func (s *FhirCoverageEligibilityResponse) GetSearchParameters() map[string]strin
|
|||
"profile": "reference",
|
||||
"request": "reference",
|
||||
"requestor": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -76,6 +76,7 @@ func (s *FhirDevice) GetSearchParameters() map[string]string {
|
|||
"model": "string",
|
||||
"organization": "reference",
|
||||
"profile": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -171,6 +171,7 @@ func (s *FhirDeviceRequest) GetSearchParameters() map[string]string {
|
|||
"priorRequest": "reference",
|
||||
"profile": "reference",
|
||||
"requester": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -182,6 +182,7 @@ func (s *FhirDiagnosticReport) GetSearchParameters() map[string]string {
|
|||
"profile": "reference",
|
||||
"result": "reference",
|
||||
"resultsInterpreter": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -114,6 +114,7 @@ func (s *FhirDocumentManifest) GetSearchParameters() map[string]string {
|
|||
"recipient": "reference",
|
||||
"relatedId": "token",
|
||||
"relatedRef": "reference",
|
||||
"sort_date": "date",
|
||||
"source": "uri",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
|
|
|
@ -170,6 +170,7 @@ func (s *FhirDocumentReference) GetSearchParameters() map[string]string {
|
|||
"relation": "token",
|
||||
"securityLabel": "token",
|
||||
"setting": "token",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -174,6 +174,7 @@ func (s *FhirEncounter) GetSearchParameters() map[string]string {
|
|||
"reasonCode": "token",
|
||||
"reasonReference": "reference",
|
||||
"serviceProvider": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -63,6 +63,7 @@ func (s *FhirEndpoint) GetSearchParameters() map[string]string {
|
|||
"organization": "reference",
|
||||
"payloadType": "token",
|
||||
"profile": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -50,6 +50,7 @@ func (s *FhirEnrollmentRequest) GetSearchParameters() map[string]string {
|
|||
"language": "token",
|
||||
"lastUpdated": "date",
|
||||
"profile": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -51,6 +51,7 @@ func (s *FhirEnrollmentResponse) GetSearchParameters() map[string]string {
|
|||
"lastUpdated": "date",
|
||||
"profile": "reference",
|
||||
"request": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -102,6 +102,7 @@ func (s *FhirExplanationOfBenefit) GetSearchParameters() map[string]string {
|
|||
"procedureUdi": "reference",
|
||||
"profile": "reference",
|
||||
"provider": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -141,6 +141,7 @@ func (s *FhirFamilyMemberHistory) GetSearchParameters() map[string]string {
|
|||
"profile": "reference",
|
||||
"relationship": "token",
|
||||
"sex": "token",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -98,6 +98,7 @@ func (s *FhirGoal) GetSearchParameters() map[string]string {
|
|||
"lastUpdated": "date",
|
||||
"lifecycleStatus": "token",
|
||||
"profile": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -134,6 +134,7 @@ func (s *FhirImagingStudy) GetSearchParameters() map[string]string {
|
|||
"reason": "token",
|
||||
"referrer": "reference",
|
||||
"series": "token",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -149,6 +149,7 @@ func (s *FhirImmunization) GetSearchParameters() map[string]string {
|
|||
"reasonCode": "token",
|
||||
"reasonReference": "reference",
|
||||
"series": "string",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -91,6 +91,7 @@ func (s *FhirInsurancePlan) GetSearchParameters() map[string]string {
|
|||
"ownedBy": "reference",
|
||||
"phonetic": "string",
|
||||
"profile": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -91,6 +91,7 @@ func (s *FhirLocation) GetSearchParameters() map[string]string {
|
|||
"organization": "reference",
|
||||
"partof": "reference",
|
||||
"profile": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -81,6 +81,7 @@ func (s *FhirMedia) GetSearchParameters() map[string]string {
|
|||
"operator": "reference",
|
||||
"profile": "reference",
|
||||
"site": "token",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -92,6 +92,7 @@ func (s *FhirMedication) GetSearchParameters() map[string]string {
|
|||
"lotNumber": "token",
|
||||
"manufacturer": "reference",
|
||||
"profile": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -150,6 +150,7 @@ func (s *FhirMedicationAdministration) GetSearchParameters() map[string]string {
|
|||
"reasonGiven": "token",
|
||||
"reasonNotGiven": "token",
|
||||
"request": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -156,6 +156,7 @@ func (s *FhirMedicationDispense) GetSearchParameters() map[string]string {
|
|||
"profile": "reference",
|
||||
"receiver": "reference",
|
||||
"responsibleparty": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -170,6 +170,7 @@ func (s *FhirMedicationRequest) GetSearchParameters() map[string]string {
|
|||
"priority": "token",
|
||||
"profile": "reference",
|
||||
"requester": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -141,6 +141,7 @@ func (s *FhirMedicationStatement) GetSearchParameters() map[string]string {
|
|||
"medication": "reference",
|
||||
"partOf": "reference",
|
||||
"profile": "reference",
|
||||
"sort_date": "date",
|
||||
"source": "reference",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
|
|
|
@ -130,6 +130,7 @@ func (s *FhirNutritionOrder) GetSearchParameters() map[string]string {
|
|||
"oraldiet": "token",
|
||||
"profile": "reference",
|
||||
"provider": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -234,6 +234,7 @@ func (s *FhirObservation) GetSearchParameters() map[string]string {
|
|||
"partOf": "reference",
|
||||
"performer": "reference",
|
||||
"profile": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -88,6 +88,7 @@ func (s *FhirOrganization) GetSearchParameters() map[string]string {
|
|||
"partof": "reference",
|
||||
"phonetic": "string",
|
||||
"profile": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -94,6 +94,7 @@ func (s *FhirOrganizationAffiliation) GetSearchParameters() map[string]string {
|
|||
"profile": "reference",
|
||||
"role": "token",
|
||||
"service": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -223,6 +223,7 @@ func (s *FhirPatient) GetSearchParameters() map[string]string {
|
|||
"phone": "token",
|
||||
"phonetic": "string",
|
||||
"profile": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -197,6 +197,7 @@ func (s *FhirPerson) GetSearchParameters() map[string]string {
|
|||
"practitioner": "reference",
|
||||
"profile": "reference",
|
||||
"relatedperson": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -197,6 +197,7 @@ func (s *FhirPractitioner) GetSearchParameters() map[string]string {
|
|||
"phone": "token",
|
||||
"phonetic": "string",
|
||||
"profile": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -114,6 +114,7 @@ func (s *FhirPractitionerRole) GetSearchParameters() map[string]string {
|
|||
"profile": "reference",
|
||||
"role": "token",
|
||||
"service": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -183,6 +183,7 @@ func (s *FhirProcedure) GetSearchParameters() map[string]string {
|
|||
"profile": "reference",
|
||||
"reasonCode": "token",
|
||||
"reasonReference": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -74,6 +74,7 @@ func (s *FhirProvenance) GetSearchParameters() map[string]string {
|
|||
"profile": "reference",
|
||||
"recorded": "date",
|
||||
"signatureType": "token",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -103,6 +103,7 @@ func (s *FhirQuestionnaire) GetSearchParameters() map[string]string {
|
|||
"name": "string",
|
||||
"profile": "reference",
|
||||
"publisher": "string",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -77,6 +77,7 @@ func (s *FhirQuestionnaireResponse) GetSearchParameters() map[string]string {
|
|||
"partOf": "reference",
|
||||
"profile": "reference",
|
||||
"questionnaire": "reference",
|
||||
"sort_date": "date",
|
||||
"source": "reference",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
|
|
|
@ -189,6 +189,7 @@ func (s *FhirRelatedPerson) GetSearchParameters() map[string]string {
|
|||
"phonetic": "string",
|
||||
"profile": "reference",
|
||||
"relationship": "token",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -67,6 +67,7 @@ func (s *FhirSchedule) GetSearchParameters() map[string]string {
|
|||
"profile": "reference",
|
||||
"serviceCategory": "token",
|
||||
"serviceType": "token",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -182,6 +182,7 @@ func (s *FhirServiceRequest) GetSearchParameters() map[string]string {
|
|||
"replaces": "reference",
|
||||
"requester": "reference",
|
||||
"requisition": "token",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -69,6 +69,7 @@ func (s *FhirSlot) GetSearchParameters() map[string]string {
|
|||
"schedule": "reference",
|
||||
"serviceCategory": "token",
|
||||
"serviceType": "token",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -78,6 +78,7 @@ func (s *FhirSpecimen) GetSearchParameters() map[string]string {
|
|||
"lastUpdated": "date",
|
||||
"parent": "reference",
|
||||
"profile": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -107,6 +107,7 @@ func (s *FhirVisionPrescription) GetSearchParameters() map[string]string {
|
|||
"lastUpdated": "date",
|
||||
"prescriber": "reference",
|
||||
"profile": "reference",
|
||||
"sort_date": "date",
|
||||
"source_id": "keyword",
|
||||
"source_resource_id": "keyword",
|
||||
"source_resource_type": "keyword",
|
||||
|
|
|
@ -209,6 +209,7 @@ func main() {
|
|||
d[jen.Lit("source_uri")] = jen.Lit("keyword")
|
||||
d[jen.Lit("source_resource_id")] = jen.Lit("keyword")
|
||||
d[jen.Lit("source_resource_type")] = jen.Lit("keyword")
|
||||
d[jen.Lit("sort_date")] = jen.Lit("date")
|
||||
|
||||
}))
|
||||
g.Return(jen.Id("searchParameters"))
|
||||
|
@ -563,8 +564,8 @@ func main() {
|
|||
|
||||
}
|
||||
|
||||
//TODO: should we do this, or allow all resources instead of just USCore?
|
||||
//The dataabase would be full of empty data, but we'd be more flexible & future-proof.. supporting other countries, etc.
|
||||
// TODO: should we do this, or allow all resources instead of just USCore?
|
||||
// The dataabase would be full of empty data, but we'd be more flexible & future-proof.. supporting other countries, etc.
|
||||
var AllowedResources = []string{
|
||||
"Account",
|
||||
"AdverseEvent",
|
||||
|
@ -623,7 +624,7 @@ var AllowedResources = []string{
|
|||
"VisionPrescription",
|
||||
}
|
||||
|
||||
//simple field types are not json encoded in the DB and are always single values (not arrays)
|
||||
// simple field types are not json encoded in the DB and are always single values (not arrays)
|
||||
func isSimpleFieldType(fieldType string) bool {
|
||||
switch fieldType {
|
||||
case "number", "uri", "date":
|
||||
|
@ -636,8 +637,8 @@ func isSimpleFieldType(fieldType string) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
//https://hl7.org/fhir/search.html#token
|
||||
//https://hl7.org/fhir/r4/valueset-search-param-type.html
|
||||
// https://hl7.org/fhir/search.html#token
|
||||
// https://hl7.org/fhir/r4/valueset-search-param-type.html
|
||||
func mapFieldType(fieldType string) string {
|
||||
switch fieldType {
|
||||
case "number":
|
||||
|
@ -661,7 +662,7 @@ func mapFieldType(fieldType string) string {
|
|||
}
|
||||
}
|
||||
|
||||
//https://www.sqlite.org/datatype3.html
|
||||
// https://www.sqlite.org/datatype3.html
|
||||
func mapGormType(fieldType string) string {
|
||||
// gorm:"type:text;serializer:json"
|
||||
|
||||
|
|
Loading…
Reference in New Issue