Back to Prompt Library
implementation
Build the application
Inspect the original prompt language first, then copy or adapt it once you know how it fits your workflow.
Linked challenge: Build a Pydantic AI FHIR Observation Curation Pipeline for NCBI Datasets
Format
Code-aware
Lines
85
Sections
11
Linked challenge
Build a Pydantic AI FHIR Observation Curation Pipeline for NCBI Datasets
Prompt source
Original prompt text with formatting preserved for inspection.
85 lines
11 sections
No variables
1 code block
## Build
Parse multi-transcript FASTA packages downloaded via NCBI Datasets. Evaluate coding sequence integrity and use Pydantic AI to map metrics into strongly typed FHIR R5 Observation JSON bundles.
## User
Bioinformatics Data Curator
## Workflow
1. Ingest gene data package zip archives containing transcript and CDS sequences.
2. Parse FASTA sequence records using Biopython SeqIO to verify start codons and length multiples.
3. Map validated sequence features into FHIR R5 Observation components referencing NCBI gene identifiers using Pydantic AI.
4. Generate a validated JSON bundle with human-readable diagnostic summaries for cohort curation.
## Interface
CLI tool that accepts gene FASTA archives and emits compliant FHIR R5 JSON bundles.
## Data
Download public gene packages using the NCBI Datasets CLI tool for non-clinical model organisms or reference genes.
Starter examples below are synthetic. They are not downloaded records.
## Source
[NCBI Datasets gene download](https://www.ncbi.nlm.nih.gov/datasets/docs/v2/how-tos/genes/download-gene-data-package/)
Utilizes the NCBI Datasets gene data package archive structure containing gene, RNA, CDS, and protein FASTA sequences.
## Tools
pydantic-ai, biopython.
Pydantic AI guarantees type-safe validation when mapping sequence metrics into FHIR JSON schema specifications.
Local or hosted LLM with structured output support via OpenAI-compatible or Anthropic API.
## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.
## Acceptance
- Correctly parses multi-record CDS FASTA files and flags invalid frame lengths.
- Maps gene IDs and transcripts to FHIR R5 Observation and DiagnosticReport JSON models using Pydantic AI.
- Emits complete FHIR Bundles conforming to standard JSON serialization.
## Starter Examples
```json
[
{
"input": {
"gene_id": "672",
"fasta_header": "NM_007294.4 BRCA1 CDS [location=1..228]",
"sequence": "ATGGATTTATCTGCTCTTCGCGTTGAAGAAGTACAAAATGTCATTAATGCTATGCAGAAAATCTTAGAGTGTCCCATCTGTCTGGAGTTGATCAAGGAACCTGTCTCCACAAAGTGTGACCACATATTTTGCAAATTTTGCATGCTGAAACTTCTCAACCAGAAGAAAGGGCCTTCACAGTGTCCTTTATGTAAGAATGATATAACCAAAAGGAGCCTACAAGAAAGTACGAGATTTAGTCAACTTGTTGAAGAGCTATTGAAAATCATTTGTGCTTTTCAGCTTGACACAGGTTTGGAGTATGCAAACAGCTATAATTTTGCAAAAAAGGAAAATAACTCTCCTGAACATCTAAAAGATGAAGTTTCTATCATCCAAAGTATGGGCTACAGAAACCGTGCCAAAAGACTTCTTACAGAAAGTGA"
},
"expected_output": {
"resourceType": "Observation",
"status": "final",
"code": {
"coding": [
{
"system": "https://www.ncbi.nlm.nih.gov/gene",
"code": "672",
"display": "BRCA1"
}
]
},
"valueQuantity": {
"value": 435,
"unit": "base pairs"
},
"valid_open_reading_frame": true
}
},
{
"input": {
"gene_id": "672",
"fasta_header": "NM_000000.1 Malformed",
"sequence": "ATGGCCT"
},
"expected_output": {
"resourceType": "Observation",
"status": "preliminary",
"code": {
"coding": [
{
"system": "https://www.ncbi.nlm.nih.gov/gene",
"code": "672",
"display": "BRCA1"
}
]
},
"valueQuantity": {
"value": 7,
"unit": "base pairs"
},
"valid_open_reading_frame": false
}
}
]
```
## Safety
Research-only sequence curation tool. Contains simulated metadata without patient identifiers or diagnostic assertions. Output examples are simplified synthetic app records, not complete official schema files.
Use mock external writes. Require human review before any real deployment.Adaptation plan
Keep the source stable, then change the prompt in a predictable order so the next run is easier to evaluate.
Keep stable
Hold the task contract and output shape stable so generated implementations remain comparable.
Tune next
Update libraries, interfaces, and environment assumptions to match the stack you actually run.
Verify after
Test failure handling, edge cases, and any code paths that depend on hidden context or secrets.