@longtable/core 0.1.53 → 0.1.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FirstResearchShape, LongTableQuestionObligation, QuestionRecord, ResearchSpecification } from "./types.js";
|
|
2
|
+
export type ResearchSpecificationReadinessStatus = "no_spec" | "shape_only" | "structurally_incomplete" | "draft_pending_confirmation" | "deferred" | "confirmed";
|
|
3
|
+
export type ResearchSpecificationStructuralStatus = "missing" | "incomplete" | "complete";
|
|
4
|
+
export type ResearchSpecificationConfirmationStatus = "not_applicable" | "pending" | "deferred" | "confirmed";
|
|
5
|
+
export type ResearchSpecificationReadinessNextAction = "start" | "confirm_spec" | "resume_confirmation" | "interview";
|
|
6
|
+
export interface ResearchSpecificationReadinessInput {
|
|
7
|
+
researchSpecification?: ResearchSpecification;
|
|
8
|
+
firstResearchShape?: FirstResearchShape;
|
|
9
|
+
questionLog?: QuestionRecord[];
|
|
10
|
+
questionObligations?: LongTableQuestionObligation[];
|
|
11
|
+
}
|
|
12
|
+
export interface ResearchSpecificationReadiness {
|
|
13
|
+
exists: boolean;
|
|
14
|
+
status: ResearchSpecificationReadinessStatus;
|
|
15
|
+
structuralStatus: ResearchSpecificationStructuralStatus;
|
|
16
|
+
confirmationStatus: ResearchSpecificationConfirmationStatus;
|
|
17
|
+
usableForInterview: boolean;
|
|
18
|
+
blockingGaps: string[];
|
|
19
|
+
nextAction: ResearchSpecificationReadinessNextAction;
|
|
20
|
+
}
|
|
21
|
+
export declare function requiredResearchSpecificationGaps(specification: ResearchSpecification): string[];
|
|
22
|
+
export declare function evaluateResearchSpecificationReadiness(input: ResearchSpecificationReadinessInput): ResearchSpecificationReadiness;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
function hasText(value) {
|
|
2
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
3
|
+
}
|
|
4
|
+
function hasItems(values) {
|
|
5
|
+
return Array.isArray(values) && values.some((value) => hasText(value));
|
|
6
|
+
}
|
|
7
|
+
export function requiredResearchSpecificationGaps(specification) {
|
|
8
|
+
const gaps = [];
|
|
9
|
+
if (!hasText(specification.researchDirection.question)) {
|
|
10
|
+
gaps.push("research question");
|
|
11
|
+
}
|
|
12
|
+
if (!hasItems(specification.constructOntology.coreConstructs)) {
|
|
13
|
+
gaps.push("construct map/core constructs");
|
|
14
|
+
}
|
|
15
|
+
if (!hasItems(specification.researchDirection.inclusionCriteria) &&
|
|
16
|
+
!hasItems(specification.researchDirection.exclusionCriteria)) {
|
|
17
|
+
gaps.push("inclusion/exclusion rule");
|
|
18
|
+
}
|
|
19
|
+
if (!hasItems(specification.evidenceAccess.requiredSources) &&
|
|
20
|
+
!hasItems(specification.evidenceAccess.evidenceStandards)) {
|
|
21
|
+
gaps.push("evidence boundary");
|
|
22
|
+
}
|
|
23
|
+
if (!hasText(specification.methodAnalysis.design) &&
|
|
24
|
+
!hasItems(specification.methodAnalysis.analysisOptions)) {
|
|
25
|
+
gaps.push("method commitment");
|
|
26
|
+
}
|
|
27
|
+
if (!hasItems(specification.openQuestions) &&
|
|
28
|
+
!hasItems(specification.protectedDecisions)) {
|
|
29
|
+
gaps.push("unresolved decisions/protected decisions");
|
|
30
|
+
}
|
|
31
|
+
if (!hasItems(specification.evidenceAccess.accessRequirements) &&
|
|
32
|
+
!hasItems(specification.evidenceAccess.requiredSources)) {
|
|
33
|
+
gaps.push("search/access assumptions");
|
|
34
|
+
}
|
|
35
|
+
return gaps;
|
|
36
|
+
}
|
|
37
|
+
function hasPendingResearchSpecificationConfirmation(input) {
|
|
38
|
+
return (input.questionLog ?? []).some((record) => record.status === "pending" &&
|
|
39
|
+
record.prompt.checkpointKey === "research_specification_confirmation") || (input.questionObligations ?? []).some((obligation) => obligation.status === "pending" &&
|
|
40
|
+
obligation.kind === "research_specification_confirmation");
|
|
41
|
+
}
|
|
42
|
+
export function evaluateResearchSpecificationReadiness(input) {
|
|
43
|
+
const specification = input.researchSpecification;
|
|
44
|
+
if (!specification) {
|
|
45
|
+
if (input.firstResearchShape) {
|
|
46
|
+
return {
|
|
47
|
+
exists: false,
|
|
48
|
+
status: "shape_only",
|
|
49
|
+
structuralStatus: "missing",
|
|
50
|
+
confirmationStatus: "not_applicable",
|
|
51
|
+
usableForInterview: false,
|
|
52
|
+
blockingGaps: [
|
|
53
|
+
"Research Specification missing",
|
|
54
|
+
"First Research Shape is only a handle/resume layer"
|
|
55
|
+
],
|
|
56
|
+
nextAction: "start"
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
exists: false,
|
|
61
|
+
status: "no_spec",
|
|
62
|
+
structuralStatus: "missing",
|
|
63
|
+
confirmationStatus: "not_applicable",
|
|
64
|
+
usableForInterview: false,
|
|
65
|
+
blockingGaps: ["Research Specification missing"],
|
|
66
|
+
nextAction: "start"
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const structuralGaps = requiredResearchSpecificationGaps(specification);
|
|
70
|
+
if (structuralGaps.length > 0) {
|
|
71
|
+
return {
|
|
72
|
+
exists: true,
|
|
73
|
+
status: "structurally_incomplete",
|
|
74
|
+
structuralStatus: "incomplete",
|
|
75
|
+
confirmationStatus: "not_applicable",
|
|
76
|
+
usableForInterview: false,
|
|
77
|
+
blockingGaps: structuralGaps,
|
|
78
|
+
nextAction: "start"
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (specification.confirmedAt || specification.status === "confirmed") {
|
|
82
|
+
return {
|
|
83
|
+
exists: true,
|
|
84
|
+
status: "confirmed",
|
|
85
|
+
structuralStatus: "complete",
|
|
86
|
+
confirmationStatus: "confirmed",
|
|
87
|
+
usableForInterview: true,
|
|
88
|
+
blockingGaps: [],
|
|
89
|
+
nextAction: "interview"
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
if (specification.status === "deferred") {
|
|
93
|
+
return {
|
|
94
|
+
exists: true,
|
|
95
|
+
status: "deferred",
|
|
96
|
+
structuralStatus: "complete",
|
|
97
|
+
confirmationStatus: "deferred",
|
|
98
|
+
usableForInterview: false,
|
|
99
|
+
blockingGaps: ["Research Specification confirmation deferred"],
|
|
100
|
+
nextAction: "resume_confirmation"
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
const pendingConfirmation = hasPendingResearchSpecificationConfirmation(input);
|
|
104
|
+
return {
|
|
105
|
+
exists: true,
|
|
106
|
+
status: "draft_pending_confirmation",
|
|
107
|
+
structuralStatus: "complete",
|
|
108
|
+
confirmationStatus: pendingConfirmation ? "pending" : "not_applicable",
|
|
109
|
+
usableForInterview: false,
|
|
110
|
+
blockingGaps: ["Research Specification confirmation pending"],
|
|
111
|
+
nextAction: pendingConfirmation ? "resume_confirmation" : "confirm_spec"
|
|
112
|
+
};
|
|
113
|
+
}
|