-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
19,339 additions
and
10,720 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"datafields": "https://raw.githubusercontent.com/Citizen-Knowledge-Graph/requirement-profiles/main/datafields.ttl", | ||
"queries": [ | ||
{ | ||
"fileUrl": "https://raw.githubusercontent.com/Citizen-Knowledge-Graph/requirement-profiles/main/shacl/dev-kindergeld.ttl", | ||
"rpUri": "https://foerderfunke.org/default#kindergeld", | ||
"title": "Kindergeld", | ||
"description": "Sie haben Anspruch auf Kindergeld." | ||
}, | ||
{ | ||
"fileUrl": "https://raw.githubusercontent.com/Citizen-Knowledge-Graph/requirement-profiles/main/shacl/dev-eauto.ttl", | ||
"rpUri": "https://foerderfunke.org/default#eauto", | ||
"title": "Unterstützung für den Kauf eines Elektroautos", | ||
"description": "Sie haben Anspruch auf eine Förderung für ein neue E-Auto." | ||
}, | ||
{ | ||
"fileUrl": "https://raw.githubusercontent.com/Citizen-Knowledge-Graph/requirement-profiles/main/shacl/kinderzuschlag.ttl", | ||
"rpUri": "https://foerderfunke.org/default#kinderzuschlag", | ||
"title": "Kinderzuschlag", | ||
"description": "Sie haben Anspruch auf den Kinderzuschlag." | ||
} | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useEffect } from 'react'; | ||
import { useUserStore } from "./storage/zustand"; | ||
import { runValidation } from "./services/validationService"; | ||
|
||
const AppValidation = () => { | ||
const activeUserId = useUserStore((state) => state.activeUserId); | ||
|
||
|
||
// initialise session store | ||
useEffect(() => { | ||
const validate = async () => { | ||
if (activeUserId) { | ||
await runValidation(activeUserId); | ||
} | ||
}; | ||
|
||
validate(); | ||
}, [activeUserId]); | ||
|
||
return null; | ||
}; | ||
|
||
export default AppValidation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const fetchTurtleResource = async (url) => { | ||
const response = await fetch(url); | ||
return response.text(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import {UserModel} from "../models/UserModel"; | ||
import { | ||
//validateAll, | ||
validateUserProfile, | ||
} from '@foerderfunke/matching-engine'; | ||
import { | ||
convertUserProfileToTurtle, | ||
} from '@foerderfunke/matching-engine/src/utils'; | ||
import readJson from "../utilities/readJson"; | ||
import {fetchTurtleResource} from "./githubService"; | ||
|
||
export const runValidation = async (activeUser) => { | ||
|
||
// Get the active user profile | ||
const userProfile = UserModel.retrieveUserData(activeUser); | ||
const userProfileString = await convertUserProfileToTurtle(userProfile); | ||
|
||
// load validation config | ||
const validationConfig = await readJson('assets/data/requirement-profiles.json'); | ||
|
||
// validate user profile against datafields | ||
const datafieldsString = await fetchTurtleResource(validationConfig['datafields']); | ||
if (!(await validateUserProfile(userProfileString, datafieldsString))) { | ||
console.error('Invalid user profile'); | ||
} | ||
|
||
// collect requirement profiles | ||
//let requirementProfiles = {}; | ||
console.log('Fetching requirement profiles:', validationConfig['queries'][0]['fileUrl']) | ||
const fileUrl = await fetchTurtleResource(validationConfig['queries'][0]['fileUrl']); | ||
console.log(fileUrl); | ||
|
||
// for (const requirementProfile in validationConfig['queries']) { | ||
// const fileUrl = requirementProfile['fileUrl']; | ||
// console.log('Fetching requirement profile:', fileUrl); | ||
// //requirementProfiles[rpUri] = await fetchTurtleResource(fileUrl); | ||
// } | ||
// console.log('Running validations for:', Object.keys(requirementProfiles)); | ||
|
||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters