-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from betagouv/maud/pathologies_definitions
Add pathologies definitions
- Loading branch information
Showing
3 changed files
with
26 additions
and
6 deletions.
There are no files selected for viewing
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
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,15 @@ | ||
import { getGristTableData } from "@/data/grist"; | ||
|
||
export async function getPathologyDefinition( | ||
code: `${number}`, | ||
): Promise<string> { | ||
const data = await getGristTableData("Pathologies"); | ||
const record = data.find( | ||
(record: any) => record.fields.codePatho === Number(code), | ||
); | ||
if (!record) { | ||
throw new Error(`Pathology code not found: ${code}`); | ||
} | ||
|
||
return record.fields.Definition_pathologie as string; | ||
} |