<commit_before>package brands

import (
	"encoding/json"
	"net/http"
	"regexp"
	"strings"
	"time"

	"fmt"
	fthealth "github.com/Financial-Times/go-fthealth/v1_1"
	"github.com/Financial-Times/go-logger"
	"github.com/Financial-Times/neo-model-utils-go/mapper"
	"github.com/Financial-Times/service-status-go/gtg"
	"github.com/Financial-Times/transactionid-utils-go"
	"github.com/gorilla/handlers"
	"github.com/gorilla/mux"
	log "github.com/sirupsen/logrus"
	"io/ioutil"
)

// BrandsDriver for cypher queries
var BrandsDriver Driver

// CacheControlHeader is the value to set on http header
var CacheControlHeader string

type httpClient interface {
	Do(req *http.Request) (resp *http.Response, err error)
}

const (
	validUUID     = "([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"
	thingsApiUrl  = "http://api.ft.com/things/"
	ftThing       = "http://www.ft.com/thing/"
	brandOntology = "http://www.ft.com/ontology/product/Brand"
	queryParams   = "?showRelationship=broader&showRelationship=narrower"
)

type BrandsHandler struct {
	client      httpClient
	conceptsURL string
}

func NewHandler(client httpClient, conceptsURL string) BrandsHandler {
	return BrandsHandler{
		client:      client,
		conceptsURL: conceptsURL,
	}
}

// HealthCheck lightly tests this applications dependencies and returns the results in FT standard format.
func (h *BrandsHandler) HealthCheck() fthealth.TimedHealthCheck {
	return fthealth.TimedHealthCheck{
		HealthCheck: fthealth.HealthCheck{
			Name:        "Public Brands API",
			SystemCode:  "public-brands-api",<commit_msg>Fix brands query<commit_after>package brands

import (
	"encoding/json"
	"net/http"
	"regexp"
	"strings"
	"time"

	"fmt"
	fthealth "github.com/Financial-Times/go-fthealth/v1_1"
	"github.com/Financial-Times/go-logger"
	"github.com/Financial-Times/neo-model-utils-go/mapper"
	"github.com/Financial-Times/service-status-go/gtg"
	"github.com/Financial-Times/transactionid-utils-go"
	"github.com/gorilla/handlers"
	"github.com/gorilla/mux"
	log "github.com/sirupsen/logrus"
	"io/ioutil"
)

// BrandsDriver for cypher queries
var BrandsDriver Driver

// CacheControlHeader is the value to set on http header
var CacheControlHeader string

type httpClient interface {
	Do(req *http.Request) (resp *http.Response, err error)
}

const (
	validUUID     = "([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"
	thingsApiUrl  = "http://api.ft.com/things/"
	ftThing       = "http://www.ft.com/thing/"
	brandOntology = "http://www.ft.com/ontology/product/Brand"
	queryParams   = "?showRelationship=broaderTransitive&showRelationship=narrower"
)

type BrandsHandler struct {
	client      httpClient
	conceptsURL string
}

func NewHandler(client httpClient, conceptsURL string) BrandsHandler {
	return BrandsHandler{
		client:      client,
		conceptsURL: conceptsURL,
	}
}

// HealthCheck lightly tests this applications dependencies and returns the results in FT standard format.
func (h *BrandsHandler) HealthCheck() fthealth.TimedHealthCheck {
	return fthealth.TimedHealthCheck{
		HealthCheck: fthealth.HealthCheck{
			Name:        "Public Brands API",
			SystemCode:  "public-brands-api",
{'fraction_non_alphanumeric': 0.13592233009708737, 'fraction_numerical': 0.011274663326025681, 'mean_word_length': 4.296849087893864, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4074287', 'n_tokens_mistral': 1209, 'n_tokens_neox': 1170, 'n_words': 215}