Difference between revisions of "Codebase"
Jump to navigation
Jump to search
(→wikidocumentaries) |
(→Global variables) |
||
Line 39: | Line 39: | ||
** admin | ** admin | ||
* topicStartYear | * topicStartYear | ||
+ | |||
+ | ===basemaps=== | ||
+ | * id | ||
+ | * title | ||
+ | * imageURL | ||
+ | * year | ||
+ | * server | ||
+ | * warperID | ||
+ | * municipality | ||
+ | * country | ||
==Data flow== | ==Data flow== |
Revision as of 07:15, 11 January 2019
Navigate the codebase
Global variables
wikidocumentaries
Reads all values at time of page load from Wikipedia and Wikidata and prepares for the app. Stored, updated add addressed at @/store/store.js
- title - Wikidata title in the user's language. Add a fallback option and create a new property with knowledge about the original value (boolean exists or empty data).
- description - Wikidata title in the user's language. Add a fallback option and create a new property with knowledge about the original value (boolean exists or empty data).
- headerImageURL
- wikipedia
- excerptHTML - summary part of the Wikipedia article
- remainingHTML - remaining part of the Wikipedia article as a separate object.
- wikipediaURL - link to the Wikipedia article in the user's language
- wikidata
- id
- instance_of
- id
- value
- url
- statements
- id
- label
- value - This returns a string for an object, and the QID is only in the URL. The QID should be extracted already before this?
- url
- dates
- images
- id
- source
- imageURL
- title
- authors
- institutions
- infoURL
- location
- geoLocations
- year
- license
- geo
- location
- admin
- topicStartYear
basemaps
- id
- title
- imageURL
- year
- server
- warperID
- municipality
- country
Data flow
In components e.g.
- method wikidocumentaries
- $store.state.wikidocumentaries
store/store.js
const wikidocumentaries = { title: 'Vapaamuurarin hauta', description: 'Muistomerkki Helsingissä', headerImageURL: 'https://upload.wikimedia.org/wikipedia/commons/b/bf/Helsinki_Kaisaniemi_Freemason%27s_grave_1908_I_K_Inha.png', wikipedia: { excerptHTML: null, remainingHTML: null, wikipediaURL: 'https://fi.wikipedia.org/wiki/Vapaamuurarin_hauta' }, wikidata: { id: 'Q5501061', instance_of: { id: 'Q5003624', value: 'muistomerkki', url: 'https://www.wikidata.org/wiki/Q5003624' }, statements: [ { id: 'P361', label: 'osa kohdetta', value: 'Kaisaniemen puisto ja kasvitieteellinen puutarha', url: 'https://www.wikidata.org/wiki/Q30506322' }, dates: [], }, images: [ { id: 'musketti.M012:HK19670603:7117', source: 'finna', imageURL: "https://www.finna.fi/Cover/Show?id=musketti.M012:HK19670603:7117&index=0&size=large", title: "Vapaamuurarin hauta Kaisaniemessä", authors: "Pietinen", institutions: "Museovirasto", infoURL: "https://www.finna.fi/Record/musketti.M012:HK19670603:7117", location: "Helsinki,", geoLocations: ["POLYGON((24.7828131 60.0999549, 24.8356577 60.130414, 24.8513844 60.2249765, 24.8419098 60.2212043, 24.8347825 60.2585099, 24.8677628 60.2523073, 24.9473908 60.2784652, 24.9731653 60.2643801, 25.0209862 60.2893227, 25.0882105 60.2713417, 25.0823359 60.2496391, 25.1358461 60.2372286, 25.1598757 60.2488133, 25.1425242 60.2697779, 25.2545116 60.2952274, 25.2509121 60.2734979, 25.2273451 60.2611057, 25.240926 60.246305, 25.2014099 60.2181613, 25.2204176 60.1997262, 25.1800446 60.0987408, 25.1693516 59.9434386, 24.9423061 59.922486, 24.7828131 60.0999549))"], year: 1932, license: "CC BY 4.0" }, ], geo: { location: "POINT(24.943752 60.176013)", admin: "Helsinki" }, topicStartYear: 1784, } export default new Vuex.Store({ state: { wikidocumentariesDataState: WIKI.STATES.UNINITIALIZED, wikidocumentaries: wikidocumentaries, shownImages: [], timelineImages: [], historicalMapSearchPageMap: null, historicalMaps: [], basemaps: basemaps, selectedBasemaps: [], selectedBasemapOpacity: 0.7, shouldFitMapToBasemap: false, photoOfTheDay: "https://upload.wikimedia.org/wikipedia/commons/a/ad/Kulutusosuuskuntien_Keskusliiton_kokoelma_D1974_11333A_%2830804608561%29.jpg", mapOfTheDay: { id: "File:1900_Plan_af_Helsingfors_stad.tif", warperID: 148, server: "http://warper.wmflabs.org/", coordinates: [24.9351, 60.1658], }, nearbyWikiItems: [], }, getters: { topicStartYear: state => { } }, mutations: { resetState(state) { state.wikidocumentariesDataState = WIKI.STATES.UNINITIALIZED; state.wikidocumentaries = { title: null, description: null, headerImageURL: null, wikipedia: { excerptHTML: null, remainingHTML: null, wikipediaURL: null, }, wikidata: { id: null, instance_of: { id: null, value: null, url: null }, statements: [], dates: [], }, images: [], geo: { location: null, scale: null, admin: null }, topicStartYear: null }; state.shownImages = []; state.timelineImages = []; state.historicalMapSearchPageMap = null; state.historicalMaps = []; state.basemaps = basemaps; state.selectedBasemaps = []; state.selectedBasemapOpacity = 0.7; state.shouldFitMapToBasemap = false; state.nearbyWikiItems = []; }, setImagesShownOnMap(state, images) { state.shownImages = images; }, setImagesShownOnTimeline(state, images) { state.timelineImages = images; }, setHistoricalMapSearchPageMap(state, map) { state.historicalMapSearchPageMap = map; }, setHistoricalMaps(state, maps) { state.historicalMaps = maps; }, setSelectedBasemap(state, mapInfo) { state.selectedBasemaps = [mapInfo]; }, setSelectedBasemaps(state, mapInfos) { state.selectedBasemaps = mapInfos; }, setSelectedBasemapOpacity(state, opacity) { state.selectedBasemapOpacity = opacity; }, setShouldFitMapToBasemap(state, value) { state.shouldFitMapToBasemap = value; }, setWikidocumentariesTopicTitle(state, title) { state.wikidocumentaries.title = title; }, setWikidocumentariesTopicDescription(state, description) { state.wikidocumentaries.description = description; }, setWikidata(state, wikidata) { state.wikidocumentaries.wikidata = wikidata; }, setWikidataId(state, wikidataId) { state.wikidocumentaries.wikidataId = wikidataId; }, setHeaderImageURL(state, URL) { state.wikidocumentaries.headerImageURL = URL; }, setWikipediaExcerptHTML(state, html) { state.wikidocumentaries.wikipedia.excerptHTML = html; }, setWikipediaRemainingHTML(state, html) { state.wikidocumentaries.wikipedia.remainingHTML = html; }, setWikipediaURL(state, URL) { state.wikidocumentaries.wikipedia.wikipediaURL = URL; }, setTopicGeoLocation(state, coordinates) { state.wikidocumentaries.geo.location = "POINT(" + coordinates.lon + " " + coordinates.lat + ")" }, setWikidocumentariesDataState(state, value) { state.wikidocumentariesDataState = value; }, setWikidocumentariesImages(state, images) { state.wikidocumentaries.images = images; }, setTopicStartYear(state, year) { state.wikidocumentaries.topicStartYear = year; }, setHistoricalBasemaps(state, basemaps) { state.basemaps = basemaps; if (basemaps.length > 0) { state.selectedBasemaps = [basemaps[0]]; } }, setNearbyWikiItems(state, items) { state.nearbyWikiItems = items; } }, actions: { updateWikidocumentaries({dispatch, commit}, params) { }, async getWikiDocumentariesData(context, params) { }, async getTopicImages({dispatch, commit}, params) { }, async getHistoricalMaps({dispatch, commit}, locationParams) { }, async getHistoricalMapsFromCommons(context, params) { }, async getHistoricalMapsFromFinna(context, params) { }, async getNearbyPlaces(context, params) { } } }); function isWikidataBasedUnchangableStartYear(wikidocumentaries) { } function calculateTopicStartYearFromWikidata(wikidata, currentStartYear) { } function createGetCommonsMapInfoTask(fileName) { }