[PYTHON] 1 Click to become an executive button

In the approaching year, maybe it's because of winter or because of the bosom ... In this season when I feel something gray, I created an app that looks like a faint match. It is an application that you can become an officer of a listed company with 1 Click! Its name is "Executive Button". Click the image below to start it.

** The executive button is amazing! **

Get executive compensation for listed companies at the push of a button! !!

** This is the executive button shit! **

I can't really get it! !!

The implementation is here.

https://github.com/icoxfog417/executive_button

Executive compensation of listed companies

From 2019, executive compensation and other information will be disclosed as part of governance disclosure. Specifically, it has come to be described in disclosure documents required for listed companies such as securities reports.

It's hard to expose, but our executive compensation is as follows.

image.png

It's about 40 million per person. Hmm, quite ... (ambiguous smile). This value can be obtained without the penance of reading from PDF. Since the disclosure document is written in an XML-extended format called XBRL, it is possible to obtain data by performing XML parsing. The tags used are revised every year, and each time they are published as follows.

(About the publication of the 2019 EDINET taxonomy)

The total amount of executive compensation can be obtained with the tag "TotalAmountOfRemunerationEtcPaidByGroupRemunerationEtcPaidByGroupToEachDirectorOrOtherOfficer" in the namespace "jpcrp_cor" (long). The namespace is decided for each disclosure document ... It will be long if you talk, so if you are interested [here](https://medium.com/programming-soda/%E8%B2%A1 % E5% 8B% 99% E5% 88% 86% E6% 9E% 90% E3% 81% AB% E6% AC% A0% E3% 81% 8B% E3% 81% 9B% E3% 81% AA% E3 Please refer to% 81% 84-xbrl% E3% 82% 92% E7% 90% 86% E8% A7% A3% E3% 81% 99% E3% 82% 8B-part1-d4165fe0e84a).

image.png

This time, we will use the recently released data set "CoARiJ" that summarizes documents such as securities reports and financial figures. To use.

Since CoARiJ records text information and numerical information as a set, "I'm saying good things, but are they reflected in management indicators?" Or "If the numerical values are bad, environmental activities (reports) will be modest. It is possible to analyze from both text and numerical values such as "Isn't it?" This time, I'm pulling out the executive compensation data in the text and displaying it randomly in the app.

Application configuration

The application and infrastructure configuration for this time are as follows.

image.png

There is a reason why proxies are different between development and production.

  1. Traefik needs access to the host's docker.sock, but [Fargate cannot do volume bind](https://docs.aws.amazon.com/ja_jp/AmazonECS/latest/developerguide/bind -mounts.html).
  2. Fargate can't use links, so Nginx can't resolve hostnames. Instead, you can access other containers with localhost.
  3. Therefore, even if you use Nginx for both development and production, you need to change the value of nginx.conf (in the case of development, on the contrary, you can not access it on localhost). I used Traefik, which is easy to set up, because it will be double-managed anyway.

I wonder if I should put a proxy if it is such a trouble, but there is a reason to put a proxy. If you want to separate containers on the Nuxt / backend, you will need a proxy for both server-side and client-side access to Nuxt (see here for more information (https://stackoverflow.com/questions/55090038). / get-http-api1337-games-neterr-name-not-resolved-for-nuxt-js-pages-using-asy)). On the server side, Nuxt's proxy settings can be used.

nuxt.config.js


  modules: [
    // Doc: https://axios.nuxtjs.org/usage
    "@nuxtjs/axios",
    "@nuxtjs/proxy"
  ],
  /*
   ** Axios module configuration
   ** See https://axios.nuxtjs.org/options
   */
  axios: {
    prefix: "/api",
    proxy: true
  },
  proxy: {
    "/api/": process.env.BACKEND_URL || "http://localhost:8000/"
  },

However, JavaScript (access from the client side) after rendering does not have proxy settings. Therefore, the host name cannot be resolved or a cross-domain error occurs. In order to properly convey access from the client side to the backend, a reverse proxy must be placed to relay.

Traefik is well suited for this reverse proxy role. You can set the proxy just by setting the label in traefik 2.0 series, docker-compose. The following is a quote from the official tutorial, but just set Host in labels in the container of whoami and it will relay the request to that host.

Great convenience! However, as mentioned above, it does not work with Fargate, which cannot use binding because it refers to the host's docker.sock. It is possible to support by switching to EC2, but please note that the policy of ʻAmazon EC2ContainerService for EC2Role` is required at this time ([Reference](https://stackoverflow.com/questions/36523282/aws-ecs-error-when-" running-task-no-container-instances-were-found-in-your-clust)).

Please note that the Public IP of Fargate will change each time you deploy it. Since it will be difficult as it is, I will relay the request with the load balancer in front (although it is just relaying something ...). For details on how to make a load balancer, see below.

Run your container on AWS Fargate

When registering from ʻecs-cli, specify with --target-group-arn (target group) instead of --load-balancer-name(load balancer). When specified by the load balancer, it was said thatClassic Load Balancers are not supported with Fargate`.

 ecs-cli compose service create \
       --target-group-arn "$ARN" \
       --container-name service_name_on_docker_compose \
       --container-port exposed_port

For the final deployment using GitHub Action, see the repository (https://github.com/icoxfog417/executive_button/blob/master/.github/workflows/dockerimage.yml).

Executive compensation ranking

Well, just tell me which companies are getting a lot! I made the top 10 for those who say. Of the 1944 companies for which compensation was available, the following companies have the highest per capita compensation.

image.png

If you work for 10 million years at Tokyo Electron Limited, you will get 5,000 trillion yen! (Is the calculation correct?). All company data is in the repository, so take a look.

Recommended Posts

1 Click to become an executive button
I tried to become an Ann Man using OpenCV
An introduction to private TensorFlow
An introduction to machine learning
AtCoder To become light blue
An introduction to Python Programming
An introduction to Bayesian optimization
Disguise the grass on GitHub and try to become an engineer.