|
| 1 | +#!/usr/bin/env python3 |
| 2 | +# pylint: disable=too-many-instance-attributes,too-many-locals,unused-argument,wrong-import-order,unused-argument |
| 3 | +from typing import List |
| 4 | +import logging |
| 5 | + |
| 6 | +from metamist.parser.generic_metadata_parser import ( |
| 7 | + GenericMetadataParser |
| 8 | +) |
| 9 | +from metamist.parser.generic_parser import SingleRow |
| 10 | + |
| 11 | +logger = logging.getLogger(__file__) |
| 12 | +logger.addHandler(logging.StreamHandler()) |
| 13 | +logger.setLevel(logging.INFO) |
| 14 | + |
| 15 | +__DOC = """ |
| 16 | +Sample JSON parser - TODO add more details |
| 17 | +
|
| 18 | +JSON data example: |
| 19 | +{"identifier": "AB0002", "name": "j smith", "age": 50, "dob": "5/05/1950", "measurement": "98.7", "observation": "B++", "receipt_date": "1/02/2023"} |
| 20 | +
|
| 21 | +""" |
| 22 | + |
| 23 | + |
| 24 | +class SampleJsonColumns: |
| 25 | + """Column keys for JSON Sample Data""" |
| 26 | + |
| 27 | + IDENTIFIER = 'identifier' |
| 28 | + NAME = 'name' |
| 29 | + AGE = 'age' |
| 30 | + DOB = 'dob' |
| 31 | + MEASUREMENT = 'measurement' |
| 32 | + OBSERVATION = 'observation' |
| 33 | + RECEIPT_DATE = 'receipt_date' |
| 34 | + |
| 35 | + @staticmethod |
| 36 | + def participant_meta_map(): |
| 37 | + """Participant meta map""" |
| 38 | + return {} |
| 39 | + |
| 40 | + @staticmethod |
| 41 | + def sequence_meta_map(): |
| 42 | + """Columns that will be put into sequence.meta""" |
| 43 | + return {} |
| 44 | + |
| 45 | + @staticmethod |
| 46 | + def sample_meta_map(): |
| 47 | + """Columns that will be put into sample.meta""" |
| 48 | + return {} |
| 49 | + |
| 50 | + |
| 51 | +class SampleJsonParser(GenericMetadataParser): |
| 52 | + """Parser for Sample JSON Records""" |
| 53 | + |
| 54 | + def __init__( |
| 55 | + self, |
| 56 | + project: str |
| 57 | + ): |
| 58 | + super().__init__( |
| 59 | + project=project, |
| 60 | + participant_meta_map=SampleJsonColumns.participant_meta_map(), |
| 61 | + sample_meta_map=SampleJsonColumns.sample_meta_map(), |
| 62 | + assay_meta_map=SampleJsonColumns.sequence_meta_map() |
| 63 | + ) |
| 64 | + |
| 65 | + |
0 commit comments