<commit_before>-module(req_helper).
-export([get_db_name/1, get_record_key/1, get_record/1]).

get_db_name(Req) ->
	list_to_atom(bitstring_to_list(cowboy_req:binding(db_name, Req))).

get_record_key(Req) ->
	list_to_atom(bitstring_to_list(cowboy_req:binding(key, Req))).

get_record(Req) ->
	{ok, Data, _NewReq} = cowboy_req:read_body(Req),
	{FieldList} = jiffy:decode(Data),
	Dict = maps:from_list(FieldList),
	case Dict of
		#{<<"value">> := Value} -> {ok, Value};<commit_msg>Key is always string instead atom.<commit_after>-module(req_helper).
-export([get_db_name/1, get_record_key/1, get_record/1]).

get_db_name(Req) ->
	list_to_atom(bitstring_to_list(cowboy_req:binding(db_name, Req))).

get_record_key(Req) ->
	cowboy_req:binding(key, Req).

get_record(Req) ->
	{ok, Data, _NewReq} = cowboy_req:read_body(Req),
	{FieldList} = jiffy:decode(Data),
	Dict = maps:from_list(FieldList),
	case Dict of
		#{<<"value">> := Value} -> {ok, Value};
{'fraction_non_alphanumeric': 0.17902542372881355, 'fraction_numerical': 0.006355932203389831, 'mean_word_length': 6.809917355371901, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7565237', 'n_tokens_mistral': 402, 'n_tokens_neox': 400, 'n_words': 56}