public static async Task <SurveyPollForCovid19> RunOrchestrator(
            [OrchestrationTrigger] IDurableOrchestrationContext context)
        {
            SurveyPollForCovid19 cv19pollinstance = context.GetInput <SurveyPollForCovid19>();

            var outputs = new List <string>();

            outputs.Add(await context.CallActivityAsync <string>("aspa_FanOutTextAnalysis", cv19pollinstance.HowIsYourMentalHealthToday));
            outputs.Add(await context.CallActivityAsync <string>("aspa_FanOutTextAnalysis", cv19pollinstance.HowIsYourPhysicalHealthToday));
            outputs.Add(await context.CallActivityAsync <string>("aspa_FanOutTextAnalysis", cv19pollinstance.YourFeelingsOnWorkFromHomeToday));
            outputs.Add(await context.CallActivityAsync <string>("aspa_FanOutTextAnalysis", cv19pollinstance.YourFeelingsOnHomeSchoolingToday));
            outputs.Add(await context.CallActivityAsync <string>("aspa_FanOutTextAnalysis", cv19pollinstance.ThoughtsOnSocialDistancingOnSoftware));


            cv19pollinstance.HowIsYourMentalHealthTodaySentiment           = Convert.ToDouble(outputs[0]);
            cv19pollinstance.HowIsYourPhysicalHealthTodaySentiment         = Convert.ToDouble(outputs[1]);
            cv19pollinstance.YourFeelingsOnWorkFromHomeTodaySentiment      = Convert.ToDouble(outputs[2]);
            cv19pollinstance.YourFeelingsOnHomeSchoolingTodaySentiment     = Convert.ToDouble(outputs[3]);
            cv19pollinstance.ThoughtsOnSocialDistancingOnSoftwareSentiment = Convert.ToDouble(outputs[4]);

            SurveyPollForCovid19 currResults = await context.CallActivityAsync <SurveyPollForCovid19>(
                "aspa_CosmosDBPersist", cv19pollinstance);

            return(cv19pollinstance);
        }
        public static async Task <HttpResponseMessage> HttpStart(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequestMessage req,
            [DurableClient] IDurableOrchestrationClient starter,
            ILogger log)
        {
            var jsonContent = await req.Content.ReadAsStringAsync();

            SurveyPollForCovid19 form = JsonConvert.DeserializeObject <SurveyPollForCovid19>(jsonContent);
            // Function input comes from the request content.
            string instanceId = await starter.StartNewAsync("aspa", form);

            log.LogInformation($"Started orchestration with ID = '{instanceId}'.");

            return(starter.CreateCheckStatusResponse(req, instanceId));
        }
        public static async Task <string> SurveytoCosmosDbAsync([ActivityTrigger] SurveyPollForCovid19 name, ILogger log,
                                                                [CosmosDB(
                                                                     databaseName: "YOURDBHERE",
                                                                     collectionName: "YOURCOLLECTIONAKATABLEHERE",
                                                                     ConnectionStringSetting = "YOURCONNSTRINGHERE")] IAsyncCollector <SurveyPollForCovid19> createSurveyEntry)
        {
            log.LogInformation($"Currently will be working on:  {name}.");


            SurveyPollForCovid19 curritem = new SurveyPollForCovid19()
            {
                Id                                            = name.Id,
                DateCreated                                   = DateTime.Now.ToString("MM/dd/yyyy"),
                AreYouCurrentlyEmployed                       = name.AreYouCurrentlyEmployed,
                Covid19Unemployment                           = name.Covid19Unemployment,
                MoreOrLessAnxietyToday                        = name.MoreOrLessAnxietyToday,
                HowIsYourMentalHealthToday                    = name.HowIsYourMentalHealthToday,
                HowIsYourMentalHealthTodaySentiment           = name.HowIsYourMentalHealthTodaySentiment,
                HowIsYourPhysicalHealthToday                  = name.HowIsYourPhysicalHealthToday,
                HowIsYourPhysicalHealthTodaySentiment         = name.HowIsYourPhysicalHealthTodaySentiment,
                YourFeelingsOnWorkFromHomeToday               = name.YourFeelingsOnWorkFromHomeToday,
                YourFeelingsOnWorkFromHomeTodaySentiment      = name.YourFeelingsOnWorkFromHomeTodaySentiment,
                YourFeelingsOnHomeSchoolingToday              = name.YourFeelingsOnHomeSchoolingToday,
                YourFeelingsOnHomeSchoolingTodaySentiment     = name.YourFeelingsOnHomeSchoolingTodaySentiment,
                ThoughtsOnOpennessToDistanceLearning          = name.ThoughtsOnOpennessToDistanceLearning,
                ThoughtsOnSocialDistancingOnSoftware          = name.ThoughtsOnSocialDistancingOnSoftware,
                ThoughtsOnSocialDistancingOnSoftwareSentiment = name.ThoughtsOnSocialDistancingOnSoftwareSentiment,
                City                                          = name.City,
                Region                                        = name.Region,
                Country                                       = name.Country,
                OverallSentiment                              = sumofall,
                HealthSentiment                               = sumofhealth,
                MaxSentiment                                  = 1,
                Lon                                           = name.Lon,
                Lat                                           = name.Lat
            };

            await createSurveyEntry.AddAsync(curritem);

            return($"Item Created is: {name}!");
        }