We need answer user's request. Need produce final JSON only, no markdown. Need parse data and compute.

User Japanese: fictional measurement records. Need extract specified IDs in order: P1-0001, P1-0008, P1-0017, P1-0028, P1-0038, P1-0045. records array of 6 JSON objects keys id, code, value_mg integer. total_mg is sum of value_mg of records 1st, 3rd, 6th (1-based). missing is measurement value for ID=P1-9999 if absent null. Keys only records,total_mg,missing. Output JSON object with those keys. No external tools. Need ensure exact values.

Let's extract:
P1-0001: line0002 code 0d779aa92c4b value 411
P1-0008: line0009 code 6145b5511a6d value 869
P1-0017: line0018 code 7f33f46e3c72 value 191
P1-0028: line0029 code 1ce11754e79b value 633
P1-0038: line0039 code 75a4dd4130f3 value 686
P1-0045: line0046 code 73414e4bb5e3 value 366

records order as specified. total_mg = records[0] + records[2] + records[5] = 411 + 191 + 366 = 968? 411+191=602; +366=968. missing null because P1-9999 not present.

Need output JSON object only. Ensure integer not string. Keys exactly records,total_mg,missing. Could include null. No markdown.

Double-check if total_mg maybe sum of 1st, 3rd, 6th of records: yes. If records are 6 objects. Good.

Need final: {"records":[{"id":"P1-0001","code":"0d779aa92c4b","value_mg":411},...],"total_mg":968,"missing":null}

Need ensure no trailing spaces? fine.
