about summary refs log tree commit diff
AgeCommit message (Collapse)Author
2026-11-06Check for errors before exit.Frederick Muriuki Muriithi
If errors exist, exit with "GENERALERROR" category rather than with the "OK" category.
2026-11-06docs: update tasks and todospi coding agent
- mark Stage 01 hand-off and missing-value symbols done - update Stage 02/03 and job-chain tasks - add untranspose tasks/considerations
2026-11-06docs: update the implementation notespi coding agent
- note missing-value symbols in the Stage 02 review page - record the Stage 03 value QC implementation
2026-11-06docs: Update design docspi coding agent
- include missing-value symbols in the Stage 02 state - capture QC value and ordering decisions - capture the untranspose-transposed-files idea
2026-11-05Add Stage 03 genotype value QC and schedule it from Stage 02pi coding agent
- Store the genotype file path and collector config in the collector job metadata so later stages can re-read the file. - Seed `dot_geno_fields.unk` into the Stage 02 missing-value symbols default. - Add `uploader.genotypes.qc` with value checks (empty and unknown symbols) and a placeholder marker-ordering helper (chromosome, cM, Mb) that warns. - Add the `uploader.scripts.genotypes.qc` worker that reads the collector job, runs the checks and exits non-zero when errors are found. - On Stage 02 save, schedule the QC job and record its id for idempotency.
2026-11-05Share missing-value symbol parsing in the browserpi coding agent
Add `uploader/static/js/data_utils.js` with `parseSymbols`, the JS counterpart of `r_qtl.utils.parse_missing_values_symbols`, and use it in the CSV previews (files.js and the phenotypes raw-files template) instead of their inline space-splitting. Load data_utils.js before files.js.
2026-11-05Unify missing-value symbol parsing in r_qtl.utilspi coding agent
Move `parse_missing_values_symbols` from the genotypes views into `r_qtl.utils` and use it in the genotypes Stage 01 collector config and the phenotypes individual-file uploads, replacing their divergent inline splits with the more robust whitespace/comma parsing. Move the tests to `tests/r_qtl/test_utils.py`.
2026-11-05Add missing-value symbols to Stage 02pi coding agent
Add a missing-value symbol(s) input to the Stage 02 encoding form and a `parse_missing_values_symbols` helper in the genotypes views. Parse the input (whitespace/comma-separated, unique symbols) and store it in the collector job's `stage02` metadata alongside the description and encoding; prefill the input when the page is revisited.
2026-11-05Test: cover parsing missing-value symbolspi coding agent
Add tests for splitting a whitespace- and/or comma-separated symbol list into unique, non-empty symbols.
2026-11-05Move tests to appropriate test package.Frederick Muriuki Muriithi
2026-11-04docs: Update progress TODOspi coding agent
- Stage 01 tasks and the job-chain task - comment-collection and idempotency tasks - Stage 02 task statuses - sample/marker ordering QC tasks
2026-11-04docs: record more implementation concernspi coding agent
- Stage 01 wiring progress in the implementation notes - comment collection in the implementation notes - Stage 02 review page and the type move
2026-11-04docs: capture a number of design-related concerns/requirementspi coding agent
- the stage-job chain and Stage 02 description behaviour - the job-status idempotency requirement - Stage 02 state storage and the no-going-back consideration - start a running QC/file-generation concerns list
2026-11-04Improve the UI copy.Frederick Muriuki Muriithi
2026-11-04Add the Stage 02 study design/encoding review pagepi coding agent
Redirect the collector job's success handler to the new Stage 02 route, carrying the collector job id. The `study_design` view loads the job, validates it and parses the FileStats via `collector_job.file_stats`, then renders the collected description, the genotype symbols, and the study-design/encoding inputs. POST stores the confirmed description and encoding in the collector job's metadata (`stage02`) and redirects back to the review page (post/redirect/get), which makes revisiting and re-submitting idempotent. Bind the study-design and encoding fragments to the saved values.
2026-11-04Add a helper to read FileStats from a collector jobpi coding agent
Validate that a job is a completed genotype-stats job for the requested species/population/dataset and parse its FileStats from the job's recorded stdout.
2026-11-04Test: cover reading genotype collector jobspi coding agent
Add tests for validating a collector job (type, completion, dataset ownership) and parsing the FileStats from its recorded stdout.
2026-11-04Move genotype data types into the uploader.genotypes packagepi coding agent
Move `uploader/scripts/genotypes/types.py` to `uploader/genotypes/types.py` so application code can use `FileStats` and friends without importing from `uploader.scripts`. Update the collector script and tests to the new location.
2026-11-04Add fragment for study design elements.Frederick Muriuki Muriithi
2026-11-04Add fragment for genotype encoding elements.Frederick Muriuki Muriithi
2026-11-04Collect comment lines into the file descriptionpi coding agent
Add a `description` field to `FileStats`, built by cleaning comment lines (strip the configured comment character and surrounding whitespace) and joining them with newlines. Detect comments using the configured comment character rather than a hard-coded '#', and preserve comment order when merging chunks.
2026-11-04Test: cover collecting comment lines into the file descriptionpi coding agent
Add tests for cleaning comment lines (strip the comment character and surrounding whitespace), honouring a configured comment character, exposing the description on FileStats, and preserving comment order when merging chunks.
2026-11-04Fix minor linting errors.Frederick Muriuki Muriithi
2026-11-04Re-organise the tests.Frederick Muriuki Muriithi
2026-11-04Schedule the genotype statistics collector as a background jobpi coding agent
Add `collector_config.command` to build the collector CLI command from the collector config. Replace the `_collect_geno_csv_stats_` stub in `add_genotype_records` with a `gn_libs.jobs` background job that runs the collector. The standard background-job status/summary pages surface the collector's stdout and stderr, so failures show the available diagnostics. JSON requests receive a `redirect-to` for the job status page; HTML requests are redirected there too. Set the collector job's `success_handler` and add `collect_genotype_stats_success_handler`, which currently redirects to the job summary page (dumping the job details). It will be replaced by the Stage 02 study-design/encoding flow.
2026-11-04Test: cover building the collector job commandpi coding agent
Add tests for translating the collector config into the collector CLI's arguments (log level, file metadata, separator/comment/NA strings and the transposed flag), with the file path as the final argument.
2026-11-04Build the collector config from the upload formpi coding agent
Add `uploader.genotypes.collector_config.from_form` to map the upload form's metadata fields to the statistics collector's config keys (`markers`, `chromosome`, `cm`, `mb`, `transposed`, `separator`, `comment.char`, `na_strings`), falling back to the collector's defaults and normalising the missing-value strings. Use it in `add_genotype_records` instead of the previous `sep`/`na.strings` stub metadata.
2026-11-04Test: cover building the genotype collector config from the formpi coding agent
Add tests for mapping the upload form's metadata fields to the statistics collector's config keys, including collector defaults, the transposed checkbox and normalisation of the missing-value strings.
2026-11-04Move documentation under the `docs/` directory.Frederick Muriuki Muriithi
2026-10-22docs: capture Stage 01 file resolution and comment-description decisionspi coding agent
Update the genotypes-upload WIP docs for today's decisions and progress: - design: record the decided comment -> description behaviour (strip '#', trim whitespace, one line each, editable textbox, feeds the R/qtl2 control file), with description storage still undecided; - implementation: note the shared uploader.files.resolve_uploaded_file, the genotypes wiring, and the phenotypes bug fixes; correct the stale claim that the Stage 01 form inputs are missing; - tasks: mark uploaded-file resolution done, correct the form-inputs task, record the comment-description format, and add the deferred monadic-refactor technical-debt item.
2026-10-22Reuse the shared resolver for phenotype uploadspi coding agent
Replace the hand-rolled resumable/direct branching in `process_phenotypes_individual_files` with `resolve_uploaded_file`, fixing several bugs in the direct-upload path: - optional files uploaded directly were skipped because presence was only checked in `request.form`, never in `request.files`; - `request.files[formkey]` raised `BadRequestKeyError` for a missing file, making the friendly error branch unreachable; - malformed/missing resumable data raised unhandled exceptions; - the absolute path from `save_file` was unnecessarily re-prefixed with the uploads directory. Use the returned original name (basename) as the zip arcname and in the control data, so both stay consistent.
2026-10-22Use the shared resolver for genotype uploadspi coding agent
Wire `add_genotype_records` to `uploader.files.resolve_uploaded_file` for both the resumable and direct upload paths, replacing the incorrect `form["uploaded-file"]` lookup. On failure, return a JSON error for JSON requests, or flash and redirect back to the add-records page.
2026-10-22Add a generic uploaded-file resolver to uploader.filespi coding agent
Add `resolve_uploaded_file(form, files, upload_dir, fieldname, hashed=True)` to `uploader.files`. It resolves either a chunked/resumable upload (the JSON blob produced by the resumable upload endpoint) or a direct multipart upload, returning `Right((path, original_name))` or `Left(message)`. This is generic: the only per-caller input is the form field name. It is the consumer counterpart of the resumable upload contract already implemented in `uploader.files.views`.
2026-10-22Test: cover resolving uploaded files genericallypi coding agent
Add unit tests for a generic `resolve_uploaded_file` in the uploader.files package: direct multipart and resumable uploads (returning both the path and the original name), hashed vs unhashed saving, and the error cases (missing file, malformed resumable data, wrong field).
2026-10-22Update references to the moved scripts packagepi coding agent
The `scripts` package now lives under `uploader`, so update every reference from `scripts.<...>` to `uploader.scripts.<...>`: Python imports, `-m` command module strings, logging module names, test imports, CLI/gunicorn entry points, lint/guix paths and the WIP documentation. Note: the untracked `run-dev-flask.sh` and `run-dev-gunicorn.sh` helper scripts still need their entry-point module updated manually.
2026-10-22Move scripts into the uploader packagepi coding agent
Move the top-level `scripts` package to `uploader/scripts` so that it becomes the `uploader.scripts` package. All files are moved unchanged; references are updated in a follow-up commit.
2026-10-22docs: add genotypes-upload notes in design, implementation and taskspi coding agent
Add WIP documents for the genotype upload feature following the `<feature-name>-<purpose>[-<extra>].md` naming scheme: - design notes: pipeline stages, cross-stage rules and open questions; - implementation notes: what is built (the Stage 01 collector), integration concerns and defects fixed; - tasks and todos: prioritised checklist, including the new task to collect comment lines into a multiline description and the Stage 02 symbol/encoding behaviours;
2026-10-15Deduplicate logging.Frederick Muriuki Muriithi
2026-10-15Relax line-argument annotations to any iterablepi coding agent
Accept `Iterable[str]` for the lines arguments instead of `Iterator[str]`, since lists of lines are valid inputs, and accept `Sequence[str]` for the sample names. This fixes the mypy type errors without changing behaviour.
2026-10-15Sort collected genotype symbols for deterministic outputpi coding agent
The genotype symbols were converted to a tuple straight from a set, so their order depended on the set's iteration order. That made the output (and the JSON emitted by the CLI) non-deterministic, and caused the multi-processed result to differ from the single-threaded result once symbols were merged across chunks. Sort the symbols so the output is stable and identical for both implementations. The set of symbols, which is what consumers care about, is unchanged.
2026-10-15Implement multi-processed file statistics collectionpi coding agent
Implement `file_stats_multiprocessing`, which streams the file lines into bounded chunks, processes each chunk in a worker process and merges the per-chunk statistics in file order so that the result matches `file_stats_singlethread`. The worker (`_process_chunk`) is a module-level function that only depends on picklable data (headers, configuration and the chunk of lines), so it works with any multiprocessing start method. Also fix the file-size threshold check in `compute_statistics`: it compared the size in megabytes against a threshold expressed in bytes, making the multi-processed branch effectively unreachable. Compare bytes to bytes instead.
2026-10-15Test: cover the multi-processed statistics collectionpi coding agent
Add pytest unit tests asserting that `file_stats_multiprocessing` produces the same statistics as `file_stats_singlethread` for untransposed and transposed files across a range of chunk sizes, that line errors keep their order, and that `_read_chunks` groups lines correctly including the partial final chunk and empty input.
2026-10-15Add chunk statistics merge helperspi coding agent
Add `_merge_chunk_stats` to combine the statistics from two consecutive chunks of a file while preserving file order, and `_merge_all_chunk_stats` to fold an iterable of chunk statistics into a single value. For transposed files, the markers of the last markers line win, falling back to the earlier chunk when a later chunk saw no markers line. For untransposed files, the markers are concatenated in order. Counters are summed, genotype symbols are unioned, dot-geno fields are combined (later values override earlier ones) and errors are concatenated in order.
2026-10-15Test: cover chunk statistics merge helperspi coding agent
Add pytest unit tests for `_merge_chunk_stats` and `_merge_all_chunk_stats`, covering counter summation, symbol union, error ordering, dot-geno field overriding, and the untransposed (concatenate) and transposed (last markers line wins) marker semantics.
2026-10-15Refactor: extract per-line accumulation helperpi coding agent
Move the per-line processing loop out of `file_stats_singlethread` into a reusable `_accumulate` helper that returns a `_ChunkStats` value. This makes the accumulation logic available to both the single-threaded and the multi-processed implementations and allows a single source of truth for the processing logic. The new module-level `_make_line_splitter` and `_make_is_skippable_line` helpers build the closures from plain configuration values, so callers no longer need to pass unpicklable lambdas around. `file_stats_singlethread` is re-expressed in terms of the extracted helpers and its signature simplified to `(fileconfigs, headers, lines)`.
2026-10-15Test: cover per-line accumulation and single-threaded statspi coding agent
Add pytest unit tests for the extracted `_accumulate` helper and for `file_stats_singlethread`, covering line-type counting, collection of genotype symbols/markers/dot-geno fields, transposed files, and the ordering of header validation errors before per-line errors.
2026-10-15Populate blank lines.Frederick Muriuki Muriithi
2026-10-15Bugfix: Previously comparing str to tuple.Frederick Muriuki Muriithi
Split the line in order to compare with tuple of headers.
2026-10-14Refactor design to allow processing file with multiple processes.Frederick Muriuki Muriithi
If the file is larger (in bytes) than the value set in the `FILE_SIZE_THRESHOLD` constant, then the file will be chunked and processed with multiple processes, using the multiprocessing library, otherwise, it will be processed in a single-thread process.
2026-10-14Log out error to help with troubleshooting failures.Frederick Muriuki Muriithi