summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scraper/client/actions.js12
-rw-r--r--scraper/client/app.js20
-rw-r--r--scraper/client/paper/index.js2
-rw-r--r--scraper/client/paper/paper.address.js2
-rw-r--r--scraper/client/paper/paper.citations.js7
-rw-r--r--scraper/client/paper/paper.css12
-rw-r--r--scraper/client/paper/paper.verify.js61
-rw-r--r--scraper/s2-geocode-server.py7
8 files changed, 64 insertions, 59 deletions
diff --git a/scraper/client/actions.js b/scraper/client/actions.js
index 8a1f13a6..1f7baf97 100644
--- a/scraper/client/actions.js
+++ b/scraper/client/actions.js
@@ -3,8 +3,9 @@ import * as types from './types'
export const api = (dispatch, method, tag, url, params) => {
dispatch({ type: types.api.loading, tag })
- method(url, params).then(data => {
+ return method(url, params).then(data => {
dispatch({ type: types.api.loaded, tag, data })
+ return data
}).catch(err => {
dispatch({ type: types.api.error, tag, err })
})
@@ -31,12 +32,13 @@ export const postAddress = data => dispatch => {
api(dispatch, post, 'address', '/api/address/add', data)
}
-export const getVerification = sha256 => dispatch => {
+export const getVerification = sha256 => dispatch => (
api(dispatch, get, 'address', '/api/verify/' + sha256, {})
-}
+)
-export const postVerification = data => dispatch => {
+export const postVerification = data => dispatch => (
api(dispatch, post, 'address', '/api/verify/add', data)
-}
+)
+
diff --git a/scraper/client/app.js b/scraper/client/app.js
index ab7e2ca7..dc5c6fe6 100644
--- a/scraper/client/app.js
+++ b/scraper/client/app.js
@@ -31,23 +31,3 @@ export default class App extends Component {
)
}
}
-// <Route path="/search/" component={Search.Menu} />
-// <Route path="/metadata/:hash/" component={Metadata.Heading} />
-// <Switch>
-// <Route exact path="/metadata/:hash/summary/" component={Metadata.Summary} />
-// <Route exact path="/metadata/:hash/mediaRecord/" component={Metadata.MediaRecord} />
-// <Route exact path="/metadata/:hash/mediaInfo/" component={Metadata.MediaInfo} />
-// <Route exact path="/metadata/:hash/keyframe/:frame/" component={Metadata.KeyframeSingle} />
-// <Route exact path="/metadata/:hash/keyframe/" component={Metadata.KeyframeList} />
-// <Route exact path="/metadata/:hash/coco/" component={Metadata.Coco} />
-// <Route exact path="/metadata/:hash/places365/" component={Metadata.Places365} />
-// <Route exact path="/metadata/:hash/sugarcube/" component={Metadata.Sugarcube} />
-// <Route exact path="/metadata/:hash/" component={Metadata.Summary} />
-// <Route exact path="/metadata/" render={() => <div className='notFound'><h4>NOT FOUND</h4></div>} />
-// <Route exact path="/search/" component={Search.Container} />
-// <Route exact path="/search/keyframe/:verified/:hash/:frame/" component={Search.Container} />
-// <Route exact path="/search/keyframe/:hash/:frame/" component={Search.Container} />
-// <Route exact path="/search/browse/:hash/" component={Search.Browse} />
-// <Route exact path="/search/random/" component={Search.Random} />
-// <Route exact path="/search/review/" component={Review.Saved} />
-// </Switch>
diff --git a/scraper/client/paper/index.js b/scraper/client/paper/index.js
index 4fad0316..99672684 100644
--- a/scraper/client/paper/index.js
+++ b/scraper/client/paper/index.js
@@ -4,6 +4,7 @@ import Citations from './paper.citations'
import UnknownCitations from './paper.unknown'
import Random from './paper.random'
import Address from './paper.address'
+import Verify from './paper.verify'
import './paper.css'
// import './search.css'
@@ -15,4 +16,5 @@ export {
UnknownCitations,
Random,
Address,
+ Verify,
}
diff --git a/scraper/client/paper/paper.address.js b/scraper/client/paper/paper.address.js
index 90e28139..00532570 100644
--- a/scraper/client/paper/paper.address.js
+++ b/scraper/client/paper/paper.address.js
@@ -283,7 +283,7 @@ class PaperAddress extends Component {
>{'Next >'}</button>
</div>
- <iframe className='pdfViewer' src={citation.pdf[this.state.pdf_index]} />
+ <iframe className='pdfViewer' referrerPolicy='no-referrer' src={citation.pdf[this.state.pdf_index]} />
</div>
)
}
diff --git a/scraper/client/paper/paper.citations.js b/scraper/client/paper/paper.citations.js
index 1789a815..41ddd55e 100644
--- a/scraper/client/paper/paper.citations.js
+++ b/scraper/client/paper/paper.citations.js
@@ -12,6 +12,7 @@ class PaperCitations extends Component {
const { dataset, citations } = this.props.api.paperInfo
if (!dataset || !citations) return null
console.log('rendering citations...')
+ console.log(citations)
return (
<div className='citations'>
<h2>{dataset.name_full}: Citations</h2>
@@ -20,16 +21,16 @@ class PaperCitations extends Component {
let cite = { ...citation }
cite.id = {
_raw: true,
- value: <Link to={'/paper/' + dataset.key + '/address/' + citation.id}>{citation.id}</Link>
+ value: <Link to={'/paper/' + dataset.key + '/verify/' + citation.id}>{citation.id}</Link>
}
cite.pdf = {
_raw: true,
- value: cite.pdf ? <a href={cite.pdf} rel='noopener noreferrer' target="_blank">[pdf]</a> : "no pdf"
+ value: (cite.pdf && cite.pdf.length) ? <a href={cite.pdf[0]} rel='noopener noreferrer' target="_blank">[pdf]</a> : "no pdf"
}
cite.addresses = {
_raw: true,
value: cite.addresses.map((address, j) => (
- <div key={j}>{address.address}{', '}<span className='type'>{address.type}</span></div>
+ <div key={j}>{address.name}{', '}<span className='type'>{address.type}</span></div>
))
}
return (
diff --git a/scraper/client/paper/paper.css b/scraper/client/paper/paper.css
index 91469e17..82b95d9c 100644
--- a/scraper/client/paper/paper.css
+++ b/scraper/client/paper/paper.css
@@ -33,7 +33,9 @@
justify-content: flex-start;
align-items: flex-start;
}
-input.notes { width: 400px; }
+input.notes {
+ width: 400px;
+}
.param .btn {
margin-top: 5px;
}
@@ -41,6 +43,14 @@ input.notes { width: 400px; }
width: 250px;
margin-right: 10px;
}
+.param label {
+ display: block;
+ padding: 4px;
+ min-width: 140px;
+}
+.param input[type=checkbox] {
+ margin: 6px 0;
+}
.pdf_links a.selected {
font-weight: bold;
diff --git a/scraper/client/paper/paper.verify.js b/scraper/client/paper/paper.verify.js
index cfce8f28..570899d5 100644
--- a/scraper/client/paper/paper.verify.js
+++ b/scraper/client/paper/paper.verify.js
@@ -10,7 +10,8 @@ import { Loader, Autocomplete } from '../common'
const initialState = {
citation: null,
- verify: '',
+ uses_paper: false,
+ doesnt_use_paper: false,
verified_by: '',
notes: '',
pdf_index: 0,
@@ -24,7 +25,7 @@ class PaperVerify extends Component {
const { sha256 } = this.props.match.params
this.props.actions.getInstitutions()
this.props.actions.getVerification(sha256)
- const citationState = this.getVerificationState(sha256)
+ const citationState = this.getCitationState(sha256)
console.log('DID MOUNT')
this.setState(citationState)
}
@@ -55,12 +56,14 @@ class PaperVerify extends Component {
})
} else {
// console.log(paper)
- console.log('GOT CUSTOM ADDRESS')
+ console.log('GOT CUSTOM CITATION STATE')
const citationState = this.getCitationState(sha256)
this.setState({
...citationState,
- verified: paper.verified,
+ uses_paper: paper.uses_paper,
+ doesnt_use_paper: paper.doesnt_use_paper,
verified_by: paper.verified_by,
+ notes: paper.notes,
})
}
} else if (oldProps.api.unknownCitations !== this.props.api.unknownCitations) {
@@ -77,12 +80,6 @@ class PaperVerify extends Component {
}
// console.log(sha256, citation)
let state = { citation }
- let addresses = citation ? citation.addresses : []
- if (addresses) {
- addresses.forEach((address, i) => {
- state['institution_' + (i + 1)] = address.address
- })
- }
return state
}
@@ -91,7 +88,8 @@ class PaperVerify extends Component {
this.props.actions.postVerification({
paper_id: this.state.citation.id,
title: this.state.citation.title,
- verified: this.state.verified,
+ uses_paper: this.state.uses_paper,
+ doesnt_use_paper: this.state.doesnt_use_paper,
verified_by: this.state.verified_by,
notes: this.state.notes,
})
@@ -100,31 +98,31 @@ class PaperVerify extends Component {
next() {
const { key } = this.props.api.paperInfo.dataset
- const { unknownCitations } = this.props.api
- let citationIndex = (unknownCitations.citations || [])
+ const { paperInfo } = this.props.api
+ let citationIndex = (paperInfo.citations || [])
.findIndex(f => f.id === this.state.citation.id)
if (citationIndex === -1) {
history.push('/paper/' + key + '/info/')
} else {
citationIndex += 1
- if (citationIndex >= unknownCitations.length) {
+ if (citationIndex >= paperInfo.citations.length) {
history.push('/paper/' + key + '/info/')
} else {
- let nextId = unknownCitations.citations[citationIndex].id
- history.push('/paper/' + key + '/address/' + nextId)
+ let nextId = paperInfo.citations[citationIndex].id
+ history.push('/paper/' + key + '/verify/' + nextId)
}
}
}
render() {
- let { paperInfo, unknownCitations } = this.props.api
- if (paperInfo.loading || unknownCitations.loading) return <Loader />
- console.log(this.state)
+ let { paperInfo } = this.props.api
+ if (paperInfo.loading) return <Loader />
+ // console.log(this.state)
const { citation } = this.state
if (!citation) {
return <div>Citation not found in this paper</div>
}
- console.log(citation)
+ // console.log(citation)
return (
<div className='form'>
<h3>{citation.title}</h3>
@@ -146,27 +144,38 @@ class PaperVerify extends Component {
</div>
<div className='param'>
+ <label>Uses the paper?</label>
<input
className='vetting'
type='checkbox'
- value={this.state.verified}
- onChange={e => this.setState({
- verified: e.target.value,
- })}
+ checked={!!this.state.uses_paper}
+ onChange={e => this.setState({ uses_paper: e.target.checked })}
/>
</div>
<div className='param'>
+ <label>{"Doesn't use paper"}</label>
+ <input
+ className='vetting'
+ type='checkbox'
+ checked={!!this.state.doesnt_use_paper}
+ onChange={e => this.setState({ doesnt_use_paper: e.target.checked })}
+ />
+ </div>
+
+ <div className='param'>
+ <label>Verified by:</label>
<input
type='text'
className='verified_by'
value={this.state.verified_by}
placeholder='Verified by'
- onChange={e => this.setState({ notes: e.target.value })}
+ onChange={e => this.setState({ verified_by: e.target.value })}
/>
</div>
<div className='param'>
+ <label>Notes</label>
<input
type='text'
className='notes'
@@ -189,7 +198,7 @@ class PaperVerify extends Component {
>{'Next >'}</button>
</div>
- <iframe className='pdfViewer' src={citation.pdf[this.state.pdf_index]} />
+ <iframe className='pdfViewer' referrerPolicy='no-referrer' src={citation.pdf[this.state.pdf_index]} />
</div>
)
}
diff --git a/scraper/s2-geocode-server.py b/scraper/s2-geocode-server.py
index 62e01b0d..ee5d3165 100644
--- a/scraper/s2-geocode-server.py
+++ b/scraper/s2-geocode-server.py
@@ -117,11 +117,12 @@ def find_verification(sha256):
def add_verifications():
form = request.get_json()
print(form)
- # id, title, verified, verified_by, notes
- locations_worksheet.append_row([
+ # id, title, uses_paper, verified_by, notes
+ verifications_worksheet.append_row([
form['paper_id'],
form['title'],
- form['verified'],
+ form['uses_paper'],
+ form['doesnt_use_paper'],
form['verified_by'],
form['notes'],
])