File:Covid-19 incidence by catchment area 1.svg

Original file(SVG file, nominally 450 × 720 pixels, file size: 203 KB)

Captions

Captions

Covid-19 incidence by catchment area, weeks 11-12

Summary

edit
Description
English: Covid-19 incidence by catchment area, weeks 11-12
Date
Source Own work
Author Merikanto
SVG development
InfoField
 
The SVG code is valid.
 
This map was created with an unknown SVG tool.

Source od data:

Thl avoin data

Varmistetut koronatapaukset Suomessa (COVID-19)

https://thl.fi/fi/tilastot-ja-data/aineistot-ja-palvelut/avoin-data/varmistetut-koronatapaukset-suomessa-covid-19-

Rajapinnan osoite: https://sampo.thl.fi/pivot/prod/api/epirapo/covid19case.json

Aineiston aihealue: epirapo

Aineiston nimi: covid19case

    1. covid-19 cases in Finland by cahchment area
    2. incidence
    1. R script
    1. uses geofi
    1. 20.6.2021 0000.0001

library(geofi) library(ggplot2) library(dplyr) library(rjstat) library(stringr) library(tidyr)

library(svglite) library(sf) library(viridis)


vuosi=2021 viikko=11

widthi=5 heighti=8


  1. widthi=10
  2. heighti=16


tulosfilee1="Covid-19_cases_by_area_1.svg"



    1. get THL data

url_base <- "https://sampo.thl.fi/pivot/prod/fi/epirapo/covid19case/fact_epirapo_covid19case.json"

    1. request <- "?row=hcdmunicipality2020-445268L&column=dateweek20200101-509030"
  1. request <- "?row=hcd-445268L&column=dateweek20200101-509030"
  2. https://sampo.thl.fi/pivot/prod/fi/epirapo/covid19case/fact_epirapo_covid19case.json

request<-"?row=hcdmunicipality2020-445222&column=dateweek20200101-509030&filter=measure-444833"


url <- paste0(url_base, request) cube <- fromJSONstat(url, naming = "label", use_factors = F, silent = T) res <- cube1

  1. head(res, 30)


locations00<-res[,1] times00<-res[,2] cases00<-strtoi(res[,3])

thl1<-data.frame(locations00,times00,cases00)

  1. dateweek20200101
  2. value
  1. print(locations00)
  2. print(cases00)
  1. print (head(locations00))
  1. stop(-1)

locations11<-locations00[!duplicated(locations00)]

  1. print(head(locations11))

lenlocations11=length(locations11)

print(lenlocations11)


data_in_specific_week <- data.frame("Location","WeeklyCases")


nn=00


for (locationtosearch in locations11) { print(locationtosearch)

allfromlocation=res[grep(locationtosearch, res$hcdmunicipality2020),]

#print(allfromlocation)


#"Vuosi 2021 Viikko 10"

vuosistring=toString(vuosi) viikkostring=toString(viikko)

#print(vuosistring) #print(viikkostring)

datestring=paste0("Vuosi ",vuosistring," Viikko ",viikkostring)

#print(head(allfromlocation))

#print(datestring)


selected_time_location=allfromlocation[grep(datestring, allfromlocation$dateweek20200101),] #print("Allfromlocation") #print(selected_time_location)

weeklycases=selected_time_location$value #print("Weekly") #print(weeklycases)

newdata00 <- rbind(data_in_specific_week, c(locationtosearch, weeklycases))

data_in_specific_week=newdata00


 # nn=nn+1
  #if(nn>1) break
  

}


  1. stop(-1)
  1. print("Kup")
  1. print(selected_time_location)

print(data_in_specific_week)

write.csv(data_in_specific_week, "./mini.csv", row.names=T)

  1. populaation aakkosjärjestys alphap order

sahopivaki<-c( 29789, 128756, 194316, 100226, 1667203, 41060, 73061, 171364, 77689, 252676, 166623, 117350, 61172, 535044, 165569, 409418, 245602, 211215, 218624, 169684, 481478 )


    1. thldata1<-data.frame(shps1,tapaukset)

thldata1<-data_in_specific_week


names(thldata1)<-c("sairaanhoitop_name_fi","tapaukset")

thldata1$tapaukset<-strtoi(thldata1$tapaukset)


thldata1

d1 <- get_municipalities(year = 2021)

  1. shpt1 <- d1  %>% group_by(sairaanhoitop_name_fi) %>% count(maakunta_code)
  2. shpt1 <- d1  %>% group_by(sairaanhoitop_name_fi) %>% count()

shpt1 <- d1  %>% group_by(sairaanhoitop_name_fi) %>% count()

shpt1

  1. stop(-1)


totaali <- merge(shpt1, thldata1, by="sairaanhoitop_name_fi")

  1. totaali <- merge(totaali00, savaki1, by="sairaanhoitop_name_fi")
  1. totaali

totaali$vaesto <- sahopivaki


totaali

  1. stop(-1)


tapauksia1<-as.double(totaali$tapaukset) vaesto1<-as.double(totaali$vaesto)

ilmaantuvuus<-tapauksia1*0.0

ilmaantuvuus0<-(100000*tapauksia1)/vaesto1 ilmaantuvuus=round(ilmaantuvuus0, digits = 0)

print("RAKO")

  1. print(tapauksia1)
  2. print(vaesto1)
  3. print(ilmaantuvuus)
  1. stop(-1)


print (head(totaali, 40))


len1=length(tapauksia1)


totaali$ilmaantuvuus <- ilmaantuvuus


totaali


  1. stop(-1)

daata1=totaali

my_breaks = c(100,2000,5000,10000,20000,50000, 100000,200000,50000, 100000)


otsikko="Koronatapausten ilmaantuvuus" alaotsikko=paste0("Tapausta/100000 as, viikot ",toString(viikko), "-", toString(viikko+1), " ",toString(vuosi) ) footeri=""

p2 <- ggplot(daata1, aes(fill = ilmaantuvuus ) ) +

    1. geom_sf(colour = alpha("white", 1/3)) +
 geom_sf()+
 geom_sf_text(aes(label = ilmaantuvuus),
              size = 7,
              face = "bold",
              color = "black") +
  theme(legend.position = "none")+
# labs(subtitle = "Data")+
 ## ggtitle(otsikko) +
 labs(title = otsikko,
             subtitle = alaotsikko,
             caption =footeri)+
 theme(plot.title = element_text(size = 18, face = "bold")) +
 theme(plot.subtitle = element_text(size = 14, face = "bold")) +
 theme(plot.caption = element_text(size = 16, face = "bold")) +
 theme(axis.text=element_text(size=15),
       axis.title=element_text(size=15,face="bold")) +
# theme(legend.key.size = unit(2, 'cm')) +
 xlab("Pituusaste")+
 ylab("Leveysaste") +
 ##scale_fill_viridis_c()
  scale_fill_viridis_c(

breaks = my_breaks, labels = my_breaks, option = "viridis", trans = scales::pseudo_log_trans(sigma = 0.001) )



svg(filename=tulosfilee1, width=widthi, height=heighti, pointsize=12)

p2

dev.off()


Licensing

edit
I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current11:08, 20 June 2021Thumbnail for version as of 11:08, 20 June 2021450 × 720 (203 KB)Merikanto (talk | contribs)Correction: year
11:05, 20 June 2021Thumbnail for version as of 11:05, 20 June 2021450 × 720 (197 KB)Merikanto (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

Metadata