File size: 24,691 Bytes
c7f4bd0
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
{"nwo":"COVID-19-electronic-health-system\/Corona-tracker","sha":"80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c","path":"src\/python\/pull_gsheets_translations_mvp.py","language":"python","identifier":"depunctuate","parameters":"(text)","argument_list":"","return_statement":"return text","docstring":"Removes punctuation from text.\n\n\tArguments:\n\t\ttext {[string]} -- [any string]\n\n\tReturns:\n\t\t[string] -- [string with punctuation removed]","docstring_summary":"Removes punctuation from text.","docstring_tokens":["Removes","punctuation","from","text","."],"function":"def depunctuate(text):\n\t\"\"\" Removes punctuation from text.\n\n\tArguments:\n\t\ttext {[string]} -- [any string]\n\n\tReturns:\n\t\t[string] -- [string with punctuation removed]\n\t\"\"\"\n\tchars = punctuation\n\tfor c in chars:\n\t\ttext = text.replace(c, \"\")\n\treturn text","function_tokens":["def","depunctuate","(","text",")",":","chars","=","punctuation","for","c","in","chars",":","text","=","text",".","replace","(","c",",","\"\"",")","return","text"],"url":"https:\/\/github.com\/COVID-19-electronic-health-system\/Corona-tracker\/blob\/80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c\/src\/python\/pull_gsheets_translations_mvp.py#L50-L62"}
{"nwo":"COVID-19-electronic-health-system\/Corona-tracker","sha":"80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c","path":"src\/python\/pull_gsheets_translations_mvp.py","language":"python","identifier":"convert_to_camelCase","parameters":"(value)","argument_list":"","return_statement":"","docstring":"Converts a string to camelCase and removes punctuation.\n\n\tArguments:\n\t\tvalue {[string]} -- [string from the 'value' column in language_df]\n\n\tReturns:\n\t\t[string] -- [returns a string with no punctuation, in camelCase format.]","docstring_summary":"Converts a string to camelCase and removes punctuation.","docstring_tokens":["Converts","a","string","to","camelCase","and","removes","punctuation","."],"function":"def convert_to_camelCase(value):\n\t\"\"\" Converts a string to camelCase and removes punctuation.\n\n\tArguments:\n\t\tvalue {[string]} -- [string from the 'value' column in language_df]\n\n\tReturns:\n\t\t[string] -- [returns a string with no punctuation, in camelCase format.]\n\t\"\"\"\n\t# if value is a string with more than one word\n\tif len(value.split()) > 1:\n\t\t#converts value to camelCase\n\t\tcamelCase = value.split()[0].lower() + \" \".join(value.split()[1:]).title().replace(\" \",\"\")\n\t\t#removes punctuation\n\t\treturn camelCase.translate(str.maketrans('', '', punctuation))\n\telse:\n\t\treturn value.lower().translate(str.maketrans('', '', punctuation))","function_tokens":["def","convert_to_camelCase","(","value",")",":","# if value is a string with more than one word","if","len","(","value",".","split","(",")",")",">","1",":","#converts value to camelCase","camelCase","=","value",".","split","(",")","[","0","]",".","lower","(",")","+","\" \"",".","join","(","value",".","split","(",")","[","1",":","]",")",".","title","(",")",".","replace","(","\" \"",",","\"\"",")","#removes punctuation","return","camelCase",".","translate","(","str",".","maketrans","(","''",",","''",",","punctuation",")",")","else",":","return","value",".","lower","(",")",".","translate","(","str",".","maketrans","(","''",",","''",",","punctuation",")",")"],"url":"https:\/\/github.com\/COVID-19-electronic-health-system\/Corona-tracker\/blob\/80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c\/src\/python\/pull_gsheets_translations_mvp.py#L64-L80"}
{"nwo":"COVID-19-electronic-health-system\/Corona-tracker","sha":"80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c","path":"src\/python\/pull_gsheets_translations_mvp.py","language":"python","identifier":"education_value_cleaner","parameters":"(language_df)","argument_list":"","return_statement":"return Series(lst_new,index=language_df.index)","docstring":"Converts the long text in the Education 'value' column to shorter text to be used as JSON keys.\n\n\tArguments:\n\t\tlanguage_df {[Series]} -- [A pandas series containing the 'value' column from the 'Education' sheet ]\n\n\tReturns:\n\t\t[Series] -- [A pandas Series with shortened text and no punctuation.]","docstring_summary":"Converts the long text in the Education 'value' column to shorter text to be used as JSON keys.","docstring_tokens":["Converts","the","long","text","in","the","Education","value","column","to","shorter","text","to","be","used","as","JSON","keys","."],"function":"def education_value_cleaner(language_df):\n\t\"\"\" Converts the long text in the Education 'value' column to shorter text to be used as JSON keys.\n\n\tArguments:\n\t\tlanguage_df {[Series]} -- [A pandas series containing the 'value' column from the 'Education' sheet ]\n\n\tReturns:\n\t\t[Series] -- [A pandas Series with shortened text and no punctuation.]\n\t\"\"\"\n\tlst = [word_tokenize(x) for x in language_df.value.tolist()]\n\t#http:\/\/www.nltk.org\/book_1ed\/ch05.html\n\tpos_tagged = [pos_tag(x) for x in lst]\n\tlst_new=[]\n\tfor pt in pos_tagged:\n\t\t#choose nouns in sentence\n\t\tnouns = [depunctuate(x[0]) for x in pt if \"NN\" in x[1]]\n\t\t#choose verbs in setence\n\t\tverbs = [depunctuate(x[0]) for x in pt if 'VB' in x[1]]\n\t\t#make fieldKey and add to new list of fieldKeys\n\t\tif len(verbs)==0 and len(nouns)==2:\n\t\t\tlst_new.append(nouns[0].lower() + nouns[1].title())\n\t\telif len(verbs)==1 and len(nouns)==1:\n\t\t\tlst_new.append(nouns[0].lower() + verbs[0].title())\n\t\telse:\n\t\t\tlst_new.append(nouns[0].lower() + nouns[1].title() + verbs[0].title())\n\treturn Series(lst_new,index=language_df.index)","function_tokens":["def","education_value_cleaner","(","language_df",")",":","lst","=","[","word_tokenize","(","x",")","for","x","in","language_df",".","value",".","tolist","(",")","]","#http:\/\/www.nltk.org\/book_1ed\/ch05.html","pos_tagged","=","[","pos_tag","(","x",")","for","x","in","lst","]","lst_new","=","[","]","for","pt","in","pos_tagged",":","#choose nouns in sentence","nouns","=","[","depunctuate","(","x","[","0","]",")","for","x","in","pt","if","\"NN\"","in","x","[","1","]","]","#choose verbs in setence","verbs","=","[","depunctuate","(","x","[","0","]",")","for","x","in","pt","if","'VB'","in","x","[","1","]","]","#make fieldKey and add to new list of fieldKeys","if","len","(","verbs",")","==","0","and","len","(","nouns",")","==","2",":","lst_new",".","append","(","nouns","[","0","]",".","lower","(",")","+","nouns","[","1","]",".","title","(",")",")","elif","len","(","verbs",")","==","1","and","len","(","nouns",")","==","1",":","lst_new",".","append","(","nouns","[","0","]",".","lower","(",")","+","verbs","[","0","]",".","title","(",")",")","else",":","lst_new",".","append","(","nouns","[","0","]",".","lower","(",")","+","nouns","[","1","]",".","title","(",")","+","verbs","[","0","]",".","title","(",")",")","return","Series","(","lst_new",",","index","=","language_df",".","index",")"],"url":"https:\/\/github.com\/COVID-19-electronic-health-system\/Corona-tracker\/blob\/80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c\/src\/python\/pull_gsheets_translations_mvp.py#L82-L107"}
{"nwo":"COVID-19-electronic-health-system\/Corona-tracker","sha":"80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c","path":"src\/python\/pull_gsheets_translations_mvp.py","language":"python","identifier":"survey_value_cleaner","parameters":"(language_df)","argument_list":"","return_statement":"return DataFrame(rows_added,columns=language_df.columns)","docstring":"Converts the long text found within the 'Survey' sheets to shorter text to be used as JSON keys.\n\n\tArguments:\n\t\tlanguage_df {[DataFrame]} -- [A pandas DataFrame containing the information from the 'Survey' sheet.]\n\n\tReturns:\n\t\t[DataFrame] -- [Returns a new DataFrame with shortended text and no punctuation.]","docstring_summary":"Converts the long text found within the 'Survey' sheets to shorter text to be used as JSON keys.","docstring_tokens":["Converts","the","long","text","found","within","the","Survey","sheets","to","shorter","text","to","be","used","as","JSON","keys","."],"function":"def survey_value_cleaner(language_df):\n\t\"\"\" Converts the long text found within the 'Survey' sheets to shorter text to be used as JSON keys.\n\n\tArguments:\n\t\tlanguage_df {[DataFrame]} -- [A pandas DataFrame containing the information from the 'Survey' sheet.]\n\n\tReturns:\n\t\t[DataFrame] -- [Returns a new DataFrame with shortended text and no punctuation.]\n\t\"\"\"\n\tvPA_col = [i for i,x in enumerate(language_df.columns) if x=='valuePossibleAnswers'][0]\n\ttVPA_col = [i for i,x in enumerate(language_df.columns) if x=='translatedValuePossibleAnswers'][0]\n\tv_col = [i for i,x in enumerate(language_df.columns) if x=='value'][0]\n\ttV_col = [i for i,x in enumerate(language_df.columns) if x=='translatedValue'][0]\n\trows = language_df.values.tolist()\n\trows_added = []\n\tfor i,row in enumerate(rows):\n\t\torig_row = row.copy()\n\t\torig_row[v_col] = convert_to_camelCase(orig_row[v_col])\n\t\trows_added.append(orig_row)\n\t\tarr = row[vPA_col].split(';')\n\t\ttarr = row[tVPA_col].split(';')\n\t\tif len(arr)==len(tarr) and len(arr)>3:\n\t\t\tfor j,_ in enumerate(arr):\n\t\t\t\trow_new = row.copy()\n\t\t\t\trow_new[v_col] = arr[j].replace('\\n','')\n\t\t\t\trow_new[v_col] = convert_to_camelCase(row_new[v_col]).replace(\" \",\"\")\n\t\t\t\t#.replace(' ','').translate(str.maketrans('', '', punctuation))\n\t\t\t\trow_new[tV_col] = tarr[j].replace('\\n','')\n\t\t\t\t#.replace(' ','').translate(str.maketrans('', '', punctuation))\n\t\t\t\trows_added.append(row_new)\n\treturn DataFrame(rows_added,columns=language_df.columns)","function_tokens":["def","survey_value_cleaner","(","language_df",")",":","vPA_col","=","[","i","for","i",",","x","in","enumerate","(","language_df",".","columns",")","if","x","==","'valuePossibleAnswers'","]","[","0","]","tVPA_col","=","[","i","for","i",",","x","in","enumerate","(","language_df",".","columns",")","if","x","==","'translatedValuePossibleAnswers'","]","[","0","]","v_col","=","[","i","for","i",",","x","in","enumerate","(","language_df",".","columns",")","if","x","==","'value'","]","[","0","]","tV_col","=","[","i","for","i",",","x","in","enumerate","(","language_df",".","columns",")","if","x","==","'translatedValue'","]","[","0","]","rows","=","language_df",".","values",".","tolist","(",")","rows_added","=","[","]","for","i",",","row","in","enumerate","(","rows",")",":","orig_row","=","row",".","copy","(",")","orig_row","[","v_col","]","=","convert_to_camelCase","(","orig_row","[","v_col","]",")","rows_added",".","append","(","orig_row",")","arr","=","row","[","vPA_col","]",".","split","(","';'",")","tarr","=","row","[","tVPA_col","]",".","split","(","';'",")","if","len","(","arr",")","==","len","(","tarr",")","and","len","(","arr",")",">","3",":","for","j",",","_","in","enumerate","(","arr",")",":","row_new","=","row",".","copy","(",")","row_new","[","v_col","]","=","arr","[","j","]",".","replace","(","'\\n'",",","''",")","row_new","[","v_col","]","=","convert_to_camelCase","(","row_new","[","v_col","]",")",".","replace","(","\" \"",",","\"\"",")","#.replace(' ','').translate(str.maketrans('', '', punctuation))","row_new","[","tV_col","]","=","tarr","[","j","]",".","replace","(","'\\n'",",","''",")","#.replace(' ','').translate(str.maketrans('', '', punctuation))","rows_added",".","append","(","row_new",")","return","DataFrame","(","rows_added",",","columns","=","language_df",".","columns",")"],"url":"https:\/\/github.com\/COVID-19-electronic-health-system\/Corona-tracker\/blob\/80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c\/src\/python\/pull_gsheets_translations_mvp.py#L109-L139"}
{"nwo":"COVID-19-electronic-health-system\/Corona-tracker","sha":"80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c","path":"src\/python\/pull_gsheets_translations_mvp.py","language":"python","identifier":"convert_worksheet_to_df","parameters":"(wk)","argument_list":"","return_statement":"return language_df","docstring":"Converts current worksheet into a pandas dataframe.\n\n\tArguments:\n\t\twk {[worksheet object]} -- [Current language worksheet being iterated over.]\n\n\tReturns:\n\t\t[DataFrame] -- [A pandas dataframe containing the information from the current worksheet with a cleaned 'parentKey' column.]","docstring_summary":"Converts current worksheet into a pandas dataframe.","docstring_tokens":["Converts","current","worksheet","into","a","pandas","dataframe","."],"function":"def convert_worksheet_to_df(wk):\n\t\"\"\"Converts current worksheet into a pandas dataframe.\n\n\tArguments:\n\t\twk {[worksheet object]} -- [Current language worksheet being iterated over.]\n\n\tReturns:\n\t\t[DataFrame] -- [A pandas dataframe containing the information from the current worksheet with a cleaned 'parentKey' column.]\n\t\"\"\"\n\tlanguage_lists = wk.get_all_values()\n\tlanguage_df = DataFrame(language_lists[1:],columns=language_lists[0])\n\tlanguage_df = language_df[language_df['parentKey']!='']\n\treturn language_df","function_tokens":["def","convert_worksheet_to_df","(","wk",")",":","language_lists","=","wk",".","get_all_values","(",")","language_df","=","DataFrame","(","language_lists","[","1",":","]",",","columns","=","language_lists","[","0","]",")","language_df","=","language_df","[","language_df","[","'parentKey'","]","!=","''","]","return","language_df"],"url":"https:\/\/github.com\/COVID-19-electronic-health-system\/Corona-tracker\/blob\/80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c\/src\/python\/pull_gsheets_translations_mvp.py#L141-L153"}
{"nwo":"COVID-19-electronic-health-system\/Corona-tracker","sha":"80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c","path":"src\/python\/pull_gsheets_translations_mvp.py","language":"python","identifier":"clean_dataframe_column_values_to_short_JSON_keys","parameters":"(wk,df)","argument_list":"","return_statement":"return df[['parentKey','fieldKey','childKey','value','translatedValue']]","docstring":"Cleans the current language dataframe columns into short JSON keys, depending on the type of worksheet.\n\n\tArguments:\n\t\twk {[worksheet object]} -- [Current worksheet being iterated over.]\n\t\tdf {[DataFrame]} -- [The current language dataframe.]\n\n\tReturns:\n\t\t[DataFrame] -- [A cleaned dataframe with the necessary columns for the JSON key:value pairs.]","docstring_summary":"Cleans the current language dataframe columns into short JSON keys, depending on the type of worksheet.","docstring_tokens":["Cleans","the","current","language","dataframe","columns","into","short","JSON","keys","depending","on","the","type","of","worksheet","."],"function":"def clean_dataframe_column_values_to_short_JSON_keys(wk,df):\n\t\"\"\" Cleans the current language dataframe columns into short JSON keys, depending on the type of worksheet.\n\n\tArguments:\n\t\twk {[worksheet object]} -- [Current worksheet being iterated over.]\n\t\tdf {[DataFrame]} -- [The current language dataframe.]\n\n\tReturns:\n\t\t[DataFrame] -- [A cleaned dataframe with the necessary columns for the JSON key:value pairs.]\n\t\"\"\"\n\tif 'Education' in wk.title:\n\t\tdf.value = education_value_cleaner(df)\n\telif 'Survey' in wk.title:\n\t\tosLanguage_df = df\n\t\tdf = survey_value_cleaner(df)\n\telse:\n\t\tdf['value'] = df['value'].apply(convert_to_camelCase)\n\t\n\treturn df[['parentKey','fieldKey','childKey','value','translatedValue']]","function_tokens":["def","clean_dataframe_column_values_to_short_JSON_keys","(","wk",",","df",")",":","if","'Education'","in","wk",".","title",":","df",".","value","=","education_value_cleaner","(","df",")","elif","'Survey'","in","wk",".","title",":","osLanguage_df","=","df","df","=","survey_value_cleaner","(","df",")","else",":","df","[","'value'","]","=","df","[","'value'","]",".","apply","(","convert_to_camelCase",")","return","df","[","[","'parentKey'",",","'fieldKey'",",","'childKey'",",","'value'",",","'translatedValue'","]","]"],"url":"https:\/\/github.com\/COVID-19-electronic-health-system\/Corona-tracker\/blob\/80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c\/src\/python\/pull_gsheets_translations_mvp.py#L155-L173"}
{"nwo":"COVID-19-electronic-health-system\/Corona-tracker","sha":"80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c","path":"src\/python\/pull_gsheets_translations_mvp.py","language":"python","identifier":"save_to_JSON","parameters":"(out_dir,locale,working_dict)","argument_list":"","return_statement":"","docstring":"Converts working_dict into JSON and saves it into \/out_dir\/locale\/.\n\n\tArguments:\n\t\tout_dir {[string]} -- [Path to save all translations]\n\t\tlocale {[string]} -- [Two letter abbreviation of the language.]\n\t\tworking_dict {[dict]} -- [The language dataframe converted to the following format:\n\t\t\t\t{\n\t\t\t\t\t\"parentKey\":{\n\t\t\t\t\t\t\"childKey\":{\n\t\t\t\t\t\t\t'fieldKey':{'value':'translatedValue','array':['translatedValue']},\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t]","docstring_summary":"Converts working_dict into JSON and saves it into \/out_dir\/locale\/.","docstring_tokens":["Converts","working_dict","into","JSON","and","saves","it","into","\/","out_dir","\/","locale","\/","."],"function":"def save_to_JSON(out_dir,locale,working_dict):\n\t\"\"\" Converts working_dict into JSON and saves it into \/out_dir\/locale\/.\n\n\tArguments:\n\t\tout_dir {[string]} -- [Path to save all translations]\n\t\tlocale {[string]} -- [Two letter abbreviation of the language.]\n\t\tworking_dict {[dict]} -- [The language dataframe converted to the following format:\n\t\t\t\t{\n\t\t\t\t\t\"parentKey\":{\n\t\t\t\t\t\t\"childKey\":{\n\t\t\t\t\t\t\t'fieldKey':{'value':'translatedValue','array':['translatedValue']},\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t]\n\t\"\"\"\n\tif not path.exists(out_dir+locale):\n\t\tmkdir(out_dir+locale)\n\twith open(out_dir+locale+'\/translation.json', 'w') as f:\n\t\tdump(working_dict, f)","function_tokens":["def","save_to_JSON","(","out_dir",",","locale",",","working_dict",")",":","if","not","path",".","exists","(","out_dir","+","locale",")",":","mkdir","(","out_dir","+","locale",")","with","open","(","out_dir","+","locale","+","'\/translation.json'",",","'w'",")","as","f",":","dump","(","working_dict",",","f",")"],"url":"https:\/\/github.com\/COVID-19-electronic-health-system\/Corona-tracker\/blob\/80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c\/src\/python\/pull_gsheets_translations_mvp.py#L175-L194"}
{"nwo":"COVID-19-electronic-health-system\/Corona-tracker","sha":"80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c","path":"src\/python\/pull_gsheets_translations_mvp.py","language":"python","identifier":"connect_to_gsheets_API","parameters":"(credentials_path,scope)","argument_list":"","return_statement":"return authorize(credentials)","docstring":"Connects to google sheets API using a credentials JSON.\n\n\tArguments:\n\t\tcredentials_path {[string]} -- [Path to your credentials.json file for the google sheets API]\n\t\tscope {[list]} -- [List of strings to determine the data you access from google sheets API]\n\n\tReturns:\n\t\t[class] -- [client_class instance that allows an authorized user to access google sheets]","docstring_summary":"Connects to google sheets API using a credentials JSON.","docstring_tokens":["Connects","to","google","sheets","API","using","a","credentials","JSON","."],"function":"def connect_to_gsheets_API(credentials_path,scope):\n\t\"\"\" Connects to google sheets API using a credentials JSON.\n\n\tArguments:\n\t\tcredentials_path {[string]} -- [Path to your credentials.json file for the google sheets API]\n\t\tscope {[list]} -- [List of strings to determine the data you access from google sheets API]\n\n\tReturns:\n\t\t[class] -- [client_class instance that allows an authorized user to access google sheets]\n\t\"\"\"\n\tcredentials = Credentials.from_service_account_file(credentials_path, scopes=scope)\n\treturn authorize(credentials)","function_tokens":["def","connect_to_gsheets_API","(","credentials_path",",","scope",")",":","credentials","=","Credentials",".","from_service_account_file","(","credentials_path",",","scopes","=","scope",")","return","authorize","(","credentials",")"],"url":"https:\/\/github.com\/COVID-19-electronic-health-system\/Corona-tracker\/blob\/80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c\/src\/python\/pull_gsheets_translations_mvp.py#L196-L207"}
{"nwo":"COVID-19-electronic-health-system\/Corona-tracker","sha":"80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c","path":"src\/python\/pull_gsheets_translations_mvp.py","language":"python","identifier":"list_all_spreadsheets_name","parameters":"(gc)","argument_list":"","return_statement":"return [x['name'] for x in list_all_spreadsheets]","docstring":"Creates a list of all the spreadsheet found in the authorized google account.\n\n\tArguments:\n\t\tgc {[class]} -- [Authorized client_class instance]\n\n\tReturns:\n\t\t[list] -- [Names of all spreadsheets found in the Translations folder in google drive.]","docstring_summary":"Creates a list of all the spreadsheet found in the authorized google account.","docstring_tokens":["Creates","a","list","of","all","the","spreadsheet","found","in","the","authorized","google","account","."],"function":"def list_all_spreadsheets_name(gc):\n\t\"\"\" Creates a list of all the spreadsheet found in the authorized google account.\n\n\tArguments:\n\t\tgc {[class]} -- [Authorized client_class instance]\n\n\tReturns:\n\t\t[list] -- [Names of all spreadsheets found in the Translations folder in google drive.]\n\t\"\"\"\n\tlist_all_spreadsheets = gc.list_spreadsheet_files()\n\treturn [x['name'] for x in list_all_spreadsheets]","function_tokens":["def","list_all_spreadsheets_name","(","gc",")",":","list_all_spreadsheets","=","gc",".","list_spreadsheet_files","(",")","return","[","x","[","'name'","]","for","x","in","list_all_spreadsheets","]"],"url":"https:\/\/github.com\/COVID-19-electronic-health-system\/Corona-tracker\/blob\/80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c\/src\/python\/pull_gsheets_translations_mvp.py#L209-L219"}
{"nwo":"COVID-19-electronic-health-system\/Corona-tracker","sha":"80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c","path":"src\/python\/pull_gsheets_translations_mvp.py","language":"python","identifier":"filter_old_translation_sheets","parameters":"(spreadsheet_names,current_translation_regex,old_translation_regex,languages_to_translate)","argument_list":"","return_statement":"return [x for x in translation_sheet_names for y in languages_to_translate if y in x]","docstring":"Removes the old translation sheets from the data model.\n\n\tArguments:\n\t\tspreadsheet_names {[list]} -- [List of the spreadsheet names found in the Translation folder.]\n\t\tcurrent_translation_regex {[string]} -- [String to filter out the sheets to be converted to JSON.]\n\t\told_translation_regex {[string]} -- [String to filter out the translation sheets not used in data model.]\n\t\tlanguages_to_translate {[list]} -- [List of lanaguages to translate.]\n\n\tReturns:\n\t\t[list] -- [list of spreadsheets to use for the data model.]","docstring_summary":"Removes the old translation sheets from the data model.","docstring_tokens":["Removes","the","old","translation","sheets","from","the","data","model","."],"function":"def filter_old_translation_sheets(spreadsheet_names,current_translation_regex,old_translation_regex,languages_to_translate):\n\t\"\"\" Removes the old translation sheets from the data model.\n\n\tArguments:\n\t\tspreadsheet_names {[list]} -- [List of the spreadsheet names found in the Translation folder.]\n\t\tcurrent_translation_regex {[string]} -- [String to filter out the sheets to be converted to JSON.]\n\t\told_translation_regex {[string]} -- [String to filter out the translation sheets not used in data model.]\n\t\tlanguages_to_translate {[list]} -- [List of lanaguages to translate.]\n\n\tReturns:\n\t\t[list] -- [list of spreadsheets to use for the data model.]\n\t\"\"\"\n\ttranslation_sheet_names = [ x for x in spreadsheet_names if (current_translation_regex in x) & (old_translation_regex not in x)]\n\treturn [x for x in translation_sheet_names for y in languages_to_translate if y in x]","function_tokens":["def","filter_old_translation_sheets","(","spreadsheet_names",",","current_translation_regex",",","old_translation_regex",",","languages_to_translate",")",":","translation_sheet_names","=","[","x","for","x","in","spreadsheet_names","if","(","current_translation_regex","in","x",")","&","(","old_translation_regex","not","in","x",")","]","return","[","x","for","x","in","translation_sheet_names","for","y","in","languages_to_translate","if","y","in","x","]"],"url":"https:\/\/github.com\/COVID-19-electronic-health-system\/Corona-tracker\/blob\/80cab55a7a03c43fa4a3412daa6e4ff1f0a45d8c\/src\/python\/pull_gsheets_translations_mvp.py#L221-L234"}