diff --git a/backend/pkg/database/gorm_repository_migrations.go b/backend/pkg/database/gorm_repository_migrations.go index 6a4a6f09..9ba70006 100644 --- a/backend/pkg/database/gorm_repository_migrations.go +++ b/backend/pkg/database/gorm_repository_migrations.go @@ -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 { diff --git a/backend/pkg/database/gorm_repository_query.go b/backend/pkg/database/gorm_repository_query.go index 66195976..5197ddf0 100644 --- a/backend/pkg/database/gorm_repository_query.go +++ b/backend/pkg/database/gorm_repository_query.go @@ -17,6 +17,8 @@ import ( "gorm.io/gorm" ) +//TODO: replace functionality here with https://github.com/go-gorm/datatypes + type SearchParameterType string const ( diff --git a/backend/pkg/models/database/fhir_account.go b/backend/pkg/models/database/fhir_account.go index a3d0df03..1367e360 100644 --- a/backend/pkg/models/database/fhir_account.go +++ b/backend/pkg/models/database/fhir_account.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_adverse_event.go b/backend/pkg/models/database/fhir_adverse_event.go index 6930c097..c07d8e98 100644 --- a/backend/pkg/models/database/fhir_adverse_event.go +++ b/backend/pkg/models/database/fhir_adverse_event.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_allergy_intolerance.go b/backend/pkg/models/database/fhir_allergy_intolerance.go index 41f43f01..6e1f922d 100644 --- a/backend/pkg/models/database/fhir_allergy_intolerance.go +++ b/backend/pkg/models/database/fhir_allergy_intolerance.go @@ -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')") diff --git a/backend/pkg/models/database/fhir_appointment.go b/backend/pkg/models/database/fhir_appointment.go index 8f89f93f..43712266 100644 --- a/backend/pkg/models/database/fhir_appointment.go +++ b/backend/pkg/models/database/fhir_appointment.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_binary.go b/backend/pkg/models/database/fhir_binary.go index b2c45b7d..ca8bb93b 100644 --- a/backend/pkg/models/database/fhir_binary.go +++ b/backend/pkg/models/database/fhir_binary.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_care_plan.go b/backend/pkg/models/database/fhir_care_plan.go index 23ccf484..147ae955 100644 --- a/backend/pkg/models/database/fhir_care_plan.go +++ b/backend/pkg/models/database/fhir_care_plan.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_care_team.go b/backend/pkg/models/database/fhir_care_team.go index 21940f52..621f7ab0 100644 --- a/backend/pkg/models/database/fhir_care_team.go +++ b/backend/pkg/models/database/fhir_care_team.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_claim.go b/backend/pkg/models/database/fhir_claim.go index 3d5f38e8..5db75b89 100644 --- a/backend/pkg/models/database/fhir_claim.go +++ b/backend/pkg/models/database/fhir_claim.go @@ -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')") diff --git a/backend/pkg/models/database/fhir_claim_response.go b/backend/pkg/models/database/fhir_claim_response.go index 3d396c46..ae5cfae3 100644 --- a/backend/pkg/models/database/fhir_claim_response.go +++ b/backend/pkg/models/database/fhir_claim_response.go @@ -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')") diff --git a/backend/pkg/models/database/fhir_composition.go b/backend/pkg/models/database/fhir_composition.go index dd79d7ec..98329414 100644 --- a/backend/pkg/models/database/fhir_composition.go +++ b/backend/pkg/models/database/fhir_composition.go @@ -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')") diff --git a/backend/pkg/models/database/fhir_condition.go b/backend/pkg/models/database/fhir_condition.go index ffbdaca2..12a01068 100644 --- a/backend/pkg/models/database/fhir_condition.go +++ b/backend/pkg/models/database/fhir_condition.go @@ -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')") diff --git a/backend/pkg/models/database/fhir_consent.go b/backend/pkg/models/database/fhir_consent.go index 1e6e2278..9136b58c 100644 --- a/backend/pkg/models/database/fhir_consent.go +++ b/backend/pkg/models/database/fhir_consent.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_coverage.go b/backend/pkg/models/database/fhir_coverage.go index 1eb4f460..2cf3d493 100644 --- a/backend/pkg/models/database/fhir_coverage.go +++ b/backend/pkg/models/database/fhir_coverage.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_coverage_eligibility_request.go b/backend/pkg/models/database/fhir_coverage_eligibility_request.go index afada40a..2e52f702 100644 --- a/backend/pkg/models/database/fhir_coverage_eligibility_request.go +++ b/backend/pkg/models/database/fhir_coverage_eligibility_request.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_coverage_eligibility_response.go b/backend/pkg/models/database/fhir_coverage_eligibility_response.go index f0f87194..afb6dcbe 100644 --- a/backend/pkg/models/database/fhir_coverage_eligibility_response.go +++ b/backend/pkg/models/database/fhir_coverage_eligibility_response.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_device.go b/backend/pkg/models/database/fhir_device.go index 773807fd..f765bb05 100644 --- a/backend/pkg/models/database/fhir_device.go +++ b/backend/pkg/models/database/fhir_device.go @@ -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')") diff --git a/backend/pkg/models/database/fhir_device_request.go b/backend/pkg/models/database/fhir_device_request.go index 027fbda6..0633c5cf 100644 --- a/backend/pkg/models/database/fhir_device_request.go +++ b/backend/pkg/models/database/fhir_device_request.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_diagnostic_report.go b/backend/pkg/models/database/fhir_diagnostic_report.go index 08517833..36fee357 100644 --- a/backend/pkg/models/database/fhir_diagnostic_report.go +++ b/backend/pkg/models/database/fhir_diagnostic_report.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_document_manifest.go b/backend/pkg/models/database/fhir_document_manifest.go index 91c666b8..92ae48fa 100644 --- a/backend/pkg/models/database/fhir_document_manifest.go +++ b/backend/pkg/models/database/fhir_document_manifest.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_document_reference.go b/backend/pkg/models/database/fhir_document_reference.go index c9f63843..a9f9e42f 100644 --- a/backend/pkg/models/database/fhir_document_reference.go +++ b/backend/pkg/models/database/fhir_document_reference.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_encounter.go b/backend/pkg/models/database/fhir_encounter.go index 198765c4..430202af 100644 --- a/backend/pkg/models/database/fhir_encounter.go +++ b/backend/pkg/models/database/fhir_encounter.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_endpoint.go b/backend/pkg/models/database/fhir_endpoint.go index 7725fe12..37295114 100644 --- a/backend/pkg/models/database/fhir_endpoint.go +++ b/backend/pkg/models/database/fhir_endpoint.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_enrollment_request.go b/backend/pkg/models/database/fhir_enrollment_request.go index c3202431..36aa152b 100644 --- a/backend/pkg/models/database/fhir_enrollment_request.go +++ b/backend/pkg/models/database/fhir_enrollment_request.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_enrollment_response.go b/backend/pkg/models/database/fhir_enrollment_response.go index 0586070d..1aae1f25 100644 --- a/backend/pkg/models/database/fhir_enrollment_response.go +++ b/backend/pkg/models/database/fhir_enrollment_response.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_explanation_of_benefit.go b/backend/pkg/models/database/fhir_explanation_of_benefit.go index 2fe09056..a4a0c23d 100644 --- a/backend/pkg/models/database/fhir_explanation_of_benefit.go +++ b/backend/pkg/models/database/fhir_explanation_of_benefit.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_family_member_history.go b/backend/pkg/models/database/fhir_family_member_history.go index b3eb50f3..fe2a17bf 100644 --- a/backend/pkg/models/database/fhir_family_member_history.go +++ b/backend/pkg/models/database/fhir_family_member_history.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_goal.go b/backend/pkg/models/database/fhir_goal.go index bfe6328a..e01165f6 100644 --- a/backend/pkg/models/database/fhir_goal.go +++ b/backend/pkg/models/database/fhir_goal.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_imaging_study.go b/backend/pkg/models/database/fhir_imaging_study.go index 5cff30f2..b2127e35 100644 --- a/backend/pkg/models/database/fhir_imaging_study.go +++ b/backend/pkg/models/database/fhir_imaging_study.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_immunization.go b/backend/pkg/models/database/fhir_immunization.go index 6194a6d3..3e449499 100644 --- a/backend/pkg/models/database/fhir_immunization.go +++ b/backend/pkg/models/database/fhir_immunization.go @@ -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')") diff --git a/backend/pkg/models/database/fhir_insurance_plan.go b/backend/pkg/models/database/fhir_insurance_plan.go index febc37e2..ad21de1a 100644 --- a/backend/pkg/models/database/fhir_insurance_plan.go +++ b/backend/pkg/models/database/fhir_insurance_plan.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_location.go b/backend/pkg/models/database/fhir_location.go index 86aa3cbb..b3d78a22 100644 --- a/backend/pkg/models/database/fhir_location.go +++ b/backend/pkg/models/database/fhir_location.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_media.go b/backend/pkg/models/database/fhir_media.go index 2376e4b6..378d32a5 100644 --- a/backend/pkg/models/database/fhir_media.go +++ b/backend/pkg/models/database/fhir_media.go @@ -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')") diff --git a/backend/pkg/models/database/fhir_medication.go b/backend/pkg/models/database/fhir_medication.go index 2028132d..78d8914f 100644 --- a/backend/pkg/models/database/fhir_medication.go +++ b/backend/pkg/models/database/fhir_medication.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_medication_administration.go b/backend/pkg/models/database/fhir_medication_administration.go index 17939018..d9534b8c 100644 --- a/backend/pkg/models/database/fhir_medication_administration.go +++ b/backend/pkg/models/database/fhir_medication_administration.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_medication_dispense.go b/backend/pkg/models/database/fhir_medication_dispense.go index e4381e53..7cf72bf3 100644 --- a/backend/pkg/models/database/fhir_medication_dispense.go +++ b/backend/pkg/models/database/fhir_medication_dispense.go @@ -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')") diff --git a/backend/pkg/models/database/fhir_medication_request.go b/backend/pkg/models/database/fhir_medication_request.go index 3f891e1d..9be6515a 100644 --- a/backend/pkg/models/database/fhir_medication_request.go +++ b/backend/pkg/models/database/fhir_medication_request.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_medication_statement.go b/backend/pkg/models/database/fhir_medication_statement.go index 0f0ea8e5..54dc931c 100644 --- a/backend/pkg/models/database/fhir_medication_statement.go +++ b/backend/pkg/models/database/fhir_medication_statement.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_nutrition_order.go b/backend/pkg/models/database/fhir_nutrition_order.go index a058531b..20cd82fa 100644 --- a/backend/pkg/models/database/fhir_nutrition_order.go +++ b/backend/pkg/models/database/fhir_nutrition_order.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_observation.go b/backend/pkg/models/database/fhir_observation.go index 4881b521..61afb41e 100644 --- a/backend/pkg/models/database/fhir_observation.go +++ b/backend/pkg/models/database/fhir_observation.go @@ -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)')") diff --git a/backend/pkg/models/database/fhir_observation_test.go b/backend/pkg/models/database/fhir_observation_test.go index 57d9b1a0..f3c85145 100644 --- a/backend/pkg/models/database/fhir_observation_test.go +++ b/backend/pkg/models/database/fhir_observation_test.go @@ -69,4 +69,14 @@ func TestFhirObservation_ExtractSearchParameters(t *testing.T) { "code": "final", }, }, testStatus) -} \ No newline at end of file + + 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) +} diff --git a/backend/pkg/models/database/fhir_organization.go b/backend/pkg/models/database/fhir_organization.go index 1840a8bb..990dde24 100644 --- a/backend/pkg/models/database/fhir_organization.go +++ b/backend/pkg/models/database/fhir_organization.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_organization_affiliation.go b/backend/pkg/models/database/fhir_organization_affiliation.go index 9536f925..095dfcf3 100644 --- a/backend/pkg/models/database/fhir_organization_affiliation.go +++ b/backend/pkg/models/database/fhir_organization_affiliation.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_patient.go b/backend/pkg/models/database/fhir_patient.go index 4eff01cd..71ceb6b5 100644 --- a/backend/pkg/models/database/fhir_patient.go +++ b/backend/pkg/models/database/fhir_patient.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_person.go b/backend/pkg/models/database/fhir_person.go index 3a62a88e..f41d335f 100644 --- a/backend/pkg/models/database/fhir_person.go +++ b/backend/pkg/models/database/fhir_person.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_practitioner.go b/backend/pkg/models/database/fhir_practitioner.go index dd87018d..46540dbf 100644 --- a/backend/pkg/models/database/fhir_practitioner.go +++ b/backend/pkg/models/database/fhir_practitioner.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_practitioner_role.go b/backend/pkg/models/database/fhir_practitioner_role.go index b38f5108..703a43fb 100644 --- a/backend/pkg/models/database/fhir_practitioner_role.go +++ b/backend/pkg/models/database/fhir_practitioner_role.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_procedure.go b/backend/pkg/models/database/fhir_procedure.go index 3565c5ca..09774e84 100644 --- a/backend/pkg/models/database/fhir_procedure.go +++ b/backend/pkg/models/database/fhir_procedure.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_provenance.go b/backend/pkg/models/database/fhir_provenance.go index 1cbd7b01..ea9a3a6c 100644 --- a/backend/pkg/models/database/fhir_provenance.go +++ b/backend/pkg/models/database/fhir_provenance.go @@ -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)')") diff --git a/backend/pkg/models/database/fhir_questionnaire.go b/backend/pkg/models/database/fhir_questionnaire.go index 868c12a8..0cb652fe 100644 --- a/backend/pkg/models/database/fhir_questionnaire.go +++ b/backend/pkg/models/database/fhir_questionnaire.go @@ -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')") diff --git a/backend/pkg/models/database/fhir_questionnaire_response.go b/backend/pkg/models/database/fhir_questionnaire_response.go index 2f5d1b43..9b3fa91c 100644 --- a/backend/pkg/models/database/fhir_questionnaire_response.go +++ b/backend/pkg/models/database/fhir_questionnaire_response.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_related_person.go b/backend/pkg/models/database/fhir_related_person.go index ff675f9d..ade88f29 100644 --- a/backend/pkg/models/database/fhir_related_person.go +++ b/backend/pkg/models/database/fhir_related_person.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_schedule.go b/backend/pkg/models/database/fhir_schedule.go index 9dac32bd..fd7b4560 100644 --- a/backend/pkg/models/database/fhir_schedule.go +++ b/backend/pkg/models/database/fhir_schedule.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_service_request.go b/backend/pkg/models/database/fhir_service_request.go index 1a4a2699..535d4628 100644 --- a/backend/pkg/models/database/fhir_service_request.go +++ b/backend/pkg/models/database/fhir_service_request.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_slot.go b/backend/pkg/models/database/fhir_slot.go index 99edc684..4d5701b6 100644 --- a/backend/pkg/models/database/fhir_slot.go +++ b/backend/pkg/models/database/fhir_slot.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_specimen.go b/backend/pkg/models/database/fhir_specimen.go index 2d6057c7..992aca68 100644 --- a/backend/pkg/models/database/fhir_specimen.go +++ b/backend/pkg/models/database/fhir_specimen.go @@ -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 } diff --git a/backend/pkg/models/database/fhir_vision_prescription.go b/backend/pkg/models/database/fhir_vision_prescription.go index 83078e57..902578eb 100644 --- a/backend/pkg/models/database/fhir_vision_prescription.go +++ b/backend/pkg/models/database/fhir_vision_prescription.go @@ -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 } diff --git a/backend/pkg/models/database/generate.go b/backend/pkg/models/database/generate.go index 04f60bdf..17b3f5bc 100644 --- a/backend/pkg/models/database/generate.go +++ b/backend/pkg/models/database/generate.go @@ -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") + // }) + //} + }) } diff --git a/go.mod b/go.mod index 9ed14fa4..09289e41 100644 --- a/go.mod +++ b/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 diff --git a/go.sum b/go.sum index 152ba002..1a5552a1 100644 --- a/go.sum +++ b/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=