let clientId = "879452483765-7idfp3b7f0nji1du3iffiu4d8t3276io.apps.googleusercontent.com"; let project_id = "script-analysis-a2lcle"; let scopes = "https://www.googleapis.com/auth/bigquery.readonly https://www.googleapis.com/auth/pubsub"; google.load("visualization", "1", {packages: ["table"]}); gapi.load("client"); let dateObj = new Date(); let month = dateObj.getUTCMonth() + 1; //months from 1-12 let day = dateObj.getUTCDate(); let year = dateObj.getUTCFullYear(); let newdate = year + "-" + month + "-" + day; var auth_token; const client = google.accounts.oauth2.initTokenClient({ client_id: clientId, scope: scopes, callback: (tokenResponse) => { if (tokenResponse && tokenResponse.access_token) { auth_token = tokenResponse.access_token console.log("token response") gapi.client.load("bigquery", "v2") console.log("loaded bq client") $("#client_initiated").html("Authenticated successfully!"); $("#listScreenplays").fadeIn(); $("#retrieveScreenplayAll").fadeIn(); $("#displaySubmissionForm").fadeIn(); } }, }); //get all screenplays function retrieveScreenplayAll() { let request = gapi.client.bigquery.jobs.query({ "query": "SELECT Content.uuid, Content.script_name, Content.content_retrieved, Content.script_content, Analysis.prompt_name, Analysis.prompt_response, Analysis.prompt_text, Analysis.model_version FROM script_analysis.script_content AS Content INNER JOIN script_analysis.script_analysis AS Analysis ON Content.uuid=Analysis.uuid", "timeoutMs": 30000, "projectId": project_id, "useLegacySql": false }); document.getElementById("result_box").innerHTML = "
| ' + script_content_logline_title + ' | ' + script_content_logline + ' |
| ' + script_content_summary_title + ' | ' + script_content_summary + ' |
| ' + script_content_genre_title + ' | ' + script_content_genre + ' |
| ' + script_content_audience_title + ' | ' + script_content_audience + ' |
| ' + script_content_quality_rating_title + ' | ' + script_content_quality_rating + ' |
| ' + script_content_major_characters_title + ' | ' + script_content_major_characters + ' |
| ' + script_content_major_scenes_title + ' | ' + script_content_major_scenes + ' |
| ' + script_content_plot_complexity_title + ' | ' + script_content_plot_complexity + ' |
| ' + script_content_filming_locations_title + ' | ' + script_content_filming_locations + ' |
| ' + script_content_props_title + ' | ' + script_content_props + ' |
| ' + script_content_plot_holes_title + ' | ' + script_content_plot_holes + ' |
| ' + script_summary_slides_title + ' | ' + script_summary_slides + ' |
| ' + scene_breakdown_sheets_title + ' | ' + scene_breakdown_sheets + ' |
| ' + script_content_scene_1_summary_title + ' | ' + script_content_scene_1_summary + ' |
| ' + script_content_scene_10_summary_title + ' | ' + script_content_scene_10_summary + ' |
| ' + script_content_scene_20_summary_title + ' | ' + script_content_scene_20_summary + ' |
| ' + script_content_coverage_title + ' | ' + script_content_coverage + ' |
| ' + script_content_synopsis_title + ' | ' + script_content_synopsis + ' |
| ' + script_content_treatment_title + ' | ' + script_content_treatment + ' |
| ' + script_content_key_plot_points_title + ' | ' + script_content_key_plot_points + ' |
| ' + script_content_story_arc_chart_title + ' | ' + script_content_story_arc_chart + ' |
| ' + script_content_character_descriptions_title + ' | ' + script_content_character_descriptions + ' |
| ' + script_content_critique_title + ' | ' + script_content_critique + ' |
| ' + script_content_themes_title + ' | ' + script_content_themes + ' |