[DOCKER] I tried to publish GraphQL API of COVID 19 infected person situation in Hyogo prefecture. (Part 2)

Promotion

Hyogo Prefecture's coronavirus special site is open to the public https://stop-covid19-hyogo.org/ So far, it works separately from my published GraphQL API. I would like to introduce it as it is very helpful.

hyogo.covid19-api GraphQL Playground

** api breakdown **

readInfectedPeoples Infected person information list acquisition query https://web.pref.hyogo.lg.jp/kk03/corona_kanjyajyokyo.html Excel file of infected person information posted on the above page every 30 minutes Download in the container. Read that file and insert the data into PostgreSQL. The GraphQL server set up with gqlgen uses gorm to acquire data from PostgreSQL and distribute it.

** Relationship between GraphQL fields and Excel files ** Data after "Certified Children's Garden" in Excel can be read by a sub-collection query called cluster_places.

number Date confirmed Age sex jurisdiction residence Profession Date of onset Travel history Remarks column
no confirmed_date age_group sex jurisdiction residence occupation onset_date travel_history remarks

** Acquisition example ** スクリーンショット 2020-03-21 11.45.05.png

** Example of query to get all fields ** There is also an id field by uuid, but when trying it on the playground it is too long and hard to see Here, I will paste a query that does not include the id.

query{
  readInfectedPeoples{
    no
    confirmed_date
    age_group
    sex
    jurisdiction
    residence
    occupation
    onset_date
    travel_history
    remarks
    cluster_places{
      no
      label
      is_relation
    }
  }
}

readExamOverviews https://web.pref.hyogo.lg.jp/kk03/corona_hasseijyokyo.html Every 30 minutes on the above page, the pdf file just below "Occurrence" Download in the container. Read that file and insert the data into PostgreSQL. The GraphQL server set up with gqlgen uses gorm to acquire data from PostgreSQL and distribute it.

** Related data ** スクリーンショット 2020-03-21 12.02.12.png

** Acquisition example ** スクリーンショット 2020-03-21 12.42.04.png

** Example of query to get all fields **

query{
  readExamOverviews{
    no
    label
    count
  }
}

readExamDetails https://web.pref.hyogo.lg.jp/kf16/singatakoronakensa.html Scraping the table tag at the bottom of the bar chart above every 30 minutes Insert the extracted data into PostgreSQL. The GraphQL server set up with gqlgen uses gorm to acquire data from PostgreSQL and distribute it.

** Related data ** スクリーンショット 2020-03-21 12.59.27.png

** Acquisition example ** スクリーンショット 2020-03-21 13.01.24.png

** Example of query to get all fields **

query{
  readExamDetails{
    no
    date
    exam_count
    positive_count
  }
}

readPCROverviews Improved version of readExamOverviews Until 2020/3/13 https://web.pref.hyogo.lg.jp/kk03/corona_hasseijyokyo.html Accumulate pdf information of However, since the pdf is replaced every day With cumulative information of https://web.pref.hyogo.lg.jp/kf16/singatakoronakensa.html We have borrowed some data from https://covid-hyogo.now.sh. (Manual input www) Data accumulation has started from March 23, 2020. The date in the date field is the date of the previous day according to the rules posted on the Hyogo prefecture site. It is saved in ISO8601 (RFC3339) format. By the way, until the data on the site is updated, the same data as the data announced the day before will be returned.

** Related data ** スクリーンショット 2020-03-21 12.02.12.png

** Acquisition example ** スクリーンショット 2020-03-23 10.44.54.png

** Example of query to get all fields **

query{
  readPCROverviews{
  id
  date
  pcr_total
  pcr_positive_count
  hospitalized_count
  not_serious_count
  serious_count
  death_count
  discharge_count
}
}

Summary

Added on 2020/3/23 It's time to try a GraphQL subscription Also, I've finally become interested in CI around operations.

Recommended Posts

I tried to publish GraphQL API of COVID 19 infected person situation in Hyogo prefecture. (Part 2)
I tried to publish GraphQL API of COVID19 infected person situation in Hyogo prefecture.
I tried to touch the API of ebay
I tried to erase the negative part of Meros
I tried to summarize the new coronavirus infected people in Ichikawa City, Chiba Prefecture
I tried to visualize the characteristics of new coronavirus infected person information with wordcloud
I tried to create API list.csv in Python from swagger.yaml
I tried to implement blackjack of card game in Python
I tried fitting the exponential function and logistics function to the number of COVID-19 positive patients in Tokyo
I tried to make an analysis base of 5 patterns in 3 years
I tried to create Quip API
I tried to touch Tesla's API
I tried to refactor the template code posted in "Getting images from Flickr API with Python" (Part 2)
I tried to get the authentication code of Qiita API with Python.
I want to color a part of an Excel string in Python
I tried various patterns of date strings to be entered in pandas.to_datetime
I tried to get the movie information of TMDb API with Python
I tried to display the altitude value of DTM in a graph
I tried to implement a card game of playing cards in Python
I tried to make PyTorch model API in Azure environment using TorchServe
I tried to implement PLSA in Python
I tried to implement permutation in Python
I tried to implement PLSA in Python 2
I tried to implement ADALINE in Python
I tried to touch the COTOHA API
I tried to implement PPO in Python
I tried to predict the number of people infected with coronavirus in Japan by the method of the latest paper in China
I tried to make a Web API
I tried to predict the number of people infected with coronavirus in consideration of the effect of refraining from going out
I tried to predict Covid-19 using Darts
[Azure] I tried to create a Linux virtual machine in Azure of Microsoft Learn
I tried to notify slack of Redmine update
I tried to find 100 million digits of pi
I tried to integrate with Keras in TFv1.1
I tried to correct the keystone of the image
I tried to implement TOPIC MODEL in Python
I tried to implement selection sort in python
I tried to predict the price of ETF
I tried to vectorize the lyrics of Hinatazaka46!
[Linux] I learned LPIC lv1 in 10 days and tried to understand the mechanism of Linux.
I tried to notify the update of "Become a novelist" using "IFTTT" and "Become a novelist API"
I tried to extract the text in the image file using Tesseract of the OCR engine
I tried to put HULFT IoT (Agent) in the gateway Rooster of Sun Electronics
[First data science ⑥] I tried to visualize the market price of restaurants in Tokyo