Skip to content
This repository has been archived by the owner on Jan 17, 2025. It is now read-only.

Commit

Permalink
Merge pull request #71 from vtfk/remove-programomraade
Browse files Browse the repository at this point in the history
Removed programomaader since it has no usable data from FINT
  • Loading branch information
runely authored Aug 27, 2021
2 parents 42ebdf1 + e01e39a commit ac6cd3a
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 108 deletions.
16 changes: 1 addition & 15 deletions docs/getClassStudents.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
<br />

Expand All @@ -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",
Expand Down
14 changes: 0 additions & 14 deletions docs/getStudent.md
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
32 changes: 0 additions & 32 deletions docs/getStudents.md
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
40 changes: 4 additions & 36 deletions docs/grep.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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": {
Expand Down Expand Up @@ -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": {
Expand All @@ -110,4 +78,4 @@ Here follow some examples of correct objects (with GREP data):
"nno": "Helse- og oppvekstfag"
}
}
```
```
5 changes: 3 additions & 2 deletions lib/repack-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 {
Expand Down
10 changes: 3 additions & 7 deletions lib/repack-student-utdprog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('_')
Expand All @@ -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 })
Expand Down
2 changes: 0 additions & 2 deletions lib/repack-student.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -29,7 +28,6 @@ module.exports = (student, removeGroups, removeUtdProg) => {
classShortId: student.mainGroupName.split(':')[1],
level: student.level,

programomraade,
utdanningsprogram,
groups
}
Expand Down

0 comments on commit ac6cd3a

Please # to comment.