working on text extraction. TODO: we should handle javascript complex types by json encoding.
TODO: https://www.geeksforgeeks.org/how-to-check-if-the-value-is-primitive-or-not-in-javascript/ TODO: convert to markdown
This commit is contained in:
parent
62a89d7999
commit
38ea0562ea
|
@ -2,6 +2,7 @@ package database
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
_20231017112246 "github.com/fastenhealth/fasten-onprem/backend/pkg/database/migrations/20231017112246"
|
||||
_20231201122541 "github.com/fastenhealth/fasten-onprem/backend/pkg/database/migrations/20231201122541"
|
||||
|
@ -194,7 +195,59 @@ func (gr *GormRepository) Migrate() error {
|
|||
return nil
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: "20240217112628", // re-process all FHIR resources, to ensure we correctly process the text field
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
|
||||
//re-process all FHIR resources
|
||||
resourceTypes := databaseModel.GetAllowedResourceTypes()
|
||||
for _, resourceType := range resourceTypes {
|
||||
tableName, err := databaseModel.GetTableNameByResourceType(resourceType)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var tempWrappedResourceModels []models.ResourceBase
|
||||
results := tx.
|
||||
Where("text = ?", "[object Object]"). // only re-process resources that were incorrectly processed
|
||||
Table(tableName).
|
||||
Find(&tempWrappedResourceModels)
|
||||
if results.Error != nil {
|
||||
return results.Error
|
||||
}
|
||||
|
||||
for ndx, _ := range tempWrappedResourceModels {
|
||||
tempWrappedResourceModel := &tempWrappedResourceModels[ndx]
|
||||
|
||||
wrappedFhirResourceModel, err := databaseModel.NewFhirResourceModelByType(tempWrappedResourceModel.SourceResourceType)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
wrappedFhirResourceModel.SetOriginBase(tempWrappedResourceModel.OriginBase)
|
||||
wrappedFhirResourceModel.SetSortTitle(tempWrappedResourceModel.SortTitle)
|
||||
wrappedFhirResourceModel.SetSortDate(tempWrappedResourceModel.SortDate)
|
||||
wrappedFhirResourceModel.SetSourceUri(tempWrappedResourceModel.SourceUri)
|
||||
|
||||
//TODO: this is a waste of processing, we're re-parsing the JSON for every field, instead of just the one we care about.
|
||||
err = wrappedFhirResourceModel.PopulateAndExtractSearchParameters(json.RawMessage(tempWrappedResourceModel.ResourceRaw))
|
||||
if err != nil {
|
||||
//ignoring errors here, as we're just trying to re-process the resources
|
||||
continue
|
||||
}
|
||||
|
||||
resp := tx.Table(tableName).Save(&tempWrappedResourceModel)
|
||||
if resp.Error != nil {
|
||||
tx.Logger.Error(context.Background(), fmt.Sprintf("An error occurred re-processing FHIR Resource: %s", tempWrappedResourceModel.ID))
|
||||
return resp.Error
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return nil
|
||||
},
|
||||
},
|
||||
})
|
||||
//use "echo $(date '+%Y%m%d%H%M%S')" to generate new ID's
|
||||
|
||||
// run when database is empty
|
||||
//m.InitSchema(func(tx *gorm.DB) error {
|
||||
|
|
|
@ -17,6 +17,8 @@ import (
|
|||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
//TODO: replace functionality here with https://github.com/go-gorm/datatypes
|
||||
|
||||
type SearchParameterType string
|
||||
|
||||
const (
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -189,14 +188,9 @@ func (s *FhirAccount) PopulateAndExtractSearchParameters(resourceRaw json.RawMes
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -243,14 +242,9 @@ func (s *FhirAdverseEvent) PopulateAndExtractSearchParameters(resourceRaw json.R
|
|||
s.Substance = []byte(substanceResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -342,14 +341,9 @@ func (s *FhirAllergyIntolerance) PopulateAndExtractSearchParameters(resourceRaw
|
|||
s.Severity = []byte(severityResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
// extracting VerificationStatus
|
||||
verificationStatusResult, err := vm.RunString("extractTokenSearchParameters(fhirResource, 'AllergyIntolerance.verificationStatus')")
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -279,14 +278,9 @@ func (s *FhirAppointment) PopulateAndExtractSearchParameters(resourceRaw json.Ra
|
|||
s.SupportingInfo = []byte(supportingInfoResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -127,14 +126,9 @@ func (s *FhirBinary) PopulateAndExtractSearchParameters(resourceRaw json.RawMess
|
|||
s.MetaVersionId = metaVersionIdResult.String()
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -367,14 +366,9 @@ func (s *FhirCarePlan) PopulateAndExtractSearchParameters(resourceRaw json.RawMe
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -251,14 +250,9 @@ func (s *FhirCareTeam) PopulateAndExtractSearchParameters(resourceRaw json.RawMe
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -274,14 +273,9 @@ func (s *FhirClaim) PopulateAndExtractSearchParameters(resourceRaw json.RawMessa
|
|||
s.SubdetailUdi = []byte(subdetailUdiResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
// extracting Use
|
||||
useResult, err := vm.RunString("extractTokenSearchParameters(fhirResource, 'Claim.use')")
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -228,14 +227,9 @@ func (s *FhirClaimResponse) PopulateAndExtractSearchParameters(resourceRaw json.
|
|||
s.Status = []byte(statusResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
// extracting Use
|
||||
useResult, err := vm.RunString("extractTokenSearchParameters(fhirResource, 'ClaimResponse.use')")
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -350,14 +349,9 @@ func (s *FhirComposition) PopulateAndExtractSearchParameters(resourceRaw json.Ra
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
// extracting Title
|
||||
titleResult, err := vm.RunString("extractStringSearchParameters(fhirResource, 'Composition.title')")
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -376,14 +375,9 @@ func (s *FhirCondition) PopulateAndExtractSearchParameters(resourceRaw json.RawM
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
// extracting VerificationStatus
|
||||
verificationStatusResult, err := vm.RunString("extractTokenSearchParameters(fhirResource, 'Condition.verificationStatus')")
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -322,14 +321,9 @@ func (s *FhirConsent) PopulateAndExtractSearchParameters(resourceRaw json.RawMes
|
|||
s.Status = []byte(statusResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -208,14 +207,9 @@ func (s *FhirCoverage) PopulateAndExtractSearchParameters(resourceRaw json.RawMe
|
|||
s.Subscriber = []byte(subscriberResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -189,14 +188,9 @@ func (s *FhirCoverageEligibilityRequest) PopulateAndExtractSearchParameters(reso
|
|||
s.Status = []byte(statusResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -207,14 +206,9 @@ func (s *FhirCoverageEligibilityResponse) PopulateAndExtractSearchParameters(res
|
|||
s.Status = []byte(statusResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -202,14 +201,9 @@ func (s *FhirDevice) PopulateAndExtractSearchParameters(resourceRaw json.RawMess
|
|||
s.Status = []byte(statusResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
// extracting UdiCarrier
|
||||
udiCarrierResult, err := vm.RunString("extractStringSearchParameters(fhirResource, 'Device.udiCarrier.carrierHRF')")
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -361,14 +360,9 @@ func (s *FhirDeviceRequest) PopulateAndExtractSearchParameters(resourceRaw json.
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -363,14 +362,9 @@ func (s *FhirDiagnosticReport) PopulateAndExtractSearchParameters(resourceRaw js
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -267,14 +266,9 @@ func (s *FhirDocumentManifest) PopulateAndExtractSearchParameters(resourceRaw js
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -380,14 +379,9 @@ func (s *FhirDocumentReference) PopulateAndExtractSearchParameters(resourceRaw j
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -385,14 +384,9 @@ func (s *FhirEncounter) PopulateAndExtractSearchParameters(resourceRaw json.RawM
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -181,14 +180,9 @@ func (s *FhirEndpoint) PopulateAndExtractSearchParameters(resourceRaw json.RawMe
|
|||
s.Status = []byte(statusResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -154,14 +153,9 @@ func (s *FhirEnrollmentRequest) PopulateAndExtractSearchParameters(resourceRaw j
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -154,14 +153,9 @@ func (s *FhirEnrollmentResponse) PopulateAndExtractSearchParameters(resourceRaw
|
|||
s.Status = []byte(statusResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -279,14 +278,9 @@ func (s *FhirExplanationOfBenefit) PopulateAndExtractSearchParameters(resourceRa
|
|||
s.SubdetailUdi = []byte(subdetailUdiResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -277,14 +276,9 @@ func (s *FhirFamilyMemberHistory) PopulateAndExtractSearchParameters(resourceRaw
|
|||
s.Status = []byte(statusResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -239,14 +238,9 @@ func (s *FhirGoal) PopulateAndExtractSearchParameters(resourceRaw json.RawMessag
|
|||
}
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -312,14 +311,9 @@ func (s *FhirImagingStudy) PopulateAndExtractSearchParameters(resourceRaw json.R
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -326,14 +325,9 @@ func (s *FhirImmunization) PopulateAndExtractSearchParameters(resourceRaw json.R
|
|||
s.TargetDisease = []byte(targetDiseaseResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
// extracting VaccineCode
|
||||
vaccineCodeResult, err := vm.RunString("extractTokenSearchParameters(fhirResource, 'Immunization.vaccineCode')")
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -244,14 +243,9 @@ func (s *FhirInsurancePlan) PopulateAndExtractSearchParameters(resourceRaw json.
|
|||
s.Status = []byte(statusResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -244,14 +243,9 @@ func (s *FhirLocation) PopulateAndExtractSearchParameters(resourceRaw json.RawMe
|
|||
s.Status = []byte(statusResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -229,14 +228,9 @@ func (s *FhirMedia) PopulateAndExtractSearchParameters(resourceRaw json.RawMessa
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
// extracting View
|
||||
viewResult, err := vm.RunString("extractTokenSearchParameters(fhirResource, 'Media.view')")
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -233,14 +232,9 @@ func (s *FhirMedication) PopulateAndExtractSearchParameters(resourceRaw json.Raw
|
|||
s.Status = []byte(statusResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -307,14 +306,9 @@ func (s *FhirMedicationAdministration) PopulateAndExtractSearchParameters(resour
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -302,14 +301,9 @@ func (s *FhirMedicationDispense) PopulateAndExtractSearchParameters(resourceRaw
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
// extracting Whenhandedover
|
||||
whenhandedoverResult, err := vm.RunString("extractDateSearchParameters(fhirResource, 'MedicationDispense.whenHandedOver')")
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -350,14 +349,9 @@ func (s *FhirMedicationRequest) PopulateAndExtractSearchParameters(resourceRaw j
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -289,14 +288,9 @@ func (s *FhirMedicationStatement) PopulateAndExtractSearchParameters(resourceRaw
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -282,14 +281,9 @@ func (s *FhirNutritionOrder) PopulateAndExtractSearchParameters(resourceRaw json
|
|||
s.Supplement = []byte(supplementResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -461,14 +460,9 @@ func (s *FhirObservation) PopulateAndExtractSearchParameters(resourceRaw json.Ra
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
// extracting ValueConcept
|
||||
valueConceptResult, err := vm.RunString("extractTokenSearchParameters(fhirResource, '(Observation.valueCodeableConcept)')")
|
||||
|
|
|
@ -69,4 +69,14 @@ func TestFhirObservation_ExtractSearchParameters(t *testing.T) {
|
|||
"code": "final",
|
||||
},
|
||||
}, testStatus)
|
||||
}
|
||||
|
||||
var testText []struct {
|
||||
Div string `json:"div"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
require.NoError(t, err)
|
||||
err = json.Unmarshal(json.RawMessage(observationModel.Text), &testText)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, "generated", testText[0].Status)
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -235,14 +234,9 @@ func (s *FhirOrganization) PopulateAndExtractSearchParameters(resourceRaw json.R
|
|||
s.Phonetic = []byte(phoneticResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -261,14 +260,9 @@ func (s *FhirOrganizationAffiliation) PopulateAndExtractSearchParameters(resourc
|
|||
s.Telecom = []byte(telecomResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -437,14 +436,9 @@ func (s *FhirPatient) PopulateAndExtractSearchParameters(resourceRaw json.RawMes
|
|||
s.Telecom = []byte(telecomResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -383,14 +382,9 @@ func (s *FhirPerson) PopulateAndExtractSearchParameters(resourceRaw json.RawMess
|
|||
s.Telecom = []byte(telecomResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -370,14 +369,9 @@ func (s *FhirPractitioner) PopulateAndExtractSearchParameters(resourceRaw json.R
|
|||
s.Telecom = []byte(telecomResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -276,14 +275,9 @@ func (s *FhirPractitionerRole) PopulateAndExtractSearchParameters(resourceRaw js
|
|||
s.Telecom = []byte(telecomResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -355,14 +354,9 @@ func (s *FhirProcedure) PopulateAndExtractSearchParameters(resourceRaw json.RawM
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -211,14 +210,9 @@ func (s *FhirProvenance) PopulateAndExtractSearchParameters(resourceRaw json.Raw
|
|||
s.Target = []byte(targetResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
// extracting When
|
||||
whenResult, err := vm.RunString("extractDateSearchParameters(fhirResource, '(Provenance.occurredDateTime)')")
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -281,14 +280,9 @@ func (s *FhirQuestionnaire) PopulateAndExtractSearchParameters(resourceRaw json.
|
|||
s.SubjectType = []byte(subjectTypeResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
// extracting Title
|
||||
titleResult, err := vm.RunString("extractStringSearchParameters(fhirResource, 'Questionnaire.title')")
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -225,14 +224,9 @@ func (s *FhirQuestionnaireResponse) PopulateAndExtractSearchParameters(resourceR
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -365,14 +364,9 @@ func (s *FhirRelatedPerson) PopulateAndExtractSearchParameters(resourceRaw json.
|
|||
s.Telecom = []byte(telecomResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -198,14 +197,9 @@ func (s *FhirSchedule) PopulateAndExtractSearchParameters(resourceRaw json.RawMe
|
|||
s.Specialty = []byte(specialtyResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -388,14 +387,9 @@ func (s *FhirServiceRequest) PopulateAndExtractSearchParameters(resourceRaw json
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -207,14 +206,9 @@ func (s *FhirSlot) PopulateAndExtractSearchParameters(resourceRaw json.RawMessag
|
|||
s.Status = []byte(statusResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -225,14 +224,9 @@ func (s *FhirSpecimen) PopulateAndExtractSearchParameters(resourceRaw json.RawMe
|
|||
s.Subject = []byte(subjectResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown"
|
||||
goja "github.com/dop251/goja"
|
||||
models "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
|
||||
datatypes "gorm.io/datatypes"
|
||||
|
@ -228,14 +227,9 @@ func (s *FhirVisionPrescription) PopulateAndExtractSearchParameters(resourceRaw
|
|||
s.Status = []byte(statusResult.String())
|
||||
}
|
||||
// extracting Text
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text.div')")
|
||||
textResult, err := vm.RunString("extractSimpleSearchParameters(fhirResource, 'text')")
|
||||
if err == nil && textResult.String() != "undefined" {
|
||||
s.Text = textResult.String()
|
||||
converter := htmltomarkdown.NewConverter("", true, nil)
|
||||
markdown, err := converter.ConvertString(s.Text)
|
||||
if err == nil {
|
||||
s.Text = markdown
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ func main() {
|
|||
fieldMap["Text"] = DBField{
|
||||
FieldType: "keyword",
|
||||
Description: "Text search against the narrative",
|
||||
FHIRPathExpression: "text.div",
|
||||
FHIRPathExpression: "text",
|
||||
}
|
||||
fieldMap["Type"] = DBField{
|
||||
FieldType: "special",
|
||||
|
@ -424,17 +424,18 @@ func main() {
|
|||
break
|
||||
default:
|
||||
i.Id("s").Dot(fieldName).Op("=").Id(fieldNameVar).Dot("String").Call()
|
||||
if fieldName == "Text" {
|
||||
//convert html to markdown
|
||||
i.Id("converter").Op(":=").Qual("github.com/JohannesKaufmann/html-to-markdown", "NewConverter").Call(jen.Lit(""), jen.True(), jen.Nil())
|
||||
i.List(jen.Id("markdown"), jen.Id("err")).Op(":=").Id("converter").Dot("ConvertString").Call(jen.Id("s").Dot(fieldName))
|
||||
i.If(jen.Err().Op("==").Nil()).BlockFunc(func(q *jen.Group) {
|
||||
q.Id("s").Dot(fieldName).Op("=").Id("markdown")
|
||||
})
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
//if fieldName == "Text" {
|
||||
// //convert html to markdown
|
||||
// i.Id("converter").Op(":=").Qual("github.com/JohannesKaufmann/html-to-markdown", "NewConverter").Call(jen.Lit(""), jen.True(), jen.Nil())
|
||||
// i.List(jen.Id("markdown"), jen.Id("err")).Op(":=").Id("converter").Dot("ConvertString").Call(jen.Id("s").Dot(fieldName))
|
||||
// i.If(jen.Err().Op("==").Nil()).BlockFunc(func(q *jen.Group) {
|
||||
// q.Id("s").Dot(fieldName).Op("=").Id("markdown")
|
||||
// })
|
||||
//}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
|
3
go.mod
3
go.mod
|
@ -11,7 +11,6 @@ replace github.com/mattn/go-sqlite3 v1.14.17 => github.com/jgiannuzzi/go-sqlite3
|
|||
//replace gorm.io/driver/sqlite v1.5.4 => github.com/jgiannuzzi/gorm-sqlite v1.4.4-0.20221215225833-42389ad31305
|
||||
|
||||
require (
|
||||
github.com/JohannesKaufmann/html-to-markdown v1.5.0
|
||||
github.com/analogj/go-util v0.0.0-20210417161720-39b497cca03b
|
||||
github.com/dave/jennifer v1.6.1
|
||||
github.com/dominikbraun/graph v0.15.0
|
||||
|
@ -41,8 +40,6 @@ require (
|
|||
)
|
||||
|
||||
require (
|
||||
github.com/PuerkitoBio/goquery v1.8.1 // indirect
|
||||
github.com/andybalholm/cascadia v1.3.1 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
|
||||
|
|
17
go.sum
17
go.sum
|
@ -41,17 +41,11 @@ github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJc
|
|||
github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/JohannesKaufmann/html-to-markdown v1.5.0 h1:cEAcqpxk0hUJOXEVGrgILGW76d1GpyGY7PCnAaWQyAI=
|
||||
github.com/JohannesKaufmann/html-to-markdown v1.5.0/go.mod h1:QTO/aTyEDukulzu269jY0xiHeAGsNxmuUBo2Q0hPsK8=
|
||||
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA=
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g=
|
||||
github.com/PuerkitoBio/goquery v1.8.1 h1:uQxhNlArOIdbrH1tr0UXwdVFgDcZDrZVdcpygAcwmWM=
|
||||
github.com/PuerkitoBio/goquery v1.8.1/go.mod h1:Q8ICL1kNUJ2sXGoAhPGUdYDJvgQgHzJsnnd3H7Ho5jQ=
|
||||
github.com/analogj/go-util v0.0.0-20210417161720-39b497cca03b h1:Y/+MfmdKPPpVY7C6ggt/FpltFSitlpUtyJEdcQyFXQg=
|
||||
github.com/analogj/go-util v0.0.0-20210417161720-39b497cca03b/go.mod h1:bRSzJXgXnT5+Ihah7RSC7Cvp16UmoLn3wq6ROciS1Ow=
|
||||
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
|
||||
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
|
||||
github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
|
||||
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
|
||||
github.com/bytedance/sonic v1.8.8 h1:Kj4AYbZSeENfyXicsYppYKO0K2YWab+i2UTSY7Ukz9Q=
|
||||
|
@ -371,15 +365,10 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
|
|||
github.com/samber/lo v1.35.0 h1:GlT8CV1GE+v97Y7MLF1wXvX6mjoxZ+hi61tj/ZcQwY0=
|
||||
github.com/samber/lo v1.35.0/go.mod h1:HLeWcJRRyLKp3+/XBJvOrerCQn9mhdKMHyd7IRlgeQ8=
|
||||
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||
github.com/sebdah/goldie/v2 v2.5.3 h1:9ES/mNN+HNUbNWpVAlrzuZ7jE+Nrczbj8uFRjM7624Y=
|
||||
github.com/sebdah/goldie/v2 v2.5.3/go.mod h1:oZ9fp0+se1eapSRjfYbsV/0Hqhbuu3bJVvKI/NNtssI=
|
||||
github.com/seborama/govcr v4.5.0+incompatible h1:XvdHtXi0d4cUAn+0aWolvwfS3nmhNC8Z+yMQwn/M64I=
|
||||
github.com/seborama/govcr v4.5.0+incompatible/go.mod h1:EgcISudCCYDLzbiAImJ8i7kk4+wTA44Kp+j4S0LhASI=
|
||||
github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys=
|
||||
github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs=
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
|
||||
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
|
||||
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||
|
@ -430,8 +419,6 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
|
|||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
github.com/yuin/goldmark v1.6.0 h1:boZcn2GTjpsynOsC0iJHnBWa4Bi0qzfJjthwauItG68=
|
||||
github.com/yuin/goldmark v1.6.0/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
|
@ -546,11 +533,9 @@ golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v
|
|||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
|
||||
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
|
||||
|
@ -816,7 +801,6 @@ google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs
|
|||
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
|
@ -824,7 +808,6 @@ gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:a
|
|||
gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4=
|
||||
gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
|
|
Loading…
Reference in New Issue