Example #1
0
 def resolve_aggregations(self,
                          info,
                          filters=None,
                          aggregations_filter_themselves=None):
     all_files = [data.get_file(file_id) for file_id in self.hits]
     filtered_files = utilities.filter_hits(all_files, filters, "files")
     return data.get_file_aggregations(filtered_files)
Example #2
0
 def resolve_aggregations(self,
                          info,
                          filters=None,
                          aggregations_filter_themselves=None):
     all_cases = [data.get_case(case_id) for case_id in self.hits]
     filtered_cases = utilities.filter_hits(all_cases, filters, "cases")
     case_aggregations = data.get_case_aggregations(filtered_cases)
     return case_aggregations
Example #3
0
 def resolve_aggregations(self,
                          info,
                          filters=None,
                          aggregations_filter_themselves=None):
     projects = data.get_current_projects()
     filtered_projects = utilities.filter_hits(projects, filters,
                                               "projects")
     project_aggregations = data.get_project_aggregations(filtered_projects)
     return project_aggregations
Example #4
0
 def resolve_hits(self,
                  info,
                  first=None,
                  offset=None,
                  sort=None,
                  filters=None):
     projects = data.get_current_projects()
     filtered_projects = utilities.filter_hits(projects, filters,
                                               "projects")
     return filtered_projects
Example #5
0
 def resolve_hits(self,
                  info,
                  first=None,
                  score=None,
                  offset=None,
                  sort=None,
                  filters=None):
     all_cases = [data.get_case(case_id) for case_id in self.hits]
     filtered_cases = utilities.filter_hits(all_cases, filters, "cases")
     sorted_cases = utilities.sort_hits(filtered_cases, sort)
     return sorted_cases
from sqlalchemy import create_engine
from charlie.models.charlie_classes import AmountString
from charlie.settings import Settings
from sqlalchemy.orm import sessionmaker
'''setup database connection'''
connection_string = Settings().connection_string
engine = create_engine(connection_string)
Session = sessionmaker(bind=engine)
Session.configure(bind=engine)
session = Session()

data_file = "".join([p for p in open("parsed.json")])

hits = re.findall("{[^}]+}", data_file)

hits = filter_hits(hits, 'agreement_amount')

output = []

for h in hits:
    output.append((h['id'], h['original'], h['agreement_amount']))

ids = [o[0] for o in output]

counter = Counter(ids)

to_check_with_human = []
to_retrain = []

for c in counter.keys():
    if int(counter[c]) == 1:
Example #7
0
def color_me_red(input_text, color_this):
    return input_text.replace(color_this, Fore.RED + color_this + Fore.RESET)


def write_new(line):
    with open('corrected.csv', 'a') as csvfile:
        spamwriter = csv.writer(csvfile,
                                delimiter=',',
                                quotechar='"',
                                quoting=csv.QUOTE_MINIMAL)
        spamwriter.writerow([line])


data_file = "".join([p for p in open("parsed.json")])

hits = re.findall("{[^}]+}", data_file)

hits = filter_hits(hits, tag_to_check)

counter = 0

for h in hits:
    counter += 1
    print str(counter) + " of " + str(len(hits))
    print "{} | {}".format(
        color_me_red(h[tag_to_check][0], h[tag_to_check][0]),
        color_me_red(h['original'].strip(), h[tag_to_check][0]))
    var = raw_input("Correct (c) or Not (n)?")
    if var == "n":
        write_new(h['original'])