diff --git a/scratch-sessions/setting-up-admin-assignments.repl b/scratch-sessions/setting-up-admin-assignments.repl new file mode 100644 index 00000000..17dcf699 --- /dev/null +++ b/scratch-sessions/setting-up-admin-assignments.repl @@ -0,0 +1,137 @@ +;; This buffer is for Clojure experiments and evaluation. + +;; Press C-j to evaluate the last expression. + +;; You can also press C-u C-j to evaluate the expression and pretty-print its result. + +(def in +"Sushi Con - CB Quarterly/ Prepayments Ashlee +Sushi Con - SJ Quarterly/ Prepayments Ashlee +SC Morgan Hill LP Quarterly/ Prepayments Ashlee +Lous Coffee Monthly Return Ashlee +Breakfast Club - MORGAN HILL Quarterly/Prepayments Ashlee +Bills Fremont LLC Quarterly/ Prepayments Ashlee +MT Boxes 2 LLC - Bill's Café PA Quarterly/ Prepayments Ashlee +MT Boxes LLC - Philz Coffee Quarterly/ Prepayments Ashlee +NTG - Fountains/Roseville Quarterly/ Prepayments Ashlee +NTG - Fremont Quarterly/ Prepayments Ashlee + NTG - ELk Grove Quarterly/ Prepayments Ashlee +NTG Roseville Quarterly/ Prepayments Ashlee +NTG - San Carlos Gyro House Quarterly/ Prepayments Ashlee +NTG - Wellborne TX Due on 20th Quarterly/ Prepayments Ashlee +NTG - Visalia Quarterly/ Prepayments Ashlee +NTG - University TX Due on 20th Quarterly/ Prepayments Ashlee +NTG - St George Quarterly/ Prepayments (do restuarant tax quarterly) Ashlee +NTG - Danville Quarterly/ Prepayments Ashlee +NTG - Dublin - Dublin Greek Eats Quarterly/ Prepayments Ashlee +NTG - Vacaville Greek Eats Quarterly/ Prepayments Ashlee +NTG - Pacific Greek Eats Quarterly/ Prepayments Ashlee +NTG Concord Quarterly/ Prepayments Ashlee +NTG Davis Quarterly/ Prepayments Ashlee +NTG Walnut Creek Quarterly/ Prepayments Ashlee +NTG Oyster Point Quarterly/ Prepayments Ashlee +NTG - Clayton Quarterly/Prepayments Ashlee +NTG - Fort Apache Nevada: Monthly file and pay Ashlee +NTG - Henderson Nevada: Monthly file and pay Ashlee +Monstera Plant Lounge Quarterly Only Ben for now +NTG State Line Monthly Return Gina +NTG Olathe (Kansas State Sales Tax) Monthly Return Gina +NTG - Union City - ENTG1 LLC Quarterly/ Prepayments Gina +NTG Santa Rosa Quarterly/ Prepayments Gina +Elia Quarterly/ Prepayments Gina +Sultan's Kebab - A&F Quarterly/ Prepayments Gina +Sultan's Kebab - Ulas Inc Quarterly/ Prepayments Gina +Bagel Box (New, Ben did July's prepayment) Quarterly/ Prepayments Gina +NTG - San Mateo - Lakonia Ltd LLC Quarterly/ Prepayments Gina +NTG Fullerton Quarterly/ Prepayments Gina +NTG - Bridgepoint Harvester Quarterly/ Prepayments Gina +NTG Daly City - Harvester Quarterly/ Prepayments Gina +NTG Gellert - Harvester Quarterly/ Prepayments Gina +NTG San Francisco Quarterly/ Prepayments Gina +Akiko LLC - NTG Quarterly/ Prepayments Gina +NTG - Gilroy Quarterly/ Prepayments Gina +NTG - Monterey Quarterly/ Prepayments Gina +NTG - Fresno - Gyros in Motion Quarterly/ Prepayments Gina +NTG - VGZ Burgers Quarterly/ Prepayments Gina +NTG Vallejo Quarterly/ Prepayments Gina +NTG - Newport - KSHRIG LLC Quarterly/ Prepayments Gina +NTG Brentwood KTMM Quarterly/ Prepayments Gina +NTG Brentwood LLC Quarterly/ Prepayments Gina +NTG SLO Quarterly/ Prepayments Gina +NTG San Diego - Enzo Quarterly/ Prepayments Gina +Odeum Quarterly/ Prepayments Gina +Penolope's CT Quarterly/ Prepayments Gina +Penelope's Spear Quarterly/ Prepayments Gina +Sandwich Monkey Quarterly/ Prepayments Gina +NTG - UCLA/westwood - Aphrodite One LLC Quarterly/ Prepayments Ashlee +NTG - Zero To Sixty Quarterly/ Prepayments Ashlee +NTG Santa Monica Quarterly/ Prepayments Ashlee +NTG Westlake Quarterly/ Prepayments Ashlee +NTG Woodland Hills Quarterly/ Prepayments Ashlee +NTG Phoenix Monthly Return Kyle +NTG Hayward Quarterly/ Prepayments Kyle +NTG Hollywood Quarterly/ Prepayments Kyle +NTG Novato SamZee LLC Quarterly/ Prepayments Kyle +NTG San Leandro Quarterly/ Prepayments Kyle +NTG Castro Valley Quarterly/ Prepayments Kyle +NTG Livermore Giannos Gyros Quarterly/ Prepayments Kyle +NTG River Bank Giannos Gyros Quarterly/ Prepayments Kyle +MDB21 Inc dba Naschmarkt Quarterly/ Prepayments Kyle +MDBPA Quarterly/ Prepayments Kyle +Anatolian Kitchen Quarterly/ Prepayments Kyle +Campbell Creamery - Shree Sairam LLC Annual 6/30 Kyle +Lean Feast Humble Hustler Annual Kyle +Bella Saratoga Quarterly/ Prepayments Kyle +Brown Chicken Brown Cow Quarterly/ Prepayments Kyle +Frost Cupcake Factory Quarterly Only Kyle +Hiro Mura Quarterly/ Prepayments Kyle +Mio Vicino - SC Quarterly/ Prepayments Kyle +Orale Mex Grill Quarterly/ Prepayments Kyle +Piatto Piccolo LLC (Vin Santo) Quarterly/ Prepayments Kyle +Poke Poke Fish Bar LLC Quarterly/ Prepayments Kyle +Roberto's Cantina Quarterly/ Prepayments Kyle +Savory Kitchen Quarterly/ Prepayments Kyle +Sorelle Italian Bistro Quarterly/ Prepayments Kyle +Warm Elements Quarterly/ Prepayments Kyle +Willow Glen Creamery Quarterly Only Kyle" +) + +(def parsed + (->> (clojure.data.csv/read-csv in :separator \tab) + (map (fn [[client-stuff _ person]] + {:search client-stuff + :client-id (some->> {"query" (format "_text_:\"%s \"" (->> (-> client-stuff + (str/replace "NTG" "Nick the Greek") + (str/replace "Sushi Con" "Sushi Confidential") + (str/split #" ")) + (str/join " "))) + "fields" "id"} + (solr/query solr/impl "clients") + (map :id) + first + Long/parseLong) + :person person + :user-id ({"Gina" 17592278867066 + "Kyle" 17592196388717 + "Ashlee" 17592255266681 + "Ben" 17592186109010} person)} + )))) + +@(dc/transact conn + (->> parsed + (filter :client-id) + (filter :user-id) + (map (fn [x] + [:db/add (:user-id x) :user/clients (:client-id x)])))) + +(->> parsed + (filter (fn [x] + (or (not (:client-id x)) + (not (:user-id x))))) + (group-by :person) + (map (fn [[p v]] + [p (map :search v)])) + (into {})) + +(user/init-repl) + diff --git a/src/clj/auto_ap/ssr/transaction/insights.clj b/src/clj/auto_ap/ssr/transaction/insights.clj index f4a25a94..78eb6ef9 100644 --- a/src/clj/auto_ap/ssr/transaction/insights.clj +++ b/src/clj/auto_ap/ssr/transaction/insights.clj @@ -308,7 +308,7 @@ (html-response (insight-table* {:clients clients :identity identity}))) -(defn page [{:keys [identity matched-route session] :as request}] +(defn page [{:keys [identity matched-route session clients] :as request}] (base-page request (com/page {:nav (com/main-aside-nav) @@ -327,8 +327,7 @@ [:a {:href (bidi/path-for ssr-routes/only-routes :transaction-insights)} "Insights"]) - (insight-table* {:selected-client - (-> session :client :db/id) + (insight-table* {:clients clients :identity identity})) "Transaction Insights")) diff --git a/terraform/terraform.tfstate.d/prod/terraform.tfstate b/terraform/terraform.tfstate.d/prod/terraform.tfstate index 7da61fd5..2cd6fc72 100644 --- a/terraform/terraform.tfstate.d/prod/terraform.tfstate +++ b/terraform/terraform.tfstate.d/prod/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 4, - "terraform_version": "1.5.4", - "serial": 520, + "terraform_version": "1.5.6", + "serial": 524, "lineage": "9b630886-8cee-a57d-c7a2-4f19f13f9c51", "outputs": { "aws_access_key_id": { @@ -125,8 +125,8 @@ "early_renewal_duration": "", "id": "arn:aws:acm:us-east-1:679918342773:certificate/9dce79fb-fc06-438b-8188-f54313b5161a", "key_algorithm": "RSA_2048", - "not_after": "", - "not_before": "", + "not_after": "2024-09-01T23:59:59Z", + "not_before": "2023-08-04T00:00:00Z", "options": [ { "certificate_transparency_logging_preference": "ENABLED" @@ -134,9 +134,9 @@ ], "pending_renewal": false, "private_key": null, - "renewal_eligibility": "INELIGIBLE", + "renewal_eligibility": "ELIGIBLE", "renewal_summary": [], - "status": "PENDING_VALIDATION", + "status": "ISSUED", "subject_alternative_names": [ "data.prod.app.integreatconsult.com" ], @@ -233,7 +233,7 @@ ], "tags": {}, "tags_all": {}, - "task_definition": "arn:aws:ecs:us-east-1:679918342773:task-definition/integreat_app_prod:604", + "task_definition": "arn:aws:ecs:us-east-1:679918342773:task-definition/integreat_app_prod:631", "timeouts": { "create": null, "delete": null, @@ -465,9 +465,9 @@ "provisioned_throughput_in_mibps": 0, "size_in_bytes": [ { - "value": 588505088, + "value": 643549184, "value_in_ia": 0, - "value_in_standard": 588505088 + "value_in_standard": 643549184 } ], "tags": { @@ -1881,6 +1881,144 @@ } ] }, + { + "module": "module.insight_outcome_recommendation_job", + "mode": "managed", + "type": "aws_cloudwatch_event_rule", + "name": "schedule", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "index_key": 0, + "schema_version": 0, + "attributes": { + "arn": "arn:aws:events:us-east-1:679918342773:rule/insight-outcome-recommendation-schedule", + "description": "", + "event_bus_name": "default", + "event_pattern": null, + "id": "insight-outcome-recommendation-schedule", + "is_enabled": true, + "name": "insight-outcome-recommendation-schedule", + "name_prefix": "", + "role_arn": "", + "schedule_expression": "rate(6 hours)", + "tags": null, + "tags_all": {} + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "module": "module.insight_outcome_recommendation_job", + "mode": "managed", + "type": "aws_cloudwatch_event_target", + "name": "job_target", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "index_key": 0, + "schema_version": 1, + "attributes": { + "arn": "arn:aws:ecs:us-east-1:679918342773:cluster/default", + "batch_target": [], + "dead_letter_config": [], + "ecs_target": [ + { + "capacity_provider_strategy": [], + "enable_ecs_managed_tags": false, + "enable_execute_command": false, + "group": "", + "launch_type": "FARGATE", + "network_configuration": [ + { + "assign_public_ip": true, + "security_groups": [ + "sg-004e5855310c453a3", + "sg-02d167406b1082698" + ], + "subnets": [ + "subnet-5e675761", + "subnet-8519fde2", + "subnet-89bab8d4" + ] + } + ], + "ordered_placement_strategy": [], + "placement_constraint": [], + "platform_version": "", + "propagate_tags": "TASK_DEFINITION", + "tags": null, + "task_count": 1, + "task_definition_arn": "arn:aws:ecs:us-east-1:679918342773:task-definition/insight_outcome_recommendation_prod:1" + } + ], + "event_bus_name": "default", + "http_target": [], + "id": "insight-outcome-recommendation-schedule-insight-outcome-recommendation", + "input": "", + "input_path": "", + "input_transformer": [], + "kinesis_target": [], + "redshift_target": [], + "retry_policy": [], + "role_arn": "arn:aws:iam::679918342773:role/service-role/Amazon_EventBridge_Invoke_ECS_1758992733", + "rule": "insight-outcome-recommendation-schedule", + "run_command_targets": [], + "sqs_target": [], + "target_id": "insight-outcome-recommendation" + }, + "sensitive_attributes": [], + "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", + "dependencies": [ + "module.insight_outcome_recommendation_job.aws_cloudwatch_event_rule.schedule", + "module.insight_outcome_recommendation_job.aws_ecs_task_definition.background_taskdef" + ] + } + ] + }, + { + "module": "module.insight_outcome_recommendation_job", + "mode": "managed", + "type": "aws_ecs_task_definition", + "name": "background_taskdef", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "arn": "arn:aws:ecs:us-east-1:679918342773:task-definition/insight_outcome_recommendation_prod:1", + "arn_without_revision": "arn:aws:ecs:us-east-1:679918342773:task-definition/insight_outcome_recommendation_prod", + "container_definitions": "[{\"cpu\":0,\"dockerLabels\":{\"com.datadoghq.tags.env\":\"prod\",\"com.datadoghq.tags.service\":\"insight-outcome-recommendation\"},\"environment\":[{\"name\":\"DD_CONTAINER_ENV_AS_TAGS\",\"value\":\"{\\\"INTEGREAT_JOB\\\":\\\"background_job\\\"}\"},{\"name\":\"DD_ENV\",\"value\":\"prod\"},{\"name\":\"DD_SERVICE\",\"value\":\"insight-outcome-recommendation\"},{\"name\":\"INTEGREAT_JOB\",\"value\":\"insight-outcome-recommendation\"},{\"name\":\"config\",\"value\":\"/usr/local/config/prod-background-worker.edn\"}],\"essential\":true,\"image\":\"679918342773.dkr.ecr.us-east-1.amazonaws.com/integreat-cloud:prod\",\"logConfiguration\":{\"logDriver\":\"awslogs\",\"options\":{\"awslogs-group\":\"/ecs/integreat-app-prod\",\"awslogs-region\":\"us-east-1\",\"awslogs-stream-prefix\":\"ecs\"}},\"mountPoints\":[],\"name\":\"integreat-app\",\"portMappings\":[{\"containerPort\":9000,\"hostPort\":9000,\"protocol\":\"tcp\"},{\"containerPort\":9090,\"hostPort\":9090,\"protocol\":\"tcp\"}],\"volumesFrom\":[]},{\"cpu\":0,\"environment\":[{\"name\":\"DD_API_KEY\",\"value\":\"ce10d932c47b358e81081ae67bd8c112\"},{\"name\":\"ECS_FARGATE\",\"value\":\"true\"}],\"essential\":true,\"image\":\"public.ecr.aws/datadog/agent:latest\",\"mountPoints\":[],\"name\":\"datadog-agent\",\"portMappings\":[],\"volumesFrom\":[]}]", + "cpu": "2048", + "ephemeral_storage": [], + "execution_role_arn": "arn:aws:iam::679918342773:role/ecsTaskExecutionRole", + "family": "insight_outcome_recommendation_prod", + "id": "insight_outcome_recommendation_prod", + "inference_accelerator": [], + "ipc_mode": "", + "memory": "4096", + "network_mode": "awsvpc", + "pid_mode": "", + "placement_constraints": [], + "proxy_configuration": [], + "requires_compatibilities": [ + "FARGATE" + ], + "revision": 1, + "runtime_platform": [], + "skip_destroy": false, + "tags": null, + "tags_all": {}, + "task_role_arn": "arn:aws:iam::679918342773:role/datomic-ddb", + "volume": [] + }, + "sensitive_attributes": [], + "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==" + } + ] + }, { "module": "module.intuit_job", "mode": "managed", diff --git a/terraform/terraform.tfstate.d/prod/terraform.tfstate.backup b/terraform/terraform.tfstate.d/prod/terraform.tfstate.backup index a4e2ee7a..54251410 100644 --- a/terraform/terraform.tfstate.d/prod/terraform.tfstate.backup +++ b/terraform/terraform.tfstate.d/prod/terraform.tfstate.backup @@ -1,7 +1,7 @@ { "version": 4, - "terraform_version": "1.5.4", - "serial": 519, + "terraform_version": "1.5.6", + "serial": 520, "lineage": "9b630886-8cee-a57d-c7a2-4f19f13f9c51", "outputs": { "aws_access_key_id": { @@ -140,7 +140,7 @@ "subject_alternative_names": [ "data.prod.app.integreatconsult.com" ], - "tags": null, + "tags": {}, "tags_all": {}, "type": "AMAZON_ISSUED", "validation_emails": [], @@ -465,9 +465,9 @@ "provisioned_throughput_in_mibps": 0, "size_in_bytes": [ { - "value": 588693504, + "value": 588505088, "value_in_ia": 0, - "value_in_standard": 588693504 + "value_in_standard": 588505088 } ], "tags": {