Skip to content

Commit

Permalink
Merge pull request #57 from publichealthengland/development
Browse files Browse the repository at this point in the history
development -> master
  • Loading branch information
adebayoolabintan committed Mar 13, 2023
2 parents ab25cac + ea418f3 commit 42f7a91
Show file tree
Hide file tree
Showing 8 changed files with 174 additions and 170 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![GitHub commit activity](https://img.shields.io/github/commit-activity/y/publichealthengland/coronavirus-dashboard-summary)

This is the source code for the [Coronavirus Dashboard](https://coronavirus.data.gov.uk) serving the home page and postcode page.
This is the source code for the [Coronavirus Dashboard](https://coronavirus.data.gov.uk) serving the home page and postcode page.

## Other services

Expand Down Expand Up @@ -87,3 +87,5 @@ additional information.

## Credits
This service is developed and maintained by [UK Health Security Agency](https://www.gov.uk/government/organisations/uk-health-security-agency).


4 changes: 2 additions & 2 deletions coronavirus_dashboard_summary/Models/Metrics.fs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ let PostCodeMetrics =
"cumVaccinationFirstDoseUptakeByVaccinationDatePercentage"
"cumVaccinationSecondDoseUptakeByVaccinationDatePercentage"
"cumVaccinationThirdInjectionUptakeByVaccinationDatePercentage"
"cumPeopleVaccinatedAutumn22ByVaccinationDate"
"cumVaccinationAutumn22UptakeByVaccinationDatePercentage"
"cumPeopleVaccinatedAutumn22ByVaccinationDate50+"
"cumVaccinationAutumn22UptakeByVaccinationDatePercentage50+"
"newDeaths28DaysByDeathDate"
"newDeaths28DaysByDeathDateChange"
"newDeaths28DaysByDeathDateChangePercentage"
Expand Down
4 changes: 2 additions & 2 deletions coronavirus_dashboard_summary/Models/Models.HomePage.fs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ FROM (
JOIN covid19.area_reference AS ar ON ar.id = main.area_id
WHERE
area_type = 'overview'
AND date > ( DATE(@date) - INTERVAL '30 days' )
AND date > ( DATE(@date) - INTERVAL '40 days' )
AND metric = ANY( @metrics::VARCHAR[] )
GROUP BY area_type, area_code, date, metric
) AS result
Expand Down Expand Up @@ -80,7 +80,7 @@ let private fetch (redis: Redis.Client) (date: TimeStamp.Release) (metrics: stri
$"area-{date.isoDate}-ENGLAND"
result
{
hours = Random().Next(3, 12)
hours = 5000
minutes = Random().Next(0, 60)
seconds = Random().Next(0, 60)
}
Expand Down
4 changes: 2 additions & 2 deletions coronavirus_dashboard_summary/Models/Models.Metadata.fs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ let CardMetadata: ContentMetadata[] = [|
description = null
}
{
metric = "cumVaccinationAutumn22UptakeByVaccinationDatePercentage"
metric = "cumVaccinationAutumn22UptakeByVaccinationDatePercentage50+"
rate = null
sum = null
caption = "Boosters"
Expand All @@ -113,7 +113,7 @@ let CardMetadata: ContentMetadata[] = [|
description = null
}
{
metric = "PeopleVaccinatedAutumn22ByVaccinationDate"
metric = "cumPeopleVaccinatedAutumn22ByVaccinationDate50+"
rate = null
sum = null
caption = "Boosters"
Expand Down
59 changes: 30 additions & 29 deletions coronavirus_dashboard_summary/Templates/Base.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ open coronavirus_dashboard_summary.Templates.Footer
open coronavirus_dashboard_summary.Templates.Header

module Base =

[<IsReadOnly>]
type LayoutPayload =
{
Expand All @@ -22,15 +22,15 @@ module Base =
postcode: string
error: bool
}

let private ApiEnv = Environment.GetEnvironmentVariable "API_ENV"

let private localZone = TimeZoneInfo.FindSystemTimeZoneById("Europe/London")

[<Literal>]
let private PageDescription =
"Official Coronavirus (COVID-19) disease situation dashboard with latest data in the UK."

let private envMetaTags =
match ApiEnv with
| "PRODUCTION" ->
Expand All @@ -46,7 +46,7 @@ module Base =
meta [ _name "googlebot-news"; _content "noindex,nosnippet,nofollow" ]
meta [ _name "AdsBot-Google"; _content "noindex,nofollow" ]
]

let inline private TailCards ( content: XmlNode ): XmlNode =
article [] [
header [] [
Expand All @@ -56,7 +56,7 @@ module Base =
]
div [ _class "card-container double-row" ] [
content

section [
_class "mini-card map-view"
_itemtype "https://schema.org/WebContent"
Expand Down Expand Up @@ -96,7 +96,7 @@ module Base =
]
a [ _href "/details/interactive-map/cases"; _class "govuk-button"; _rel "nofollow" ] [
encodedText "View maps"
]
]
]
]
div [ _style "text-align: center"; _ariaHidden "true"; _itemprop "thumbnailUrl" ] [
Expand All @@ -114,14 +114,14 @@ module Base =
]
]
]

type LayoutPayload with

member this.Render (content: XmlNode list): XmlNode =
// Windows only:
// let localZone = TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time")
let localDate = TimeZoneInfo.ConvertTime(this.date.timestamp, TimeZoneInfo.Utc, localZone)

html [_lang "en"; _itemtype "https://schema.org/WebSite"; _itemscope] [
head [] [
meta [_charset "utf-8"]
Expand All @@ -134,9 +134,9 @@ module Base =
meta [ _property "og:locale"; _content "en_GB" ]
meta [ _name "instrumentation_key"; _content Generic.InstrumentationKey ]
baseTag [ _href Generic.UrlLocation ]

yield! envMetaTags

meta [
_property "og:image"
_content $"{Generic.UrlLocation}/public/assets/summary/images/opengraph-image.png"
Expand All @@ -149,24 +149,24 @@ module Base =
_itemprop "copyrightNotice"
_content "All content is available under the Open Government Licence v3.0; except where otherwise stated."
]

meta [ _name "description"; _itemprop "abstract"; _content PageDescription ]
meta [ _name "og:description"; _content PageDescription ]
meta [ _name "twitter:description"; _content PageDescription ]

meta [ _name "logo"; _content $"{Generic.UrlLocation}/public/assets/summary/icon/favicon.png" ]

link [ _rel "apple-touch-icon"; _href $"{Generic.UrlLocation}/public/assets/summary/icon/favicon.png" ]
link [ _rel "icon"; _href $"{Generic.UrlLocation}/public/assets/summary/icon/favicon.ico" ]
link [ _rel "manifest"; _href $"{Generic.UrlLocation}/manifest.json" ]

meta [ _property "url"; _itemprop "url"; _content Generic.UrlLocation ]
meta [ _property "og:url"; _content Generic.UrlLocation ]

title [ _itemprop "name" ] [ encodedText $"{ this.title } | Coronavirus (COVID-19) in the UK" ]
meta [ _property "og:title"; _content $"{ this.title } | Coronavirus (COVID-19) in the UK" ]
meta [ _name "twitter:title"; _content $"{ this.title } | Coronavirus (COVID-19) in the UK" ]

link [
_rel "preload"
_as "font"
Expand All @@ -188,22 +188,23 @@ module Base =
_crossorigin
_href $"{Generic.UrlLocation}/public/assets/summary/css/application.css"
]

link [
_rel "stylesheet"
_type "text/css"

match Generic.IsDev with
| false -> $"{Generic.UrlLocation}/public/assets/summary/css/application.css"
| true -> "css/application.css"
|> _href
// | true -> "css/application.css"
| true -> "https://coronavirus.data.gov.uk/public/assets/summary/css/application.css"
|> _href
]

script [ _type "application/javascript"; _async; _src "https://www.google-analytics.com/analytics.js"] []
script [ _type "application/javascript"; _async; _src $"{Generic.UrlLocation}/public/assets/summary/js/mscl.js"] []
script [ _type "application/javascript"; _src $"{Generic.UrlLocation}/public/assets/summary/js/gat.js"] []
script [ _type "application/javascript"; _async; _src $"{Generic.UrlLocation}/public/assets/summary/js/cookies.js"] []

style [ _type "text/css" ] [
match this.banners.changeLogs with
| None -> String.Empty
Expand All @@ -213,15 +214,15 @@ module Base =
]
body [ _class "govuk-template__body" ] [
yield! GovUKHeader

Navigation.RenderMobile

match this.banners.changeLogs with
| None -> String.Empty |> rawText
| Some v -> v

this.banners.announcements

div [ _class "govuk-width-container" ] [
div [ _class "govuk-!-margin-top-5 govuk-!-margin-bottom-5"; attr "role" "region"; _ariaLabelledBy "last-update"] [
p [ _class "govuk-body-s"; _id "last-update" ] [
Expand All @@ -243,7 +244,7 @@ module Base =
Navigation.RenderDesktop
main [ _class "main"; _id "main-content" ] [
yield! content

match this.error with
| false -> PostCodeSearch.Render this.postcode |> TailCards
| true -> rawText String.Empty
Expand All @@ -255,4 +256,4 @@ module Base =
script [ _type "application/javascript"; _defer; _src $"{Generic.UrlLocation}/public/assets/summary/js/msai.js"] []
script [ _type "application/javascript"; _defer; _src $"{Generic.UrlLocation}/public/assets/summary/js/mobile_menu.js"] []
]
]
]
Loading

0 comments on commit 42f7a91

Please sign in to comment.