Skip to content

Commit

Permalink
Merge branch 'Psych-DS' of https://github.com/vzhang03/jsPsych into P…
Browse files Browse the repository at this point in the history
…sych-DS
  • Loading branch information
Bankminer78 committed May 30, 2024
2 parents c19c4c2 + 4c5d972 commit 8dfc8dc
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/jspsych/src/modules/metadata/VariablesMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export class VariablesMap {
this.generateDefaultVariables();
}

// trial type, trial index, time elapsed, interal typenode id
// trial type, trial index, time elapsed, interal typenode id - can add more below
generateDefaultVariables(): void {
this.variables = {};

Expand Down
79 changes: 79 additions & 0 deletions packages/jspsych/src/modules/metadata/metadata.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
@startuml Metadata

class JsPsychMetadata {
-Map metadata
-AuthorsMap authors
-VariablesMap variables
+void generateDefaultMetadata()
+void setMetadataField(key: string, value: any)
+any getMetadataField(key: string)
+Map getMetadata()
+void setAuthor(fields: AuthorFields)
+Map getAuthor(name: string)
+void setVariable(fields: VariableFields)
+Map getVariable(name: string)
+void updateVariable(var_name: string, field_name: string, added_value: string | boolean | number | {})
+void deleteVariable(var_name: string)
+string[] getVariableNames()
+void displayMetadata()
+void saveAsJsonFile()
+void generateFakeMetadata()
}

class AuthorsMap {
-Map authors

+Map[] or string[] getList()
+void setAuthor(fields: AuthorFields)
+{} getAuthor(name: string)
}

class VariablesMap {
-variables: {}

+void generateDefaultVariables()
+{}[] getList()
+void setVariable(fields: VariableFields)
+{} getVariable(name: string)
+string[] getVariableNames()
+void updateVariable(var_name: string, field_name: string, added_value: string | boolean | number | Map)
+void deleteVariable(var_name: string)
}


class AuthorFields {
+type: string
+name: string
+givenName: string
+familyName: string
+identifier: string
}

class VariableFields {
+type: string
+name: string
+description: string | Object
+value: string
+identifier: string
+minValue: number
+maxValue: number
+levels: string[]
+levelsOrdered: boolean
+na: boolean
+naValue: string
+alternateName: string
+privacy: string
}

JsPsychMetadata -down-> VariableFields : uses
JsPsychMetadata -down-> AuthorFields : uses
JsPsychMetadata -down> AuthorsMap : uses
JsPsychMetadata -down> VariablesMap : uses


AuthorsMap -down> AuthorFields : uses
VariablesMap -down> VariableFields : uses


@enduml

0 comments on commit 8dfc8dc

Please sign in to comment.