Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .azure/prod.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"KURSINFO_API_URI": "https://api.kth.se/api/kursinfo?defaultTimeout=60000",
"CAS_SSO_URI": "https://login.kth.se",
"CM_HOST_URL": "https://www.kth.se/cm/",
"KOPPS_URI": "https://api.kth.se/api/kopps/v2/?defaultTimeout=60000",
"KURSPLAN_API_URI": "https://api.kth.se/api/kursplan?defaultTimeout=60000",
"KURSUTVECKLING_API_URI": "https://api.kth.se/api/kursutveckling?defaultTimeout=10000",
"KURS_PM_DATA_API_URI": "https://api.kth.se/api/kurs-pm-data?defaultTimeout=10000",
Expand Down
1 change: 0 additions & 1 deletion .azure/ref.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"KURSINFO_API_URI": "https://api-r.referens.sys.kth.se/api/kursinfo?defaultTimeout=60000",
"CAS_SSO_URI": "https://login-r.referens.sys.kth.se",
"CM_HOST_URL": "https://www-r.referens.sys.kth.se/cm/",
"KOPPS_URI": "https://api-r.referens.sys.kth.se/api/kopps/v2/?defaultTimeout=60000",
"KURSPLAN_API_URI": "https://api-r.referens.sys.kth.se/api/kursplan?defaultTimeout=60000",
"KURS_PM_DATA_API_URI": "https://api-r.referens.sys.kth.se/api/kurs-pm-data?defaultTimeout=5000",
"KURSUTVECKLING_API_URI": "https://api-r.referens.sys.kth.se/api/kursutveckling?defaultTimeout=50000",
Expand Down
7 changes: 0 additions & 7 deletions config/serverSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const devSsl = devDefaults(false)
const devUrl = devDefaults('http://localhost:' + devPort)
const devKursInfoApi = devDefaults('http://api-r.referens.sys.kth.se/api/kursinfo?defaultTimeout=10000') // required=true&
const devKursplanApi = devDefaults('http://api-r.referens.sys.kth.se/api/kursplan?defaultTimeout=10000')
const devKoppsApi = devDefaults('https://api-r.referens.sys.kth.se/api/kopps/v2/?defaultTimeout=10000')
const devKursPmDataApi = devDefaults('http://api-r.referens.sys.kth.se/api/kurs-pm-data?defaultTimeout=10000')
const devKursutvecklingApi = devDefaults('http://api-r.referens.sys.kth.se/api/kursutveckling?defaultTimeout=10000') // required=true&
const devTimeTableApiUri = devDefaults('https://api-r.referens.sys.kth.se/api/timetable/v1/?defaultTimeout=10000')
Expand Down Expand Up @@ -68,8 +67,6 @@ module.exports = {
ocpApimSubscriptionKey: getEnv('LADOK_OCP_APIM_SUBSCRIPTION_KEY', null),
},

koppsApi: unpackKOPPSConfig('KOPPS_URI', devKoppsApi),

// TimeTableApi is not Kopps, but the unpacking works nevertheless
timeTableApi: unpackKOPPSConfig('TIME_TABLE_API_URI', devTimeTableApiUri),

Expand All @@ -86,10 +83,6 @@ module.exports = {
},
clientLogging: { level: 'info' },
cache: {
koppsApi: {
redis: unpackRedisConfig('REDIS_URI', devRedis),
expireTime: getEnv('KOPPS_API_CACHE_EXPIRE_TIME', 60 * 60), // 60 minuteS
},
kursinfoApi: {
redis: unpackRedisConfig('REDIS_URI', devRedis),
expireTime: getEnv('KURSINFO_API_CACHE_EXPIRE_TIME', 2 * 60), // 2 * 60 s = 2 MINUTES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { schools } from './domain/index'
import { MemosSummary } from './index'

function ResultNumbersSummary({ statisticsResult }) {
const { documentType, koppsApiBasePath } = statisticsResult
const { documentType, ladokApiBasePath } = statisticsResult
// labels are for headers and short texts
const {
translation: { statisticsLabels: labels },
Expand All @@ -30,7 +30,7 @@ function ResultNumbersSummary({ statisticsResult }) {
{texts.subPageDescription()}
<details>
<summary className="white">{summaryLabels.sourceOfData}</summary>
{texts.courseDataApiDescription(koppsApiBasePath)}
{texts.courseDataApiDescription(ladokApiBasePath)}
</details>
</article>
<article key="documents-and-courses-compilation">
Expand All @@ -44,7 +44,7 @@ ResultNumbersSummary.propTypes = {
statisticsResult: PropTypes.shape({
combinedMemosPerSchool: PropTypes.shape({}),
documentType: PropTypes.oneOf(documentTypes()),
koppsApiBasePath: PropTypes.string,
ladokApiBasePath: PropTypes.string,
documentsApiBasePath: PropTypes.string,
school: PropTypes.oneOf(schools.orderedSchoolsFormOptions()),
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ function _getDataRowsForCourseMemo(offeringsWithMemos, year, browserConfig, seme
institution,
courseCode: offering.courseCode,
linkedProgram: offering.connectedPrograms,
applicationCode:
offering.courseRoundApplications && offering.courseRoundApplications.length > 0
? offering.courseRoundApplications[0].course_round_application_code
: '',
applicationCode: offering.courseRoundApplicationCode ?? '',
period,
courseStart:
languageIndex === 0 && offering.startDate && offering.startDate !== ''
Expand Down
43 changes: 22 additions & 21 deletions public/js/app/components/statistics/texts/memosTexts.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import React from 'react'

const englishMemosSummarySection = {
courseDataApiDescription: koppsApiUrl => (
courseDataApiDescription: ladokApiUrl => (
<div>
<p>Example for how data is fetched for Spring 2022, period P3, school ABE:</p>
<p>Example for how data is fetched for Spring 2025, period P3, school ABE:</p>
<p>
Course data is retrieved from&nbsp; KOPPS API for Courses, endpoint&nbsp; /api/kopps/v2/courses/offerings. Data
for the current page was fetched from&nbsp;
Course data is retrieved from&nbsp; LADOK Mellanlager API, endpoint&nbsp; /sokUtbildningstillfalle. In this
example, data is fetched from&nbsp;
<a
href={`${koppsApiUrl}courses/offerings?from=20221&skip_coordinator_info=true`}
href={`${ladokApiUrl}/sokUtbildningstillfalle?striktKod=false&kodEllerBenamning=*&startPeriod=VT2025&organisation=AIJ,AEH,AFO,AA,ADD,ADB,ADC,ADA,ADI,ADJ,ADH,AFB,AFD,AFC,AGD,AFA,AF,AFF,AID,AFK,AM,AMB,AHG,AFV,AEB,AEE,AFG,AEF,AGE,ALD,AEK,AFL,AGC,AIG,AHC,AGF,AFI,AKC,ALB,AFJ,ALC,AE,AEA,ADF,AKA,AK,AKB,AIE,AIB,AIC,AIA,AI,AFM,AEG,AHE,AHF,AIF,A,AAB,AAC,AD,AFH,AFE,ALF,AFT,ALA,AL,AHD,AFP,AHB,AHA,AH,AGI,AGA,AG,AGB,AEC,ALI,AED`}
target="_blank"
className="external-link"
rel="noreferrer"
>
{`${koppsApiUrl}courses/offerings?from=20221&skip_coordinator_info=true`}
{`${ladokApiUrl}/sokUtbildningstillfalle?striktKod=false&kodEllerBenamning=*&startPeriod=VT2025&organisation=AIJ,AEH,AFO,AA,ADD,ADB,ADC,ADA,ADI,ADJ,ADH,AFB,AFD,AFC,AGD,AFA,AF,AFF,AID,AFK,AM,AMB,AHG,AFV,AEB,AEE,AFG,AEF,AGE,ALD,AEK,AFL,AGC,AIG,AHC,AGF,AFI,AKC,ALB,AFJ,ALC,AE,AEA,ADF,AKA,AK,AKB,AIE,AIB,AIC,AIA,AI,AFM,AEG,AHE,AHF,AIF,A,AAB,AAC,AD,AFH,AFE,ALF,AFT,ALA,AL,AHD,AFP,AHB,AHA,AH,AGI,AGA,AG,AGB,AEC,ALI,AED`}
</a>
.
</p>
<p>
For course memos, offerings that didn’t start during the 20221 semester are filtered out. This is done by
discarding offerings that doesn’t meet the criteria: course.first_yearsemester == 20221,
course.first_period===20221P3, SCHOOL_MAP[course.school_code]=== &apos;ABE&apos;. Date used to determine if memo
was published before the offering started is course.offered_semesters[&#123;{20221}&#125;].start_date.
For course memos, offerings that didn’t start during the VT2025 semester are filtered out. This is done by
discarding offerings that doesn’t meet the criteria: course.startPeriod == VT2025,
course.forstaUndervisningsdatum.kthStudyPeriod == 3, SCHOOL_MAP[course.school_code] === &apos;ABE&apos;. Date
used to determine if memo was published before the offering started is course.forstaUndervisningsdatum.date.
</p>
<p>
An earlier version of <i>Publish new course analysis and course data</i> had the option to upload course memos
Expand All @@ -34,7 +34,7 @@ const englishMemosSummarySection = {
<div>
<p>
Here is a summary of the number of published course memos for the selected school, year and study period. The
data used is taken from Kopps and About course.
data used is taken from LADOK and About course.
</p>
<p>
The table shows the number of courses that started and number of course memos that were published during the
Expand Down Expand Up @@ -70,23 +70,24 @@ const englishMemosSummarySection = {
}

const swedishMemosSummarySection = {
courseDataApiDescription: koppsApiUrl => (
courseDataApiDescription: ladokApiUrl => (
<div>
<p>Exempel för hur data hämtas för en termin - VT 2022, period P3:</p>
<p>Exempel för hur data hämtas för en termin - VT 2025, period P3, school ABE:</p>
<p>
Kursdata hämtas från KOPPS API för kurser, endpoint: /api/kopps/v2/courses/offerings. För att hämta data för VT
2022 så används:{' '}
Kursdata hämtas från LADOK Mellanlager API, endpoint: /sokUtbildningstillfalle. För att hämta data för VT 2025,
period P3, school ABE så används:{' '}
<a
href={`${koppsApiUrl}courses/offerings?from=20221&skip_coordinator_info=true`}
href={`${ladokApiUrl}/sokUtbildningstillfalle?striktKod=false&kodEllerBenamning=*&startPeriod=VT2025&organisation=AIJ,AEH,AFO,AA,ADD,ADB,ADC,ADA,ADI,ADJ,ADH,AFB,AFD,AFC,AGD,AFA,AF,AFF,AID,AFK,AM,AMB,AHG,AFV,AEB,AEE,AFG,AEF,AGE,ALD,AEK,AFL,AGC,AIG,AHC,AGF,AFI,AKC,ALB,AFJ,ALC,AE,AEA,ADF,AKA,AK,AKB,AIE,AIB,AIC,AIA,AI,AFM,AEG,AHE,AHF,AIF,A,AAB,AAC,AD,AFH,AFE,ALF,AFT,ALA,AL,AHD,AFP,AHB,AHA,AH,AGI,AGA,AG,AGB,AEC,ALI,AED`}
target="_blank"
rel="noreferrer"
>
{`${koppsApiUrl}courses/offerings?from=20221&skip_coordinator_info=true`}
{`${ladokApiUrl}/sokUtbildningstillfalle?striktKod=false&kodEllerBenamning=*&startPeriod=VT2025&organisation=AIJ,AEH,AFO,AA,ADD,ADB,ADC,ADA,ADI,ADJ,ADH,AFB,AFD,AFC,AGD,AFA,AF,AFF,AID,AFK,AM,AMB,AHG,AFV,AEB,AEE,AFG,AEF,AGE,ALD,AEK,AFL,AGC,AIG,AHC,AGF,AFI,AKC,ALB,AFJ,ALC,AE,AEA,ADF,AKA,AK,AKB,AIE,AIB,AIC,AIA,AI,AFM,AEG,AHE,AHF,AIF,A,AAB,AAC,AD,AFH,AFE,ALF,AFT,ALA,AL,AHD,AFP,AHB,AHA,AH,AGI,AGA,AG,AGB,AEC,ALI,AED`}
</a>
. Kurs-PM med kursomgångar som inte startar under VT 2022 filtreras bort. Detta görs genom att förkasta
kursomgångar som inte uppfyller kriterierna: course.first_yearsemester == 20221, course.first_period===20221P3,
SCHOOL_MAP[course.school_code]=== &apos;ABE&apos;. Datum som används för att avgöra om kurs-PM publicerades
innan kursomgången startade är: course.offered_semesters[&#123;{20221}&#125;].start_date.
kursomgångar som inte uppfyller kriterierna: course.startPeriod == VT2025,
course.forstaUndervisningsdatum.kthStudyPeriod == 3, SCHOOL_MAP[course.school_code] === &apos;ABE&apos;. Datum
som används för att avgöra om kurs-PM publicerades innan kursomgången startade är:
course.forstaUndervisningsdatum.date.
</p>
<p>
En tidigare version av <i>Publicera ny kursanalys och kursdata</i> innehöll möjligheten att ladda upp kurs-PM
Expand All @@ -99,7 +100,7 @@ const swedishMemosSummarySection = {
<div>
<p>
Här visas en sammanställning över antalet publicerade kurs-PM för vald skola, år och läsperiod. Den data som
används hämtas från Kopps och Om kursen.
används hämtas från LADOK och Om kursen.
</p>
<p>
Tabellen visar antalet kurser som startade och antalet kurs-PM som publicerades under den valda läsperioden. De
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const memos2021 = {
totalNumberOfMemosPublishedBeforeDeadline: 36,
},
documentType: 'courseMemo',
koppsApiBasePath: 'https://api-r.referens.sys.kth.se/api/kopps/v2/',
ladokApiBasePath: 'https://ladok-mellanlagring-lab.azure-api.net',
documentsApiBasePath: 'http://localhost/api/kurs-pm-data',
school: 'allSchools',
periods: ['0', '1', '2', '3', '4', '5'],
Expand Down Expand Up @@ -129,7 +129,7 @@ const memos2020 = {
totalNumberOfMemosPublishedBeforeDeadline: 45,
},
documentType: 'courseMemo',
koppsApiBasePath: 'https://api-r.referens.sys.kth.se/api/kopps/v2/',
ladokApiBasePath: 'https://ladok-mellanlagring-lab.azure-api.net',
documentsApiBasePath: 'http://localhost/api/kurs-pm-data',
school: 'allSchools',
periods: ['0', '1', '2', '3', '4', '5'],
Expand Down
43 changes: 0 additions & 43 deletions server/apiCalls/koppsCourseData.js

This file was deleted.

12 changes: 12 additions & 0 deletions server/apiCalls/ladokApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,21 @@ async function getPeriods() {
}
}

async function getAllCourseRounds(query, lang) {
try {
const courseRounds = await client.getAllCourseRounds(query, lang)

return courseRounds
} catch (error) {
log.error(error)
return undefined
}
}

module.exports = {
getCourseAndRounds,
getExaminationModules,
getLadokSyllabuses,
getPeriods,
getAllCourseRounds,
}
11 changes: 7 additions & 4 deletions server/apiCalls/transformers/memos.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ const { findMemosForApplicationCode } = require('./docs')
const _memosPerCourseOffering = async (parsedOfferings, memos) => {
const courseOfferings = []
await parsedOfferings.forEach(offering => {
const { courseCode, firstSemester, courseRoundApplications } = offering
const [courseRoundApplication] = courseRoundApplications
const { course_round_application_code: applicationCode } = courseRoundApplication
const { courseCode, firstSemester, courseRoundApplicationCode } = offering
let courseMemoInfo = {}
const memosForApplicationCode = findMemosForApplicationCode(memos, courseCode, firstSemester, applicationCode)
const memosForApplicationCode = findMemosForApplicationCode(
memos,
courseCode,
firstSemester,
courseRoundApplicationCode
)

if (memosForApplicationCode.length === 1) {
const [publishedMemo] = memosForApplicationCode
Expand Down
Loading
Loading