Skip to content

Commit

Permalink
Merge pull request #175 from PublicHealthEngland/development
Browse files Browse the repository at this point in the history
Download links in the archives

No conflict detected.
  • Loading branch information
xenatisch authored May 29, 2020
2 parents 52be03d + 2d0ab91 commit c5fb446
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "covid-public",
"version": "1.7.0",
"version": "1.7.1",
"private": true,
"homepage": "https://coronavirus.data.gov.uk/",
"dependencies": {
Expand Down
21 changes: 11 additions & 10 deletions src/pages/Archive/Archive.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,28 +144,29 @@ export default class Archive extends Component<ArchiveProps, {}> {
{ data } = await axios.get(this.#url, { responseType: 'document' }),
nameParser = /^(\w+)\/dated\/coronavirus-(\w+)_(\d{4})(\d{2})(\d{2}).*$/,
contents = getSortedPaths(
data.evaluate(`//Blob/Name[starts-with(text(), 'json/dated')]`,
data.evaluate(`//Blob/Name[starts-with(text(), 'json/dated/coronavirus-cases')]`,
data, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null
))
), 'json')
.reduce(
(acc: Array<Array<string>, Array<string>>, item: string) => {

const deaths = item.replace(/cases/g, "deaths")

acc[0].push([
acc = [
...acc,
item.replace(/json/g, "csv"),
deaths.replace(/json/g, "csv")
])
acc[1].push([item, deaths])
deaths.replace(/json/g, "csv"),
item,
deaths
]

return acc

},
[[], []])
.map(item => item.map( v => nameParser.exec(v) ));
}, [])
.map(item => nameParser.exec(item));

this.setState({
data: groupByDate(contents),
data: groupByDate([contents]),
loading: false
})

Expand Down

0 comments on commit c5fb446

Please sign in to comment.