-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
353 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.2.2 | ||
3.3.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
OPTIONS="--defer-constraints --disable-user-triggers --no-sequences" | ||
|
||
# guaguas (54499) | ||
# sumar (36105) | ||
# mataro (86518) | ||
# alcobendas (51099) | ||
# barcelona (86160) | ||
# metro madrid (33249) | ||
# IMI (45047) | ||
|
||
# all tables | ||
pgsync $OPTIONS | ||
|
||
# Manually add new entities here | ||
entities="54499 36105 86518 51099 86160 33249 45047" | ||
|
||
for entity_id in $entities; do | ||
# tenders | ||
pgsync $OPTIONS tenders "WHERE contractor_entity_id = ${entity_id}" | ||
|
||
# contracts | ||
pgsync $OPTIONS contracts "WHERE contractor_entity_id = ${entity_id}" | ||
|
||
# documents | ||
pgsync $OPTIONS documents "WHERE documentable_type = 'Tender' and documentable_id IN (SELECT id from tenders WHERE contractor_entity_id = ${entity_id})" | ||
pgsync $OPTIONS documents "WHERE documentable_type = 'Tender' and documentable_id IN (SELECT id from tenders WHERE contractor_entity_id = ${entity_id})" | ||
done | ||
|
||
# refresh views | ||
bin/rails dbviews:refresh_search | ||
bin/rails dbviews:refresh_analysis | ||
|
||
# refresh elasticsearch | ||
bin/rails chewy:reset | ||
|
||
# refresh internal contracts | ||
bin/rails seed:update_internal_contracts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
if ! command -v foreman &> /dev/null | ||
then | ||
echo "Installing foreman..." | ||
gem install foreman | ||
fi | ||
|
||
if [[ $1 = "--sidekiq" ]] || [[ $1 = "-s" ]]; then | ||
foreman start -f Procfile_with_sidekiq.dev | ||
else | ||
foreman start -f Procfile.dev | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
require "csv" | ||
|
||
# This file dumps in a CSV the questions and answers from the database | ||
# This CSV will be used later to run the experiment (run_experiment.rb) | ||
# Where an experiment is a variation of the parameters used to generate the answer, the prompt and the weights | ||
# that needs to be measured | ||
|
||
CSV.open("base.csv", "wb") do |csv| | ||
csv << ["id", "question", "answer", "prompt", "weights"] | ||
QuestionAnswer.order(id: :asc).each do |qa| | ||
csv << [qa.id, qa.question, qa.answer, qa.prompt, qa.weights] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
curl -k -XPOST -H "Authorization: Token token="$DEPLOY_BOT_TOKEN $PRODUCTION_DEPLOY_URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# frozen_string_literal: true | ||
|
||
require "csv" | ||
|
||
# This file loads the base CSV generated in prepare_experiment.rb, and runs the experiment | ||
# updating the CSV with the new answers and prompts | ||
|
||
if ARGV.size != 1 | ||
raise "Error: the name of the experiment results file is required. It should include the .csv extension" | ||
end | ||
|
||
# Base is generated in prepare_experiment.rb with the current answers and prompts | ||
base_csv = CSV.read("base.csv", headers: true) | ||
|
||
CSV.open(ARGV[0], "wb") do |csv| | ||
csv << ["id","question", "answer", "prompt", "weights", "experiment_answer", "experiment_prompt"] | ||
base_csv.each do |row| | ||
|
||
qa = QuestionAnswer.find(row["id"]) | ||
|
||
responder = Assistant::AnswerQuestionWithOpenAI.new(qa.question) | ||
experiment_prompt, _, experiment_answer = responder.call | ||
|
||
csv << [row["id"], row["question"], row["answer"], row["prompt"], row["weights"], experiment_answer, experiment_prompt] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env ruby | ||
|
||
# This file loads spring without using Bundler, in order to be fast. | ||
# It gets overwritten when you run the `spring binstub` command. | ||
|
||
unless defined?(Spring) | ||
require 'rubygems' | ||
require 'bundler' | ||
|
||
lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) | ||
spring = lockfile.specs.detect { |spec| spec.name == "spring" } | ||
if spring | ||
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path | ||
gem 'spring', spring.version | ||
require 'spring/binstub' | ||
end | ||
end |
Oops, something went wrong.