From e01e39a3c72a927f0c5e50f255ec562095d6b449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rune=20Moskvil=20Lyng=C3=A5s?= Date: Fri, 27 Aug 2021 10:54:57 +0200 Subject: [PATCH] Removed programomaader since it has no usable data from FINT And we can manage with just utdanningsprogammer --- docs/getClassStudents.md | 16 +------------- docs/getStudent.md | 14 ------------ docs/getStudents.md | 32 ---------------------------- docs/grep.md | 40 ++++------------------------------- lib/repack-group.js | 5 +++-- lib/repack-student-utdprog.js | 10 +++------ lib/repack-student.js | 2 -- 7 files changed, 11 insertions(+), 108 deletions(-) diff --git a/docs/getClassStudents.md b/docs/getClassStudents.md index 8c3f7ec..3c6453d 100644 --- a/docs/getClassStudents.md +++ b/docs/getClassStudents.md @@ -7,7 +7,7 @@ Returns the students of a specific class > #### Please note > * The ID url property should be double URL Encoded > * Returns the student object, but without the `groups` property -> * Read more about the valued in ``programomraade`` and ``utdanningsprogram`` [here](./grep.md) +> * Read more about the values in ``utdanningsprogram`` [here](./grep.md)
@@ -30,20 +30,6 @@ Example response: "schoolShortName": "Testen vgs", "classId": "TESVS:TEST", "classShortId": "TEST", - "programomraade": { - "kode": "BABAT1----", - "type": "yrkesfaglig", - "tittel": { - "default": "Bygg- og anleggsteknikk", - "nob": "Bygg- og anleggsteknikk", - "nno": "Bygg- og anleggsteknikk" - }, - "kortform": { - "default": "Bygg- og anleggsteknikk", - "nob": "Bygg- og anleggsteknikk", - "nno": "Bygg- og anleggsteknikk" - } - }, "utdanningsprogram": { "kode": "BA", "type": "yrkesfaglig", diff --git a/docs/getStudent.md b/docs/getStudent.md index 699bbe4..585ab13 100644 --- a/docs/getStudent.md +++ b/docs/getStudent.md @@ -22,20 +22,6 @@ Example response: "schoolShortName": "Testen vgs", "classId": "TESVS:TEST", "classShortId": "TEST", - "programomraade": { - "kode": "BABAT1----", - "type": "yrkesfaglig", - "tittel": { - "default": "Bygg- og anleggsteknikk", - "nob": "Bygg- og anleggsteknikk", - "nno": "Bygg- og anleggsteknikk" - }, - "kortform": { - "default": "Bygg- og anleggsteknikk", - "nob": "Bygg- og anleggsteknikk", - "nno": "Bygg- og anleggsteknikk" - } - }, "utdanningsprogram": { "kode": "BA", "type": "yrkesfaglig", diff --git a/docs/getStudents.md b/docs/getStudents.md index fb4a971..67a5cb8 100644 --- a/docs/getStudents.md +++ b/docs/getStudents.md @@ -23,22 +23,6 @@ Example response: "schoolShortName": "Testen vgs", "classId": "TESVS:TEST", "classShortId": "TEST", - "programomraade": [ - { - "kode": "BABAT1----", - "type": "yrkesfaglig", - "tittel": { - "default": "Bygg- og anleggsteknikk", - "nob": "Bygg- og anleggsteknikk", - "nno": "Bygg- og anleggsteknikk" - }, - "kortform": { - "default": "Bygg- og anleggsteknikk", - "nob": "Bygg- og anleggsteknikk", - "nno": "Bygg- og anleggsteknikk" - } - } - ], "utdanningsprogram": [ { "kode": "BA", @@ -70,22 +54,6 @@ Example response: "schoolShortName": "Testen vgs", "classId": "TESVS:TEST", "classShortId": "TEST", - "programomraade": [ - { - "kode": "BABAT1----", - "type": "yrkesfaglig", - "tittel": { - "default": "Bygg- og anleggsteknikk", - "nob": "Bygg- og anleggsteknikk", - "nno": "Bygg- og anleggsteknikk" - }, - "kortform": { - "default": "Bygg- og anleggsteknikk", - "nob": "Bygg- og anleggsteknikk", - "nno": "Bygg- og anleggsteknikk" - } - } - ], "utdanningsprogram": [ { "kode": "BA", diff --git a/docs/grep.md b/docs/grep.md index 093b0cc..3816a9d 100644 --- a/docs/grep.md +++ b/docs/grep.md @@ -2,7 +2,7 @@ ### GREP property -Some object types like ``undervisningsgruppe``, ``programomraade`` and ``utdanningsprogram`` have a ``grep`` property with different kind of values. +Some object types like ``undervisningsgruppe`` and ``utdanningsprogram`` have a ``grep`` property with different kind of values. Because our SAS isn't directly linked to the [GREP API from UDIR](https://data.udir.no/kl06), the structure and values of this object can differ based on the data we get from UDIR. @@ -27,20 +27,7 @@ Here are examples of ``grep`` properties that is _hand crafted_: } ``` -##### Example 2 (programomraade): - -```json -"programomraade": { - "kode": "HSHSF1----", - "type": "ukjent", - "kortform": { - "default": "Helse- og oppvekstfag", - "nob": "Helse- og oppvekstfag" - } -} -``` - -##### Example 3 (utdanningsprogram): +##### Example 2 (utdanningsprogram): ```json "utdanningsprogram": { @@ -74,26 +61,7 @@ Here follow some examples of correct objects (with GREP data): } ``` -##### Example 2 (programomraade): - -```json -"programomraade": { - "kode": "STSSA2----", - "type": "studieforberedende", - "tittel": { - "default": "Språk, samfunnsfag og økonomi Vg2", - "nob": "Språk, samfunnsfag og økonomi Vg2", - "nno": "Språk, samfunnsfag og økonomi Vg2" - }, - "kortform": { - "default": "Språk, samfunnsfag og økonomi", - "nob": "Språk, samfunnsfag og økonomi", - "nno": "Språk, samfunnsfag og økonomi" - } -} -``` - -##### Example 3 (utdanningsprogram): +##### Example 2 (utdanningsprogram): ```json "utdanningsprogram": { @@ -110,4 +78,4 @@ Here follow some examples of correct objects (with GREP data): "nno": "Helse- og oppvekstfag" } } -``` \ No newline at end of file +``` diff --git a/lib/repack-group.js b/lib/repack-group.js index d9d37f9..6a7a7d5 100644 --- a/lib/repack-group.js +++ b/lib/repack-group.js @@ -28,7 +28,7 @@ module.exports = (group) => { return groupInfo } - // If we got a GREP from UDIR, use that instead of Extens-datas + // If we got a GREP from UDIR, use that instead of ViS-datas if (grep) { const { kode, tittel, kortform, data_url: dataUrl } = grep @@ -43,7 +43,8 @@ module.exports = (group) => { } } - // VO 1HSB/HSF1008 => HSF1008 + // TOPPIDRETT/IDR3013/FOTBALL => IDR3013 + // sometimes there's a space and then some more text instead of a '/', this will produce some weird output if ever encountered: D2/IDR3013 Håndball => IDR3013 Håndball const kode = name.split('/')[1] return { diff --git a/lib/repack-student-utdprog.js b/lib/repack-student-utdprog.js index 4f1ca9b..94dab2d 100644 --- a/lib/repack-student-utdprog.js +++ b/lib/repack-student-utdprog.js @@ -3,7 +3,7 @@ const repackLanguage = require('./repack-languagecodes') module.exports = (utdprog) => { const { grep, id, name } = utdprog - // If we got a GREP from UDIR, use that instead of Extens-datas + // If we got a GREP from UDIR, use that instead of ViS-datas if (grep) { const { kode, type_utdanningsprogram: typeUtd, tittel, kortform } = grep const typesplit = typeUtd.split('_') @@ -17,13 +17,9 @@ module.exports = (utdprog) => { } } - // 6_BLABL1----TESVS@38099 => BLABL1---- - // 5_PB_TESVS@38099 => PB - const kode = id.split('_')[1] - - // Return Extens-group + // Return ViS-group return { - kode, + kode: id, type: 'Ukjent', tittel: repackLanguage({ default: name }), kortform: repackLanguage({ default: name }) diff --git a/lib/repack-student.js b/lib/repack-student.js index 67811f3..e823533 100644 --- a/lib/repack-student.js +++ b/lib/repack-student.js @@ -6,7 +6,6 @@ const repackGroups = require('./repack-group') module.exports = (student, removeGroups, removeUtdProg) => { const birthdate = new Date(getBirthdate(student.personalIdNumber)) - const programomraade = removeUtdProg === true ? undefined : student.programomraade.map(repackUtdprogData)[0] const utdanningsprogram = removeUtdProg === true ? undefined : student.utdanningsprogram.map(repackUtdprogData)[0] const groups = removeGroups === true ? undefined : student.groups.map(repackGroups) @@ -29,7 +28,6 @@ module.exports = (student, removeGroups, removeUtdProg) => { classShortId: student.mainGroupName.split(':')[1], level: student.level, - programomraade, utdanningsprogram, groups }