From d6af041b487b4cb29ab9ca7ebe88a730a7936edb Mon Sep 17 00:00:00 2001 From: Alfredo Jirout Cid <144898617+UO288443@users.noreply.github.com> Date: Tue, 6 Feb 2024 09:27:27 +0100 Subject: [PATCH 01/67] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7e6aa075..60cc45a3 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ |Martín Cancio Barrera | UO287561 | [Mi github](https://github.com/CANCI0) |Iyán Fernández Riol | UO288231 | [Mi github](https://github.com/iyanfdezz) |Rodrigo García Iglesias | UO276396 | [Mi github](https://github.com/Rodrox11) -|Miguel Olamendi Alonso | UO285032 | [Mi github](https://github.com/uo285032) +|Alfredo Jirout Cid | UO288443 | [Mi github](https://github.com/uo288443) ## Introduction to our project [![Deploy on release](https://github.com/Arquisoft/wiq_es1a/actions/workflows/release.yml/badge.svg)](https://github.com/Arquisoft/wiq_es1a/actions/workflows/release.yml) From e139e19a1750b9f9a102df92d248cff5c5733ef2 Mon Sep 17 00:00:00 2001 From: UO288443 Date: Tue, 6 Feb 2024 10:37:53 +0100 Subject: [PATCH 02/67] Prueba --- docs/package-lock.json | 388 +++++++++++++++++++++++- docs/package.json | 11 +- docs/src/01_introduction_and_goals.adoc | 7 +- 3 files changed, 395 insertions(+), 11 deletions(-) diff --git a/docs/package-lock.json b/docs/package-lock.json index ab1646f2..ae39a379 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -1,11 +1,10 @@ { "name": "docs", "version": "1.0.0", - "lockfileVersion": 3, + "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "docs", "version": "1.0.0", "dependencies": { "gh-pages": "^3.2.3", @@ -540,5 +539,390 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" } + }, + "dependencies": { + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha512-Dxr6QJj/RdU/hCaBjOfxW+q6lyuVE6JFWIrAUpuOOhoJJoQ99cUn3igRaHVB5P9WrgFVN0FfArM3x0cueOU8ng==", + "requires": { + "array-uniq": "^1.0.1" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q==" + }, + "async": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", + "requires": { + "lodash": "^4.17.14" + } + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "email-addresses": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/email-addresses/-/email-addresses-3.1.0.tgz", + "integrity": "sha512-k0/r7GrWVL32kZlGwfPNgB2Y/mMXVTq/decgLczm/j34whdaspNrZO8CnXPf1laaHxI6ptUlsnAxN+UAPw+fzg==" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" + }, + "filename-reserved-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", + "integrity": "sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ==" + }, + "filenamify": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-4.3.0.tgz", + "integrity": "sha512-hcFKyUG57yWGAzu1CMt/dPzYZuv+jAJUT85bL8mrXvNe6hWj6yEHEc4EdcgiA6Z3oi1/9wXJdZPXF2dZNgwgOg==", + "requires": { + "filename-reserved-regex": "^2.0.0", + "strip-outer": "^1.0.1", + "trim-repeated": "^1.0.0" + } + }, + "find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "requires": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==" + }, + "gh-pages": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/gh-pages/-/gh-pages-3.2.3.tgz", + "integrity": "sha512-jA1PbapQ1jqzacECfjUaO9gV8uBgU6XNMV0oXLtfCX3haGLe5Atq8BxlrADhbD6/UdG9j6tZLWAkAybndOXTJg==", + "requires": { + "async": "^2.6.1", + "commander": "^2.18.0", + "email-addresses": "^3.0.1", + "filenamify": "^4.3.0", + "find-cache-dir": "^3.3.1", + "fs-extra": "^8.1.0", + "globby": "^6.1.0" + } + }, + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "globby": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "integrity": "sha512-KVbFv2TQtbzCoxAnfD6JcHZTYCzyliEaaeM/gH8qQdkKr5s0OP9scEgvdcngyk7AVdY6YVW/TJHd+lQ/Df3Daw==", + "requires": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "requires": { + "function-bind": "^1.1.2" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==" + }, + "is-core-module": { + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "requires": { + "hasown": "^2.0.0" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "requires": { + "p-locate": "^4.1.0" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "requires": { + "semver": "^6.0.0" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "requires": { + "wrappy": "1" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==" + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==" + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", + "requires": { + "pinkie": "^2.0.0" + } + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "requires": { + "find-up": "^4.0.0" + } + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "requires": { + "resolve": "^1.1.6" + } + }, + "resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "requires": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==" + }, + "shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + } + }, + "shx": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.4.tgz", + "integrity": "sha512-N6A9MLVqjxZYcVn8hLmtneQWIJtp8IKzMP4eMnx+nqkvXoqinUPCbUFLp2UcWTEIUONhlk0ewxr/jaVGlc+J+g==", + "requires": { + "minimist": "^1.2.3", + "shelljs": "^0.8.5" + } + }, + "strip-outer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", + "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", + "requires": { + "escape-string-regexp": "^1.0.2" + } + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==" + }, + "trim-repeated": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", + "integrity": "sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg==", + "requires": { + "escape-string-regexp": "^1.0.2" + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + } } } diff --git a/docs/package.json b/docs/package.json index 22e2370d..4a13c872 100644 --- a/docs/package.json +++ b/docs/package.json @@ -4,12 +4,11 @@ "description": "Npm project just for the docs", "main": "index.js", "scripts": { - "build": "shx rm -rf build && asciidoctor -D build -a imagesdir=./images -r asciidoctor-diagram index.adoc && shx cp -R images build", - "deploy": "gh-pages -d build" + "build": "shx rm -rf build && asciidoctor -D build -a imagesdir=./images -r asciidoctor-diagram index.adoc && shx cp -R images build", + "deploy": "gh-pages -d build" }, "dependencies": { - "gh-pages": "^3.2.3", - "shx": "^0.3.3" + "gh-pages": "^3.2.3", + "shx": "^0.3.3" } - } - \ No newline at end of file +} diff --git a/docs/src/01_introduction_and_goals.adoc b/docs/src/01_introduction_and_goals.adoc index ddb2ae3d..661c7c68 100644 --- a/docs/src/01_introduction_and_goals.adoc +++ b/docs/src/01_introduction_and_goals.adoc @@ -2,7 +2,6 @@ ifndef::imagesdir[:imagesdir: ../images] [[section-introduction-and-goals]] == Introduction and Goals - [role="arc42help"] **** Describes the relevant requirements and the driving forces that software architects and development team must consider. @@ -88,6 +87,8 @@ Table with role names, person names, and their expectations with respect to the [options="header",cols="1,2,2"] |=== |Role/Name|Contact|Expectations -| __ | __ | __ -| __ | __ | __ +| Alfredo Jirout Cid | UO288443@uniovi.es | Aprobar (opcional) +| Rodrigo Gracía Iglesias | UO276396@uniovi.es | No tomar de ejemplo a Miguel +| Iyán Fernández Riol | UO288231@uniovi.es | Sacar matricula +| Martín Cancio Barrera | UO287561@uniovi.es | Ser feliz |=== From b472174d5e39ddabfd3f55636e09bbfe3fa7287b Mon Sep 17 00:00:00 2001 From: CANCI0 Date: Tue, 6 Feb 2024 20:33:09 +0100 Subject: [PATCH 03/67] =?UTF-8?q?Varios=20generadores=20a=C3=B1adidos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/questionGen/countries/capitalQuestions.js | 45 ++++++++++++ .../countries/foundationQuestion.js | 47 +++++++++++++ .../countries/languageQuestions.js | 69 +++++++++++++++++++ package-lock.json | 57 +++++++++++++++ package.json | 2 + 5 files changed, 220 insertions(+) create mode 100644 api/questionGen/countries/capitalQuestions.js create mode 100644 api/questionGen/countries/foundationQuestion.js create mode 100644 api/questionGen/countries/languageQuestions.js diff --git a/api/questionGen/countries/capitalQuestions.js b/api/questionGen/countries/capitalQuestions.js new file mode 100644 index 00000000..99c7bf30 --- /dev/null +++ b/api/questionGen/countries/capitalQuestions.js @@ -0,0 +1,45 @@ +const { fetch } = require('cross-fetch'); + +async function consultaSPARQL() { + const endpointUrl = 'https://query.wikidata.org/sparql'; + + const query = ` + SELECT DISTINCT ?countryLabel ?capitalLabel WHERE { + ?country wdt:P31 wd:Q6256; # Selecciona entidades que son países + wdt:P36 ?capital. # Obtiene la capital de cada país + SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". } + } + LIMIT 4 + `; + + const encodedQuery = encodeURIComponent(query); + const sparqlUrl = `${endpointUrl}?query=${encodedQuery}&format=json`; + + const response = await fetch(sparqlUrl); + const data = await response.json(); + + return data.results.bindings.map(binding => ({ + country: binding.countryLabel.value, + capital: binding.capitalLabel.value + })); +} + +async function obtenerPregunta() { + const sparqlResult = await consultaSPARQL(); + const randomIndex = Math.floor(Math.random() * sparqlResult.length); + const selectedCountry = sparqlResult[randomIndex]; + + const pregunta = `¿Cuál es el idioma oficial de ${selectedCountry.country}?`; + const respuestas = sparqlResult.map(result => result.capital); + const respuestaCorrecta = selectedCountry.capital; + + const formato = { + pregunta: pregunta, + respuestas: respuestas, + respuestaCorrecta: respuestaCorrecta + }; + + return formato; +} + +obtenerPregunta().then(pregunta => console.log(pregunta)); diff --git a/api/questionGen/countries/foundationQuestion.js b/api/questionGen/countries/foundationQuestion.js new file mode 100644 index 00000000..ed795896 --- /dev/null +++ b/api/questionGen/countries/foundationQuestion.js @@ -0,0 +1,47 @@ +const { fetch } = require('cross-fetch'); +const { format } = require('date-fns'); +const { es } = require('date-fns/locale'); + +async function consultaSPARQL() { + const endpointUrl = 'https://query.wikidata.org/sparql'; + + const query = ` + SELECT DISTINCT ?countryLabel ?foundationLabel WHERE { + ?country wdt:P31 wd:Q6256; # Selecciona entidades que son países + wdt:P571 ?foundation. # Obtiene la fecha de fundación de cada país + SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". } + } + LIMIT 4 + `; + + const encodedQuery = encodeURIComponent(query); + const sparqlUrl = `${endpointUrl}?query=${encodedQuery}&format=json`; + + const response = await fetch(sparqlUrl); + const data = await response.json(); + + return data.results.bindings.map(binding => ({ + country: binding.countryLabel.value, + foundation: binding.foundationLabel.value + })); +} + +async function obtenerPregunta() { + const sparqlResult = await consultaSPARQL(); + const randomIndex = Math.floor(Math.random() * sparqlResult.length); + const selectedCountry = sparqlResult[randomIndex]; + + const pregunta = `¿Cuál fue la fecha de fundación de ${selectedCountry.country}?`; + const respuestas = sparqlResult.map(result => result.foundation).map(f => format(new Date(f), "dd 'de' MMMM 'de' yyyy", { locale: es })); + const respuestaCorrecta = format(new Date(selectedCountry.foundation), "dd 'de' MMMM 'de' yyyy", { locale: es }); + + const formato = { + pregunta: pregunta, + respuestas: respuestas, + respuestaCorrecta: respuestaCorrecta + }; + + return formato; +} + +obtenerPregunta().then(pregunta => console.log(pregunta)); diff --git a/api/questionGen/countries/languageQuestions.js b/api/questionGen/countries/languageQuestions.js new file mode 100644 index 00000000..646aea28 --- /dev/null +++ b/api/questionGen/countries/languageQuestions.js @@ -0,0 +1,69 @@ +const { fetch } = require('cross-fetch'); + +async function consultarIdiomaOficialAleatorio() { + const endpointUrl = 'https://query.wikidata.org/sparql'; + + const query = ` + SELECT DISTINCT ?countryLabel ?idiomaLabel WHERE { + ?country wdt:P31 wd:Q6256; # Selecciona entidades que son países + wdt:P37 ?idioma. # Obtiene el idioma oficial de cada país + ?idioma wdt:P31 wd:Q34770. # Selecciona entidades que son idiomas + SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". } + } + ORDER BY UUID() + LIMIT 1 + `; + + const encodedQuery = encodeURIComponent(query); + const sparqlUrl = `${endpointUrl}?query=${encodedQuery}&format=json`; + + const response = await fetch(sparqlUrl); + const data = await response.json(); + + if (data.results.bindings.length === 0) { + return "No se pudo encontrar información sobre el idioma oficial de un país en Wikidata."; + } + + const country = data.results.bindings[0].countryLabel.value; + const idiomaOficial = data.results.bindings[0].idiomaLabel.value; + + // Generar otras tres opciones de idioma + const opcionesIdioma = await generarOpcionesIdioma(idiomaOficial); + + const formato = { + pregunta: `¿Cuál es el idioma oficial de ${country}?`, + respuestas: opcionesIdioma, + respuestaCorrecta: idiomaOficial + }; + + return formato; +} + +async function generarOpcionesIdioma(respuestaCorrecta) { + const endpointUrl = 'https://query.wikidata.org/sparql'; + + const query = ` + SELECT DISTINCT ?idiomaLabel WHERE { + ?idioma wdt:P31 wd:Q34770. # Selecciona entidades que son idiomas + FILTER(?idioma != wd:${respuestaCorrecta.replace(/\s/g, '_')}) + SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". } + } + ORDER BY UUID() + LIMIT 3 + `; + + const encodedQuery = encodeURIComponent(query); + const sparqlUrl = `${endpointUrl}?query=${encodedQuery}&format=json`; + + const response = await fetch(sparqlUrl); + const data = await response.json(); + + const opciones = data.results.bindings.map(binding => binding.idiomaLabel.value); + opciones.push(respuestaCorrecta); // Agregar la respuesta correcta al final + + return opciones; +} + +consultarIdiomaOficialAleatorio() + .then(formato => console.log(formato)) + .catch(error => console.error("Error:", error)); diff --git a/package-lock.json b/package-lock.json index 1c5472ed..0add4cee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,8 @@ "packages": { "": { "dependencies": { + "cross-fetch": "^4.0.0", + "date-fns": "^3.3.1", "react-auth-kit": "^3.0.2-alpha.19" } }, @@ -205,6 +207,23 @@ "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", "peer": true }, + "node_modules/cross-fetch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", + "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", + "dependencies": { + "node-fetch": "^2.6.12" + } + }, + "node_modules/date-fns": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.3.1.tgz", + "integrity": "sha512-y8e109LYGgoQDveiEBD3DYXKba1jWf5BA8YU1FL5Tvm0BTdEfy54WLCwnuYWZNnzzvALy/QQ4Hov+Q9RVRv+Zw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -301,6 +320,25 @@ } } }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -432,10 +470,29 @@ } } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } } } } diff --git a/package.json b/package.json index 2d4da84c..eed5c7aa 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,7 @@ { "dependencies": { + "cross-fetch": "^4.0.0", + "date-fns": "^3.3.1", "react-auth-kit": "^3.0.2-alpha.19" } } From 2522a45bd78064578ced67d8f058e34d8a065a07 Mon Sep 17 00:00:00 2001 From: CANCI0 Date: Tue, 6 Feb 2024 21:16:16 +0100 Subject: [PATCH 04/67] =?UTF-8?q?M=C3=A1s=20generadores=20de=20preguntas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../countries/HeadOfStateQuestions.js | 46 +++++++++++++++++ .../countries/HistoricEventQuestions.js | 49 +++++++++++++++++++ .../countries/LifeExpectancyQuestions.js | 47 ++++++++++++++++++ api/questionGen/countries/capitalQuestions.js | 1 + .../countries/foundationQuestion.js | 1 + 5 files changed, 144 insertions(+) create mode 100644 api/questionGen/countries/HeadOfStateQuestions.js create mode 100644 api/questionGen/countries/HistoricEventQuestions.js create mode 100644 api/questionGen/countries/LifeExpectancyQuestions.js diff --git a/api/questionGen/countries/HeadOfStateQuestions.js b/api/questionGen/countries/HeadOfStateQuestions.js new file mode 100644 index 00000000..d86bafaa --- /dev/null +++ b/api/questionGen/countries/HeadOfStateQuestions.js @@ -0,0 +1,46 @@ +const { fetch } = require('cross-fetch'); + +async function consultaSPARQL() { + const endpointUrl = 'https://query.wikidata.org/sparql'; + + const query = ` + SELECT DISTINCT ?countryLabel ?headLabel WHERE { + ?country wdt:P31 wd:Q6256; # Selecciona entidades que son países + wdt:P35 ?head. # Obtiene la forma de gobierno de cada país + SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". } + } + ORDER BY UUID() + LIMIT 4 + `; + + const encodedQuery = encodeURIComponent(query); + const sparqlUrl = `${endpointUrl}?query=${encodedQuery}&format=json`; + + const response = await fetch(sparqlUrl); + const data = await response.json(); + + return data.results.bindings.map(binding => ({ + country: binding.countryLabel.value, + head: binding.headLabel.value + })); +} + +async function obtenerPregunta() { + const sparqlResult = await consultaSPARQL(); + const randomIndex = Math.floor(Math.random() * sparqlResult.length); + const selectedCountry = sparqlResult[randomIndex]; + + const pregunta = `¿Quién es el jefe de estado de ${selectedCountry.country}?`; + const respuestas = sparqlResult.map(result => result.head); + const respuestaCorrecta = selectedCountry.head; + + const formato = { + pregunta: pregunta, + respuestas: respuestas, + respuestaCorrecta: respuestaCorrecta + }; + + return formato; +} + +obtenerPregunta().then(pregunta => console.log(pregunta)); diff --git a/api/questionGen/countries/HistoricEventQuestions.js b/api/questionGen/countries/HistoricEventQuestions.js new file mode 100644 index 00000000..0f38bbfb --- /dev/null +++ b/api/questionGen/countries/HistoricEventQuestions.js @@ -0,0 +1,49 @@ +const { fetch } = require('cross-fetch'); +const { format } = require('date-fns'); +const { es } = require('date-fns/locale'); + +//TODO: Hay algunos eventos que salen como entidad (ej. Q3293979) en vez de su nombre). Hay que solucionarlo +async function consultaSPARQL() { + const endpointUrl = 'https://query.wikidata.org/sparql'; + + const query = ` + SELECT DISTINCT ?countryLabel ?eventLabel WHERE { + ?country wdt:P31 wd:Q6256; # Selecciona entidades que son países + wdt:P1344 ?event. # Obtiene la fecha de un evento histórico en el que participó de cada país + SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". } + } + ORDER BY UUID() + LIMIT 4 + `; + + const encodedQuery = encodeURIComponent(query); + const sparqlUrl = `${endpointUrl}?query=${encodedQuery}&format=json`; + + const response = await fetch(sparqlUrl); + const data = await response.json(); + + return data.results.bindings.map(binding => ({ + country: binding.countryLabel.value, + event: binding.eventLabel.value + })); +} + +async function obtenerPregunta() { + const sparqlResult = await consultaSPARQL(); + const randomIndex = Math.floor(Math.random() * sparqlResult.length); + const selectedCountry = sparqlResult[randomIndex]; + + const pregunta = `¿En qué evento histórico participó ${selectedCountry.country}?`; + const respuestas = sparqlResult.map(result => result.event); + const respuestaCorrecta = selectedCountry.event; + + const formato = { + pregunta: pregunta, + respuestas: respuestas, + respuestaCorrecta: respuestaCorrecta + }; + + return formato; +} + +obtenerPregunta().then(pregunta => console.log(pregunta)); diff --git a/api/questionGen/countries/LifeExpectancyQuestions.js b/api/questionGen/countries/LifeExpectancyQuestions.js new file mode 100644 index 00000000..3bc61269 --- /dev/null +++ b/api/questionGen/countries/LifeExpectancyQuestions.js @@ -0,0 +1,47 @@ +const { fetch } = require('cross-fetch'); +const { format } = require('date-fns'); +const { es } = require('date-fns/locale'); + +async function consultaSPARQL() { + const endpointUrl = 'https://query.wikidata.org/sparql'; + + const query = ` + SELECT DISTINCT ?countryLabel ?lifeLabel WHERE { + ?country wdt:P31 wd:Q6256; # Selecciona entidades que son países + wdt:P2250 ?life. # Obtiene la esperanza de vida media del país + SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". } + } + ORDER BY UUID() + LIMIT 4 + `; + + const encodedQuery = encodeURIComponent(query); + const sparqlUrl = `${endpointUrl}?query=${encodedQuery}&format=json`; + + const response = await fetch(sparqlUrl); + const data = await response.json(); + + return data.results.bindings.map(binding => ({ + country: binding.countryLabel.value, + lifeExpectancy: binding.lifeLabel.value + })); +} + +async function obtenerPregunta() { + const sparqlResult = await consultaSPARQL(); + const randomIndex = Math.floor(Math.random() * sparqlResult.length); + const selectedCountry = sparqlResult[randomIndex]; + const pregunta = `¿Cuál es la esperanza de vida media de ${selectedCountry.country}?`; + const respuestas = sparqlResult.map(result => result.lifeExpectancy).map(x => Math.floor(x)); + const respuestaCorrecta = Math.floor(selectedCountry.lifeExpectancy); + + const formato = { + pregunta: pregunta, + respuestas: respuestas, + respuestaCorrecta: respuestaCorrecta + }; + + return formato; +} + +obtenerPregunta().then(pregunta => console.log(pregunta)); diff --git a/api/questionGen/countries/capitalQuestions.js b/api/questionGen/countries/capitalQuestions.js index 99c7bf30..f36b583e 100644 --- a/api/questionGen/countries/capitalQuestions.js +++ b/api/questionGen/countries/capitalQuestions.js @@ -9,6 +9,7 @@ async function consultaSPARQL() { wdt:P36 ?capital. # Obtiene la capital de cada país SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". } } + ORDER BY UUID() LIMIT 4 `; diff --git a/api/questionGen/countries/foundationQuestion.js b/api/questionGen/countries/foundationQuestion.js index ed795896..d283b5ae 100644 --- a/api/questionGen/countries/foundationQuestion.js +++ b/api/questionGen/countries/foundationQuestion.js @@ -11,6 +11,7 @@ async function consultaSPARQL() { wdt:P571 ?foundation. # Obtiene la fecha de fundación de cada país SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". } } + ORDER BY UUID() LIMIT 4 `; From 76624796ca5d87599f20209b49b8a8ff077477b6 Mon Sep 17 00:00:00 2001 From: CANCI0 Date: Tue, 6 Feb 2024 21:31:37 +0100 Subject: [PATCH 05/67] =?UTF-8?q?A=C3=B1adido=20automatizador=20de=20gener?= =?UTF-8?q?aci=C3=B3n=20de=20preguntas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../countries/QuestionAutomatizer.js | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 api/questionGen/countries/QuestionAutomatizer.js diff --git a/api/questionGen/countries/QuestionAutomatizer.js b/api/questionGen/countries/QuestionAutomatizer.js new file mode 100644 index 00000000..e0ffae70 --- /dev/null +++ b/api/questionGen/countries/QuestionAutomatizer.js @@ -0,0 +1,47 @@ +const { fetch } = require('cross-fetch'); + +// q es la entidad, p la propiedad +async function consultaSPARQL(q, p) { + const endpointUrl = 'https://query.wikidata.org/sparql'; + + const query = ` + SELECT DISTINCT ?entityLabel ?propertyLabel WHERE { + ?entity wdt:P31 wd:${q}; # Selecciona entidades que son países + wdt:${p} ?property. # Obtiene la propiedad deseada + SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". } + } + ORDER BY UUID() + LIMIT 4 + `; + + const encodedQuery = encodeURIComponent(query); + const sparqlUrl = `${endpointUrl}?query=${encodedQuery}&format=json`; + + const response = await fetch(sparqlUrl); + const data = await response.json(); + + return data.results.bindings.map(binding => ({ + entity: binding.entityLabel.value, + property: binding.propertyLabel.value + })); +} + +async function obtenerPregunta(q, p, question, formatter = x => x) { + const sparqlResult = await consultaSPARQL(q, p); + const randomIndex = Math.floor(Math.random() * sparqlResult.length); + const selectedEntity = sparqlResult[randomIndex]; + + const pregunta = `${question} ${selectedEntity.entity}?`; + const respuestas = sparqlResult.map(result => result.property).map(x => formatter(x)); + const respuestaCorrecta = formatter(selectedEntity.property); + + const formato = { + pregunta: pregunta, + respuestas: respuestas, + respuestaCorrecta: respuestaCorrecta + }; + + return formato; +} + +obtenerPregunta("Q6256", "P36", "¿Cuál es la capital de ").then(pregunta => console.log(pregunta)); From 6a53c8d306bbd29f12fef36e8f52342ea93fe41f Mon Sep 17 00:00:00 2001 From: CANCI0 Date: Tue, 6 Feb 2024 21:33:00 +0100 Subject: [PATCH 06/67] =?UTF-8?q?Nombres=20m=C3=A1s=20intuitivos=20en=20lo?= =?UTF-8?q?s=20par=C3=A1metros?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/questionGen/countries/QuestionAutomatizer.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api/questionGen/countries/QuestionAutomatizer.js b/api/questionGen/countries/QuestionAutomatizer.js index e0ffae70..417b1703 100644 --- a/api/questionGen/countries/QuestionAutomatizer.js +++ b/api/questionGen/countries/QuestionAutomatizer.js @@ -1,13 +1,13 @@ const { fetch } = require('cross-fetch'); // q es la entidad, p la propiedad -async function consultaSPARQL(q, p) { +async function consultaSPARQL(entity, property) { const endpointUrl = 'https://query.wikidata.org/sparql'; const query = ` SELECT DISTINCT ?entityLabel ?propertyLabel WHERE { - ?entity wdt:P31 wd:${q}; # Selecciona entidades que son países - wdt:${p} ?property. # Obtiene la propiedad deseada + ?entity wdt:P31 wd:${entity}; # Selecciona entidades que son países + wdt:${property} ?property. # Obtiene la propiedad deseada SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". } } ORDER BY UUID() @@ -26,8 +26,8 @@ async function consultaSPARQL(q, p) { })); } -async function obtenerPregunta(q, p, question, formatter = x => x) { - const sparqlResult = await consultaSPARQL(q, p); +async function obtenerPregunta(entity, property, question, formatter = x => x) { + const sparqlResult = await consultaSPARQL(entity, property); const randomIndex = Math.floor(Math.random() * sparqlResult.length); const selectedEntity = sparqlResult[randomIndex]; From fd674a19bd465de924d152af202605c76e32b5ba Mon Sep 17 00:00:00 2001 From: Alfredo Jirout Cid <144898617+UO288443@users.noreply.github.com> Date: Thu, 8 Feb 2024 19:45:49 +0100 Subject: [PATCH 07/67] Update 09_architecture_decisions.adoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit prueba decisiones arquitectonicas (solo añadimos JavaScript) --- docs/src/09_architecture_decisions.adoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/src/09_architecture_decisions.adoc b/docs/src/09_architecture_decisions.adoc index 51e9aad9..8b96504e 100644 --- a/docs/src/09_architecture_decisions.adoc +++ b/docs/src/09_architecture_decisions.adoc @@ -2,7 +2,8 @@ ifndef::imagesdir[:imagesdir: ../images] [[section-design-decisions]] == Architecture Decisions - + JavaScript: + We will use the JavaScript language to create both the front-end and the backend of the application, is the default technology of the initial project [role="arc42help"] **** From ad91ca22bbe3e4af0792ab4c13f579105f8e0284 Mon Sep 17 00:00:00 2001 From: CANCI0 Date: Thu, 8 Feb 2024 19:53:46 +0100 Subject: [PATCH 08/67] =?UTF-8?q?Avance=20en=20la=20documentaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 1 + docs/src/01_introduction_and_goals.adoc | 115 ++++++++++------------ docs/src/02_architecture_constraints.adoc | 28 +++--- docs/src/03_system_scope_and_context.adoc | 75 ++------------ 4 files changed, 75 insertions(+), 144 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/docs/src/01_introduction_and_goals.adoc b/docs/src/01_introduction_and_goals.adoc index ddb2ae3d..73d8b3a5 100644 --- a/docs/src/01_introduction_and_goals.adoc +++ b/docs/src/01_introduction_and_goals.adoc @@ -3,91 +3,78 @@ ifndef::imagesdir[:imagesdir: ../images] [[section-introduction-and-goals]] == Introduction and Goals -[role="arc42help"] -**** -Describes the relevant requirements and the driving forces that software architects and development team must consider. -These include - -* underlying business goals, -* essential features, -* essential functional requirements, -* quality goals for the architecture and -* relevant stakeholders and their expectations -**** +WIQ! es un proyecto desarrollado para la asignatura "Arquitectura de Software" del grado de Ingeniería Informática de la Escuela de Ingeniería Informática de la Universidad de Oviedo. Este proyecto toma como base el proyecto wiq, puesto a la disposición de los alumnos por los profesores de la asignatura. +WIQ! ha sido encargado a la empresa HappySw por RTVE, con el objetivo de recrear su famoso concurso Saber y ganar en una versión web accesible para todo el mundo. Este proyecto será realizado por el equipo de desarrollo es1a formado por: -=== Requirements Overview +* Martín Cancio Barrera, mailto:UO287561@uniovi.es[_UO287561_]. + +* Iyán Fernández Riol, mailto:UO288231@uniovi.es[_UO288231_]. + +* Rodrigo García Iglesias, mailto:UO276396@uniovi.es[_UO276396_]. -[role="arc42help"] -**** -.Contents -Short description of the functional requirements, driving forces, extract (or abstract) -of requirements. Link to (hopefully existing) requirements documents -(with version number and information where to find it). +* Alfredo Jirout Cid, mailto:UO288443@uniovi.es[_UO288443_]. -.Motivation -From the point of view of the end users a system is created or modified to -improve support of a business activity and/or improve the quality. +WIQ! es un software mediante el cual los usuarios pueden emular ser los participantes del concurso Saber y ganar, que cuenta con numerosas funcionalidades: -.Form -Short textual description, probably in tabular use-case format. -If requirements documents exist this overview should refer to these documents. +* Jugar a varios de los modos de juego vistos en el programa -Keep these excerpts as short as possible. Balance readability of this document with potential redundancy w.r.t to requirements documents. +* Registrarse para poder llevar registro de sus estadísticas en el juego +* Jugar con amigos -.Further Information +* Ajustar las temáticas de las preguntas, el tiempo de respuesta, el número de preguntas... +*** + +=== Requirements Overview -See https://docs.arc42.org/section-1/[Introduction and Goals] in the arc42 documentation. +* El sistema contará al menos con un frontend web que estará desplegado y el acceso será a través de la Web. +* Los usuarios podrán registrarse en el sistema y consultar el histórico de su participación en el sistema: número de juegos, preguntas acertadas/falladas, tiempos, etc. +* Las preguntas serán generadas automáticamente a partir de los datos de Wikidata. +* Las preguntas deberán responderse en un plazo de tiempo determinado. +* Cada pregunta tendrá una respuesta correcta y varias respuestas incorrectas o distractoras. Tanto la respuesta correcta como las incorrectas se generarán automáticamente. +* El sistema permitirá acceder a la información de los usuarios a través de un API. +* El sistema permitirá acceder a la información de las preguntas generadas a través de un API. -**** === Quality Goals -[role="arc42help"] -**** -.Contents -The top three (max five) quality goals for the architecture whose fulfillment is of highest importance to the major stakeholders. -We really mean quality goals for the architecture. Don't confuse them with project goals. -They are not necessarily identical. -Consider this overview of potential topics (based upon the ISO 25010 standard): +[options="header"] +|=== +| Priority | Quality Goal | Motivation -image::01_2_iso-25010-topics-EN.drawio.png["Categories of Quality Requirements"] +| *1* +| *_Usabilidad_* +| La aplicación debe ser intuitiva para los usuarios, facilitándoles la interacción con la misma independientemente de sus habilidades. -.Motivation -You should know the quality goals of your most important stakeholders, since they will influence fundamental architectural decisions. -Make sure to be very concrete about these qualities, avoid buzzwords. -If you as an architect do not know how the quality of your work will be judged... +| *2* +| *_Mantenibilidad_* +| La aplicación debe contar con un diseño bien definido y estructurado, de tal forma que sea sencillo realizar modificaciones y/o ampliaciones. -.Form -A table with quality goals and concrete scenarios, ordered by priorities -**** +| *3* +| *_Privacidad_* +| La aplicación debe garantizar la privacidad de la información de sus usuarios, contando con mecanismos para evitar intrusiones en el sistema. +|=== === Stakeholders -[role="arc42help"] -**** -.Contents -Explicit overview of stakeholders of the system, i.e. all person, roles or organizations that +[options="header"] +|=== +|Role/Name|Contact|Expectations -* should know the architecture -* have to be convinced of the architecture -* have to work with the architecture or with code -* need the documentation of the architecture for their work -* have to come up with decisions about the system or its development +| *_Estudiantes (HappySw)_* +| Martín Cancio Barrera, Iyán Fernández Riol, Rodrigo García Iglesias y Alfredo Jirout Cid +| Los estudiantes son los desarrolladores de la aplicación. Están a cargo del desarrollo completo, lo que mejorará sus habilidades tanto de programación como de trabajo en grupo. -.Motivation -You should know all parties involved in development of the system or affected by the system. -Otherwise, you may get nasty surprises later in the development process. -These stakeholders determine the extent and the level of detail of your work and its results. +| *_Usuarios_* +| Cualquier persona que utilice la aplicación +| Los usuarios son los que en última instancia van a utilizar la aplicación, por lo que debe ser intuitiva y fácil de entender. -.Form -Table with role names, person names, and their expectations with respect to the architecture and its documentation. -**** +| *_Profesores_* +| José Emilio Labra Gayo, Pablo González González, Jorge Álvarez Fidalgo y Cristian Augusto Alonso +| Son los supervisores del proyecto, y ayudarán a los estudiantes para asegurarse de que el proyecto llegue a buen puerto. -[options="header",cols="1,2,2"] -|=== -|Role/Name|Contact|Expectations -| __ | __ | __ -| __ | __ | __ +| *_RTVE_* +| RTVE +| Son los principales interesados en la aplicación, puesto que son los que la han encargado, para que sus espectadores puedan utilizarla. |=== diff --git a/docs/src/02_architecture_constraints.adoc b/docs/src/02_architecture_constraints.adoc index 226e501f..c63f32c3 100644 --- a/docs/src/02_architecture_constraints.adoc +++ b/docs/src/02_architecture_constraints.adoc @@ -3,25 +3,23 @@ ifndef::imagesdir[:imagesdir: ../images] [[section-architecture-constraints]] == Architecture Constraints +|=== +| *_Restricción de Arquitectura_* | *_Descripción_* -[role="arc42help"] -**** -.Contents -Any requirement that constraints software architects in their freedom of design and implementation decisions or decision about the development process. These constraints sometimes go beyond individual systems and are valid for whole organizations and companies. +| *_Tecnología de Desarrollo_* | La aplicación debe desarrollarse utilizando tecnologías web compatibles con los requisitos y estándares de RTVE. -.Motivation -Architects should know exactly where they are free in their design decisions and where they must adhere to constraints. -Constraints must always be dealt with; they may be negotiable, though. +| *_Plataforma de Implementación_* | La aplicación debe ser implementada en una plataforma de alojamiento web que cumpla con los requisitos de rendimiento, seguridad y escalabilidad de RTVE. -.Form -Simple tables of constraints with explanations. -If needed you can subdivide them into -technical constraints, organizational and political constraints and -conventions (e.g. programming or versioning guidelines, documentation or naming conventions) +| *_Cumplimiento de Normativas de Privacidad_* | La arquitectura debe garantizar el cumplimiento de las regulaciones de privacidad de datos, como GDPR, para proteger la información de los usuarios. +| *_Compatibilidad con Navegadores_* | La aplicación debe ser compatible con una amplia gama de navegadores web populares para garantizar una experiencia de usuario consistente. -.Further Information +| *_Seguridad de la Información_* | Se deben implementar medidas de seguridad sólidas, como autenticación de usuarios, control de acceso y encriptación de datos, para proteger la información confidencial de los usuarios. -See https://docs.arc42.org/section-2/[Architecture Constraints] in the arc42 documentation. +| *_Escalabilidad_* | La arquitectura debe ser escalable para manejar un aumento en el tráfico de usuarios sin comprometer el rendimiento. -**** +| *_Mantenibilidad del Código_* | Se deben seguir prácticas de desarrollo de software que promuevan un código limpio y bien documentado para facilitar futuras actualizaciones y mantenimiento. + +| *_Tiempo de Desarrollo_* | La aplicación debe desarrollarse dentro de un marco de tiempo específico, lo que puede influir en las decisiones arquitectónicas y en la selección de tecnologías. + +|=== diff --git a/docs/src/03_system_scope_and_context.adoc b/docs/src/03_system_scope_and_context.adoc index c528e907..e3ba0070 100644 --- a/docs/src/03_system_scope_and_context.adoc +++ b/docs/src/03_system_scope_and_context.adoc @@ -3,73 +3,18 @@ ifndef::imagesdir[:imagesdir: ../images] [[section-system-scope-and-context]] == System Scope and Context - -[role="arc42help"] -**** -.Contents -System scope and context - as the name suggests - delimits your system (i.e. your scope) from all its communication partners -(neighboring systems and users, i.e. the context of your system). It thereby specifies the external interfaces. - -If necessary, differentiate the business context (domain specific inputs and outputs) from the technical context (channels, protocols, hardware). - -.Motivation -The domain interfaces and technical interfaces to communication partners are among your system's most critical aspects. Make sure that you completely understand them. - -.Form -Various options: - -* Context diagrams -* Lists of communication partners and their interfaces. - - -.Further Information - -See https://docs.arc42.org/section-3/[Context and Scope] in the arc42 documentation. - -**** - - === Business Context -[role="arc42help"] -**** -.Contents -Specification of *all* communication partners (users, IT-systems, ...) with explanations of domain specific inputs and outputs or interfaces. -Optionally you can add domain specific formats or communication protocols. - -.Motivation -All stakeholders should understand which data are exchanged with the environment of the system. - -.Form -All kinds of diagrams that show the system as a black box and specify the domain interfaces to communication partners. - -Alternatively (or additionally) you can use a table. -The title of the table is the name of your system, the three columns contain the name of the communication partner, the inputs, and the outputs. - -**** - -**** - -**** +[plantuml, "businesscontext", png] +---- +[horizontal, caption="WIQ! Business Context"] +.Users: Participate in quizzes +.Hall: Hosts quizzes +.Business: Use the application +Users -- Hall +Users -- Business +Hall -- Business +---- === Technical Context -[role="arc42help"] -**** -.Contents -Technical interfaces (channels and transmission media) linking your system to its environment. In addition a mapping of domain specific input/output to the channels, i.e. an explanation which I/O uses which channel. - -.Motivation -Many stakeholders make architectural decision based on the technical interfaces between the system and its context. Especially infrastructure or hardware designers decide these technical interfaces. - -.Form -E.g. UML deployment diagram describing channels to neighboring systems, -together with a mapping table showing the relationships between channels and input/output. - -**** - -**** - -**** - -**** From b32149e7830229d47735dcc8032c2c301227c640 Mon Sep 17 00:00:00 2001 From: Alfredo Jirout Cid <144898617+UO288443@users.noreply.github.com> Date: Thu, 8 Feb 2024 19:54:18 +0100 Subject: [PATCH 09/67] Update 09_architecture_decisions.adoc --- docs/src/09_architecture_decisions.adoc | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/docs/src/09_architecture_decisions.adoc b/docs/src/09_architecture_decisions.adoc index 8b96504e..806c71f7 100644 --- a/docs/src/09_architecture_decisions.adoc +++ b/docs/src/09_architecture_decisions.adoc @@ -2,8 +2,27 @@ ifndef::imagesdir[:imagesdir: ../images] [[section-design-decisions]] == Architecture Decisions - JavaScript: - We will use the JavaScript language to create both the front-end and the backend of the application, is the default technology of the initial project +JavaScript: + We will use the JavaScript language to create both the front-end and the backend of the application, is the default technology of the initial project. + +ReactJS: + The base project they have given us uses ReactJS for the front-end of the application, although it is a framework with which we are not familiar. + We think that is a good oportunity to start using this framework. + +NodeJS: + We use NodeJS for the back-end of the application, this is the default technology of the initial project and all the group thought it was a good idea + to use it. + +MongoDB + The base project they have given us uses MongoDB for the back-end of the application, a DBMS with which we are not familiar, but it seemed like a + good idea to learn this GBD system. + +Docker: + We will use Docker to package the application modules in containers, it is the initial technology of the project + +MySQL: + The base project that they have given us uses MongoDB for the back-end of the application, a DBMS with which we are not familiar, however MySQL is another +database management system that we have used in other subjects. We decided to discard this option to learn how to use MongoDB [role="arc42help"] **** From 68f144140fca8438ee8c5fe9f8734b7afd66726e Mon Sep 17 00:00:00 2001 From: CANCI0 Date: Sat, 10 Feb 2024 11:57:09 +0100 Subject: [PATCH 10/67] =?UTF-8?q?Se=20ha=20optimizado=20el=20sistema=20de?= =?UTF-8?q?=20generaci=C3=B3n=20de=20preguntas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../countries/HeadOfStateQuestions.js | 46 ------------- .../countries/HistoricEventQuestions.js | 49 ------------- .../countries/LifeExpectancyQuestions.js | 47 ------------- .../countries/QuestionAutomatizer.js | 50 ++++++++++++-- api/questionGen/countries/capitalQuestions.js | 46 ------------- .../countries/foundationQuestion.js | 48 ------------- .../countries/languageQuestions.js | 69 ------------------- webapp/src/pages/Home/Home.js | 4 +- 8 files changed, 49 insertions(+), 310 deletions(-) delete mode 100644 api/questionGen/countries/HeadOfStateQuestions.js delete mode 100644 api/questionGen/countries/HistoricEventQuestions.js delete mode 100644 api/questionGen/countries/LifeExpectancyQuestions.js delete mode 100644 api/questionGen/countries/capitalQuestions.js delete mode 100644 api/questionGen/countries/foundationQuestion.js delete mode 100644 api/questionGen/countries/languageQuestions.js diff --git a/api/questionGen/countries/HeadOfStateQuestions.js b/api/questionGen/countries/HeadOfStateQuestions.js deleted file mode 100644 index d86bafaa..00000000 --- a/api/questionGen/countries/HeadOfStateQuestions.js +++ /dev/null @@ -1,46 +0,0 @@ -const { fetch } = require('cross-fetch'); - -async function consultaSPARQL() { - const endpointUrl = 'https://query.wikidata.org/sparql'; - - const query = ` - SELECT DISTINCT ?countryLabel ?headLabel WHERE { - ?country wdt:P31 wd:Q6256; # Selecciona entidades que son países - wdt:P35 ?head. # Obtiene la forma de gobierno de cada país - SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". } - } - ORDER BY UUID() - LIMIT 4 - `; - - const encodedQuery = encodeURIComponent(query); - const sparqlUrl = `${endpointUrl}?query=${encodedQuery}&format=json`; - - const response = await fetch(sparqlUrl); - const data = await response.json(); - - return data.results.bindings.map(binding => ({ - country: binding.countryLabel.value, - head: binding.headLabel.value - })); -} - -async function obtenerPregunta() { - const sparqlResult = await consultaSPARQL(); - const randomIndex = Math.floor(Math.random() * sparqlResult.length); - const selectedCountry = sparqlResult[randomIndex]; - - const pregunta = `¿Quién es el jefe de estado de ${selectedCountry.country}?`; - const respuestas = sparqlResult.map(result => result.head); - const respuestaCorrecta = selectedCountry.head; - - const formato = { - pregunta: pregunta, - respuestas: respuestas, - respuestaCorrecta: respuestaCorrecta - }; - - return formato; -} - -obtenerPregunta().then(pregunta => console.log(pregunta)); diff --git a/api/questionGen/countries/HistoricEventQuestions.js b/api/questionGen/countries/HistoricEventQuestions.js deleted file mode 100644 index 0f38bbfb..00000000 --- a/api/questionGen/countries/HistoricEventQuestions.js +++ /dev/null @@ -1,49 +0,0 @@ -const { fetch } = require('cross-fetch'); -const { format } = require('date-fns'); -const { es } = require('date-fns/locale'); - -//TODO: Hay algunos eventos que salen como entidad (ej. Q3293979) en vez de su nombre). Hay que solucionarlo -async function consultaSPARQL() { - const endpointUrl = 'https://query.wikidata.org/sparql'; - - const query = ` - SELECT DISTINCT ?countryLabel ?eventLabel WHERE { - ?country wdt:P31 wd:Q6256; # Selecciona entidades que son países - wdt:P1344 ?event. # Obtiene la fecha de un evento histórico en el que participó de cada país - SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". } - } - ORDER BY UUID() - LIMIT 4 - `; - - const encodedQuery = encodeURIComponent(query); - const sparqlUrl = `${endpointUrl}?query=${encodedQuery}&format=json`; - - const response = await fetch(sparqlUrl); - const data = await response.json(); - - return data.results.bindings.map(binding => ({ - country: binding.countryLabel.value, - event: binding.eventLabel.value - })); -} - -async function obtenerPregunta() { - const sparqlResult = await consultaSPARQL(); - const randomIndex = Math.floor(Math.random() * sparqlResult.length); - const selectedCountry = sparqlResult[randomIndex]; - - const pregunta = `¿En qué evento histórico participó ${selectedCountry.country}?`; - const respuestas = sparqlResult.map(result => result.event); - const respuestaCorrecta = selectedCountry.event; - - const formato = { - pregunta: pregunta, - respuestas: respuestas, - respuestaCorrecta: respuestaCorrecta - }; - - return formato; -} - -obtenerPregunta().then(pregunta => console.log(pregunta)); diff --git a/api/questionGen/countries/LifeExpectancyQuestions.js b/api/questionGen/countries/LifeExpectancyQuestions.js deleted file mode 100644 index 3bc61269..00000000 --- a/api/questionGen/countries/LifeExpectancyQuestions.js +++ /dev/null @@ -1,47 +0,0 @@ -const { fetch } = require('cross-fetch'); -const { format } = require('date-fns'); -const { es } = require('date-fns/locale'); - -async function consultaSPARQL() { - const endpointUrl = 'https://query.wikidata.org/sparql'; - - const query = ` - SELECT DISTINCT ?countryLabel ?lifeLabel WHERE { - ?country wdt:P31 wd:Q6256; # Selecciona entidades que son países - wdt:P2250 ?life. # Obtiene la esperanza de vida media del país - SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". } - } - ORDER BY UUID() - LIMIT 4 - `; - - const encodedQuery = encodeURIComponent(query); - const sparqlUrl = `${endpointUrl}?query=${encodedQuery}&format=json`; - - const response = await fetch(sparqlUrl); - const data = await response.json(); - - return data.results.bindings.map(binding => ({ - country: binding.countryLabel.value, - lifeExpectancy: binding.lifeLabel.value - })); -} - -async function obtenerPregunta() { - const sparqlResult = await consultaSPARQL(); - const randomIndex = Math.floor(Math.random() * sparqlResult.length); - const selectedCountry = sparqlResult[randomIndex]; - const pregunta = `¿Cuál es la esperanza de vida media de ${selectedCountry.country}?`; - const respuestas = sparqlResult.map(result => result.lifeExpectancy).map(x => Math.floor(x)); - const respuestaCorrecta = Math.floor(selectedCountry.lifeExpectancy); - - const formato = { - pregunta: pregunta, - respuestas: respuestas, - respuestaCorrecta: respuestaCorrecta - }; - - return formato; -} - -obtenerPregunta().then(pregunta => console.log(pregunta)); diff --git a/api/questionGen/countries/QuestionAutomatizer.js b/api/questionGen/countries/QuestionAutomatizer.js index 417b1703..00b53c07 100644 --- a/api/questionGen/countries/QuestionAutomatizer.js +++ b/api/questionGen/countries/QuestionAutomatizer.js @@ -1,4 +1,6 @@ const { fetch } = require('cross-fetch'); +const { format } = require('date-fns'); +const { es } = require('date-fns/locale'); // q es la entidad, p la propiedad async function consultaSPARQL(entity, property) { @@ -26,12 +28,15 @@ async function consultaSPARQL(entity, property) { })); } -async function obtenerPregunta(entity, property, question, formatter = x => x) { - const sparqlResult = await consultaSPARQL(entity, property); +async function obtenerPregunta(questionType, formatter = x => x) { + if(questionType.formatter){ + formatter = questionType.formatter + } + const sparqlResult = await consultaSPARQL(questionType.entity, questionType.property); const randomIndex = Math.floor(Math.random() * sparqlResult.length); const selectedEntity = sparqlResult[randomIndex]; - const pregunta = `${question} ${selectedEntity.entity}?`; + const pregunta = `${questionType.question} ${selectedEntity.entity}?`; const respuestas = sparqlResult.map(result => result.property).map(x => formatter(x)); const respuestaCorrecta = formatter(selectedEntity.property); @@ -44,4 +49,41 @@ async function obtenerPregunta(entity, property, question, formatter = x => x) { return formato; } -obtenerPregunta("Q6256", "P36", "¿Cuál es la capital de ").then(pregunta => console.log(pregunta)); +var questionTypes = [ + { + "question": "¿Cuál es la capital de", + "entity": "Q6256", + "property": "P36" + }, + { + "question": "¿Cuál fue la fecha de fundación de", + "entity": "Q6256", + "property": "P571", + "formatter": f => format(new Date(f), "dd 'de' MMMM 'de' yyyy", { locale: es }) + }, + { //A veces se repiten los nombres + "question": "¿Quién es el jefe de estado de", + "entity": "Q6256", + "property": "P35" + }, + { //A veces se muestra el nombre de la entidad (Q...) en vez del nombre del evento + "question": "¿En qué evento histórico participó", + "entity": "Q6256", + "property": "P1344" + }, + { //Más de una puede ser correcta + "question": "¿Cuál es uno de los idiomas oficiales de", + "entity": "Q6256", + "property": "P37" + }, + { + "question": "¿Cuál es la esperanza de vida media de", + "entity": "Q6256", + "property": "P2250", + "formatter": x => Math.floor(x) + } +] + +var randomType = questionTypes[Math.floor(Math.random() * questionTypes.length)]; + +obtenerPregunta(randomType).then(pregunta => console.log(pregunta)); diff --git a/api/questionGen/countries/capitalQuestions.js b/api/questionGen/countries/capitalQuestions.js deleted file mode 100644 index f36b583e..00000000 --- a/api/questionGen/countries/capitalQuestions.js +++ /dev/null @@ -1,46 +0,0 @@ -const { fetch } = require('cross-fetch'); - -async function consultaSPARQL() { - const endpointUrl = 'https://query.wikidata.org/sparql'; - - const query = ` - SELECT DISTINCT ?countryLabel ?capitalLabel WHERE { - ?country wdt:P31 wd:Q6256; # Selecciona entidades que son países - wdt:P36 ?capital. # Obtiene la capital de cada país - SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". } - } - ORDER BY UUID() - LIMIT 4 - `; - - const encodedQuery = encodeURIComponent(query); - const sparqlUrl = `${endpointUrl}?query=${encodedQuery}&format=json`; - - const response = await fetch(sparqlUrl); - const data = await response.json(); - - return data.results.bindings.map(binding => ({ - country: binding.countryLabel.value, - capital: binding.capitalLabel.value - })); -} - -async function obtenerPregunta() { - const sparqlResult = await consultaSPARQL(); - const randomIndex = Math.floor(Math.random() * sparqlResult.length); - const selectedCountry = sparqlResult[randomIndex]; - - const pregunta = `¿Cuál es el idioma oficial de ${selectedCountry.country}?`; - const respuestas = sparqlResult.map(result => result.capital); - const respuestaCorrecta = selectedCountry.capital; - - const formato = { - pregunta: pregunta, - respuestas: respuestas, - respuestaCorrecta: respuestaCorrecta - }; - - return formato; -} - -obtenerPregunta().then(pregunta => console.log(pregunta)); diff --git a/api/questionGen/countries/foundationQuestion.js b/api/questionGen/countries/foundationQuestion.js deleted file mode 100644 index d283b5ae..00000000 --- a/api/questionGen/countries/foundationQuestion.js +++ /dev/null @@ -1,48 +0,0 @@ -const { fetch } = require('cross-fetch'); -const { format } = require('date-fns'); -const { es } = require('date-fns/locale'); - -async function consultaSPARQL() { - const endpointUrl = 'https://query.wikidata.org/sparql'; - - const query = ` - SELECT DISTINCT ?countryLabel ?foundationLabel WHERE { - ?country wdt:P31 wd:Q6256; # Selecciona entidades que son países - wdt:P571 ?foundation. # Obtiene la fecha de fundación de cada país - SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". } - } - ORDER BY UUID() - LIMIT 4 - `; - - const encodedQuery = encodeURIComponent(query); - const sparqlUrl = `${endpointUrl}?query=${encodedQuery}&format=json`; - - const response = await fetch(sparqlUrl); - const data = await response.json(); - - return data.results.bindings.map(binding => ({ - country: binding.countryLabel.value, - foundation: binding.foundationLabel.value - })); -} - -async function obtenerPregunta() { - const sparqlResult = await consultaSPARQL(); - const randomIndex = Math.floor(Math.random() * sparqlResult.length); - const selectedCountry = sparqlResult[randomIndex]; - - const pregunta = `¿Cuál fue la fecha de fundación de ${selectedCountry.country}?`; - const respuestas = sparqlResult.map(result => result.foundation).map(f => format(new Date(f), "dd 'de' MMMM 'de' yyyy", { locale: es })); - const respuestaCorrecta = format(new Date(selectedCountry.foundation), "dd 'de' MMMM 'de' yyyy", { locale: es }); - - const formato = { - pregunta: pregunta, - respuestas: respuestas, - respuestaCorrecta: respuestaCorrecta - }; - - return formato; -} - -obtenerPregunta().then(pregunta => console.log(pregunta)); diff --git a/api/questionGen/countries/languageQuestions.js b/api/questionGen/countries/languageQuestions.js deleted file mode 100644 index 646aea28..00000000 --- a/api/questionGen/countries/languageQuestions.js +++ /dev/null @@ -1,69 +0,0 @@ -const { fetch } = require('cross-fetch'); - -async function consultarIdiomaOficialAleatorio() { - const endpointUrl = 'https://query.wikidata.org/sparql'; - - const query = ` - SELECT DISTINCT ?countryLabel ?idiomaLabel WHERE { - ?country wdt:P31 wd:Q6256; # Selecciona entidades que son países - wdt:P37 ?idioma. # Obtiene el idioma oficial de cada país - ?idioma wdt:P31 wd:Q34770. # Selecciona entidades que son idiomas - SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". } - } - ORDER BY UUID() - LIMIT 1 - `; - - const encodedQuery = encodeURIComponent(query); - const sparqlUrl = `${endpointUrl}?query=${encodedQuery}&format=json`; - - const response = await fetch(sparqlUrl); - const data = await response.json(); - - if (data.results.bindings.length === 0) { - return "No se pudo encontrar información sobre el idioma oficial de un país en Wikidata."; - } - - const country = data.results.bindings[0].countryLabel.value; - const idiomaOficial = data.results.bindings[0].idiomaLabel.value; - - // Generar otras tres opciones de idioma - const opcionesIdioma = await generarOpcionesIdioma(idiomaOficial); - - const formato = { - pregunta: `¿Cuál es el idioma oficial de ${country}?`, - respuestas: opcionesIdioma, - respuestaCorrecta: idiomaOficial - }; - - return formato; -} - -async function generarOpcionesIdioma(respuestaCorrecta) { - const endpointUrl = 'https://query.wikidata.org/sparql'; - - const query = ` - SELECT DISTINCT ?idiomaLabel WHERE { - ?idioma wdt:P31 wd:Q34770. # Selecciona entidades que son idiomas - FILTER(?idioma != wd:${respuestaCorrecta.replace(/\s/g, '_')}) - SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". } - } - ORDER BY UUID() - LIMIT 3 - `; - - const encodedQuery = encodeURIComponent(query); - const sparqlUrl = `${endpointUrl}?query=${encodedQuery}&format=json`; - - const response = await fetch(sparqlUrl); - const data = await response.json(); - - const opciones = data.results.bindings.map(binding => binding.idiomaLabel.value); - opciones.push(respuestaCorrecta); // Agregar la respuesta correcta al final - - return opciones; -} - -consultarIdiomaOficialAleatorio() - .then(formato => console.log(formato)) - .catch(error => console.error("Error:", error)); diff --git a/webapp/src/pages/Home/Home.js b/webapp/src/pages/Home/Home.js index e5d08fda..679d192e 100644 --- a/webapp/src/pages/Home/Home.js +++ b/webapp/src/pages/Home/Home.js @@ -3,14 +3,16 @@ import "./Home.css"; import Nav from '../../components/Nav/Nav.js'; import Footer from '../../components/Footer/Footer.js'; import { Link } from "react-router-dom"; +import useAuthUser from 'react-auth-kit/hooks/useAuthUser'; const Home = () => { + const auth = useAuthUser() return ( <>