Модуль:Песочница/D6194c-1cc/WDMedCondition

Материал из Википедии — свободной энциклопедии
Перейти к навигации Перейти к поиску
Документация
local p = {}
local wikidata = require('Модуль:WDCommon')
local backend = require('Модуль:WDBackend')

function p.fetch(source)
	local defaultLangObj = mw.getContentLanguage()
	local defaultLangCode = defaultLangObj:getCode()

	local f = backend.new(defaultLangCode)

	f:fetch(source, {
		{
			name = 'name',
			get = {
				{
					name = 'name',
					getValue = wikidata.name,
				},
				{
					name = 'image',
					property = 'P18',
					max = 1,
					qualifiers = {
						{
							name = 'imageDescription',
							property = 'P2096',
							filter = wikidata.base.tryFilterSnaksByLang,
						},
					},
				},
				{
					name = 'conditionType',
					property = 'P31',
					allowedEntities = { 'Q18123741', 'Q609748', 'Q3508753', 'Q12136' },
				},
				{
					name = 'location',
					property = 'P927',
					isArray = true,
				},
				{
					name = 'afflicts',
					property = 'P689',
					isArray = true,
				},
				{
					name = 'symptoms',
					property = 'P780',
					isArray = true,
				},
				{
					name = 'transmission',
					property = 'P1060',
					isArray = true,
				},
				{
					name = 'cause',
					property = 'P828',
					isArray = true,
				},
				{
					name = 'notCause',
					property = 'P9353',
					isArray = true,
				},
				{
					name = 'specialities',
					property = 'P1995',
					isArray = true,
				},
				{
					name = 'minIncubationPeriod',
					property = 'P3488',
					max = 1,
				},
				{
					name = 'maxIncubationPeriod',
					property = 'P3487',
					max = 1,
				},
				{
					name = 'naturalHostSpecies',
					property = 'P1605',
				},
			},
		},
	})

	return source
end

return p